Skip to content

Commit

Permalink
✨ add more info to okta providers and asset info (#903)
Browse files Browse the repository at this point in the history
```
asset: {
  kind: "api"
  build: ""
  version: ""
  title: "Okta Organization"
  arch: ""
  labels: {}
  platform: "okta-org"
  runtime: "okta"
  ids: [
    0: "00o8..."
  ]
  name: "Okta organization dev-....okta.com"
  fqdn: ""
  family: [
    0: "okta"
  ]
}
```

Signed-off-by: Dominik Richter <[email protected]>

Signed-off-by: Dominik Richter <[email protected]>
  • Loading branch information
arlimus committed Feb 8, 2023
1 parent 77516fd commit 8ee5cef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions motor/platform/detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ func (d *Detector) Platform() (*platform.Platform, error) {
}, nil
case *okta.Provider:
return &platform.Platform{
Name: "okta",
Title: "Okta API",
Name: "okta-org",
Title: "Okta Organization",
Kind: providers.Kind_KIND_API,
Family: []string{"okta"},
Runtime: pt.Runtime(), // TODO
}, nil
case *slack.Provider:
Expand Down
13 changes: 8 additions & 5 deletions motor/providers/okta/okta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package okta

import (
"context"
"errors"

"github.com/okta/okta-sdk-golang/v2/okta"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"go.mondoo.com/cnquery/motor/providers"
"go.mondoo.com/cnquery/motor/vault"
Expand Down Expand Up @@ -77,8 +77,7 @@ func (t *Provider) Kind() providers.Kind {
}

func (t *Provider) Runtime() string {
// TODO: fix me and add okta
return providers.RUNTIME_AZ
return providers.RUNTIME_OKTA
}

func (t *Provider) PlatformIdDetectors() []providers.PlatformIdDetector {
Expand All @@ -88,8 +87,12 @@ func (t *Provider) PlatformIdDetectors() []providers.PlatformIdDetector {
}

func (t *Provider) Identifier() (string, error) {
// TODO: implement proper
return "", nil
settings, _, err := t.client.OrgSetting.GetOrgSettings(context.Background())
if err != nil {
return "", errors.Wrap(err, "failed to get Okta org ID")
}

return settings.Id, nil
}

func (p *Provider) OrganizationID() string {
Expand Down
1 change: 1 addition & 0 deletions motor/providers/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ const (
RUNTIME_AWS_EC2_EBS = "aws-ec2-ebs"
RUNTIME_GITLAB = "gitlab" // api
RUNTIME_TERRAFORM = "terraform"
RUNTIME_OKTA = "okta"
)

0 comments on commit 8ee5cef

Please sign in to comment.