okta

package
v0.0.0-...-601228c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

pkg/okta/applications.go

pkg/okta/devices.go

pkg/okta/entities.go

pkg/okta/groups.go

pkg/okta/okta.go

pkg/okta/roles.go

pkg/okta/user_factors.go

pkg/okta/users.go

Index

Constants

Variables

View Source
var (
	BaseURL = fmt.Sprintf("https://%s.%s.com/api/v1", "%s", "%s") // https://developer.okta.com/docs/api/#versioning
)
View Source
var FactorType = FactorTypes{
	Call:              "call",
	SMS:               "sms",
	Email:             "email",
	Question:          "question",
	Push:              "push",
	Token:             "token",
	TokenHardware:     "token:hardware",
	TokenHOTP:         "token:hotp",
	TokenSoftwareTOTP: "token:software:totp",
	U2F:               "u2f",
	Web:               "web",
	WebAuthn:          "webauthn",
	SignedNonce:       "signed_nonce",
}

Functions

This section is empty.

Types

type Accessibility

type Accessibility struct {
	ErrorRedirectURL  string `json:"errorRedirectUrl,omitempty"`  // The error redirect URL of the application.
	LoginRedirectURL  string `json:"loginRedirectUrl,omitempty"`  // The login redirect URL of the application.
	SelfService       bool   `json:"selfService,omitempty"`       // Indicates whether the application is self-service.
	LoginRedirectURL2 string `json:"loginRedirectUrl2,omitempty"` // The second login redirect URL of the application.
}
type AppLink struct {
	AppAssignmentID  string `json:"appAssignmentId,omitempty"`  // The ID of the app assignment.
	AppInstanceID    string `json:"appInstanceId,omitempty"`    // The ID of the app instance.
	AppName          string `json:"appName,omitempty"`          // The name of the app.
	CredentialsSetup bool   `json:"credentialsSetup,omitempty"` // Indicates whether credentials are set up.
	Hidden           bool   `json:"hidden,omitempty"`           // Indicates whether the app link is hidden.
	ID               string `json:"id,omitempty"`               // The ID of the app link.
	Label            string `json:"label,omitempty"`            // The label of the app link.
	LinkURL          string `json:"linkUrl,omitempty"`          // The URL of the app link.
	LogoURL          string `json:"logoUrl,omitempty"`          // The URL of the logo for the app link.
	SortOrder        int    `json:"sortOrder,omitempty"`        // The sort order of the app link.
}

AppLink represents an app link object.

type AppLinks []*AppLink

type AppQuery

type AppQuery struct {
	Q                 string // Searches the records for matching value
	After             string // The cursor to use for pagination. It is an opaque string that specifies your current location in the list and is obtained from the `Link` response header.
	Limit             string // Default: -1. Specifies the number of results for a page
	Filter            string // Filters apps by `status`, `user.id`, `group.id` or `credentials.signing.kid“ expression
	Expand            string // Traverses users link relationship and optionally embeds Application User resource
	IncludeNonDeleted bool   // Default: false.
}

* Query parameters for Applications

type Application

type Application struct {
	Accessibility Accessibility       `json:"accessibility,omitempty"` // The accessibility of the application.
	Created       time.Time           `json:"created,omitempty"`       // The timestamp when the application was created.
	Features      []string            `json:"features,omitempty"`      // The features of the application.
	ID            string              `json:"id,omitempty"`            // The ID of the application.
	Label         string              `json:"label,omitempty"`         // The label of the application.
	LastUpdated   time.Time           `json:"lastUpdated,omitempty"`   // The timestamp when the application was last updated.
	Licensing     Licensing           `json:"licensing,omitempty"`     // The licensing of the application.
	Profile       ApplicationProfile  `json:"profile,omitempty"`       // The profile of the application.
	SignOnMode    string              `json:"signOnMode,omitempty"`    // The sign-on mode of the application.
	Status        string              `json:"status,omitempty"`        // The status of the application.
	Visibility    Visibility          `json:"visibility,omitempty"`    // The visibility of the application.
	Embedded      ApplicationEmbedded `json:"_embedded,omitempty"`     // The users assigned to the application.
	Links         Links               `json:"_links,omitempty"`        // Links related to the application.
}

type ApplicationEmbedded

type ApplicationEmbedded struct {
	User  *User  `json:"user,omitempty"`
	Users *Users `json:"users,omitempty"`
}

type ApplicationProfile

type ApplicationProfile struct {
	Property1 map[string]interface{} `json:"property1,omitempty"`
	Property2 map[string]interface{} `json:"property2,omitempty"`
}

type Applications

type Applications []*Application

### Okta Application Structs ---------------------------------------------------------------------

type Client

type Client struct {
	BaseURL string           // BaseURL is the base URL for Okta API requests.
	HTTP    *requests.Client // HTTPClient is the client used to make HTTP requests.
	Error   *Error           // Error is the error response from the last request made by the client.
	Log     *log.Logger      // Log is the logger used to log messages.
	Cache   *cache.Cache     // Cache is the cache used to store responses from the Okta API.
}

### Okta Client Entities ---------------------------------------------------------------------

func NewClient

func NewClient(verbosity int) *Client
  • # Generate Okta Client
  • @param logger *log.Logger
  • @return *Client
  • Example:

```go

o := okta.NewClient(log.DEBUG)

```

func (*Client) BuildURL

func (c *Client) BuildURL(endpoint string, identifiers ...string) string

BuildURL builds a URL for a given resource and identifiers.

func (*Client) ConvertApplicationAssignment

func (c *Client) ConvertApplicationAssignment(appID string, userID string) (*User, error)

* # Convert Application Assignment * Retrieves a user assigned to an application and converts the scope to the opposite of its current value * /api/v1/apps/{appid}/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/ApplicationUsers/#tag/ApplicationUsers/operation/assignUserToApplication

func (*Client) DeactivateUser

func (c *Client) DeactivateUser(userID string) error

* # Deactivate a User * /api/v1/users/{userId}/lifecycle/deactivate * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/deactivateUser

func (*Client) Factors

func (c *Client) Factors() *FactorsClient

Entry point for user-related operations

func (*Client) GenerateRoleReport

func (c *Client) GenerateRoleReport() (*RoleReports, error)

* # Generate a report of all Okta roles and their users

func (*Client) GetApplicationUser

func (c *Client) GetApplicationUser(appID string, userID string) (*User, error)

* # Get Application User * Retrieves a single user assigned to an application * /api/v1/apps/{appid}/users/{userid} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/ApplicationUsers/#tag/ApplicationUsers/operation/getApplicationUser

func (*Client) GetCache

func (c *Client) GetCache(key string, target interface{}) bool

* GetCache retrieves an Okta API response from the cache

func (*Client) GetGroup

func (c *Client) GetGroup(groupID string) (*Group, error)

* # Get Group by ID * /api/v1/groups/{groupId} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/getGroup

func (*Client) GetRole

func (c *Client) GetRole(roleID string) (*Role, error)

* # Retrieves a role by `roleIdOrLabel` * /api/v1/iam/roles/{roleIdOrLabel} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Role/#tag/Role/operation/getRole

func (*Client) GetUser

func (c *Client) GetUser(userID string) (*User, error)

* # Get a user by ID * /api/v1/users/{userId} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/getUser

func (c *Client) GetUserAppLinks(userID string) (*AppLinks, error)

* # Get all Assigned Application Links for a User * /api/v1/users/{userId}/appLinks * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/listAppLinks

func (*Client) GetUserApplications

func (c *Client) GetUserApplications(userID string) (*Applications, error)

* Get all applications assigned to a user * /api/v1/apps * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/#tag/Application/operation/listApplications

func (*Client) GetUserGroups

func (c *Client) GetUserGroups(userID string) (*Groups, error)

* # List all Groups for a User * /api/v1/users/{userId}/groups * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/updateUser

func (*Client) GetUserRoles

func (c *Client) GetUserRoles(userID string) (*Roles, error)

* Lists all roles assigned to a user identified by `userId“ * /api/v1/users/{userId}/roles * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/RoleAssignment/#tag/RoleAssignment/operation/listAssignedRolesForUser

func (*Client) ListActiveUsers

func (c *Client) ListActiveUsers() (*Users, error)

* # List all ACTIVE users * /api/v1/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/listUsers

func (*Client) ListAllApplicationUsers

func (c *Client) ListAllApplicationUsers(appID string) (*Users, error)

* # List all Application Users * Retrieves all users assigned to an application * /api/v1/apps/{appid}/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/ApplicationUsers/

func (*Client) ListAllApplications

func (c *Client) ListAllApplications() (*Applications, error)

* # List All Applications * Lists all applications with pagination. A subset of apps can be returned that match a supported filter expression or query. * /api/v1/apps * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Application/#tag/Application/operation/listApplications

func (*Client) ListAllDevices

func (c *Client) ListAllDevices() (*Devices, error)

* # List All Devices * Lists all devices with pagination support. * /api/v1/devices * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Device/#tag/Device/operation/listDevices

func (*Client) ListAllGroupRules

func (c *Client) ListAllGroupRules() (*GroupRules, error)

* # List All Group Rules * /api/v1/groups/rules * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/listGroupRules

func (*Client) ListAllRoles

func (c *Client) ListAllRoles() (*RolesList, error)

* # Lists all roles with pagination support. * - By default, only custom roles can be listed from this endpoint * /api/v1/iam/roles * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Role/#tag/Role/operation/listRoles

func (*Client) ListAllUsers

func (c *Client) ListAllUsers() (*Users, error)

* # Get all users, regardless of status * /api/v1/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/listUsers

func (*Client) ListAllUsersWithRoleAssignments

func (c *Client) ListAllUsersWithRoleAssignments() (*Users, error)

* # Get all Users with Role Assignments * /api/v1/iam/assignees/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/RoleAssignment/#tag/RoleAssignment/operation/listUsersWithRoleAssignments

func (*Client) ListDevices

func (c *Client) ListDevices(q DeviceQuery) (*Devices, error)

* # List Devices (Queried) * Query devices with pagination support. * /api/v1/devices * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Device/#tag/Device/operation/listDevices

func (*Client) ListManagedDevices

func (c *Client) ListManagedDevices() (*Devices, error)

* # List all non-mobile devices with Managed Status * /api/v1/devices * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Device/#tag/Device/operation/listDevices

func (*Client) ListUsersForDevice

func (c *Client) ListUsersForDevice(deviceID string) (*DeviceUsers, error)

* # List all Users for a Device * /api/v1/devices/{deviceId}/users * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Device/#tag/Device/operation/listDevices

func (*Client) RemoveApplicationAssignment

func (c *Client) RemoveApplicationAssignment(appID string, userID string) error

* # Remove Application Assignment * Retrieves a user assigned to an application and removes the assignment * /api/v1/apps/{appid}/users/{userid} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/ApplicationUsers/#tag/ApplicationUsers/operation/unassignUserFromApplication

func (*Client) RemoveUserFromGroup

func (c *Client) RemoveUserFromGroup(groupID string, userID string) error

* # Unassign a User from a Group * /api/v1/groups/{groupId}/users/{userId} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/Group/#tag/Group/operation/unassignUserFromGroup

func (*Client) RevokeUserSessions

func (c *Client) RevokeUserSessions(userID string) error

* # Revoke User Sessions * /api/v1/users/{userId}/sessions * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/revokeUserSessions

func (*Client) SetCache

func (c *Client) SetCache(key string, value interface{}, duration time.Duration)

* SetCache stores an Okta API response in the cache

func (*Client) UpdateUser

func (c *Client) UpdateUser(userID string, u *User) (*User, error)

* # Update a user's properties by ID * /api/v1/users/{userId} * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/updateUser

func (*Client) UseCache

func (c *Client) UseCache() *Client

UseCache() enables caching for the next method call.

type Conditions

type Conditions struct {
	Expression GroupExpression `json:"expression,omitempty"` // Expression for the condition.
	People     PeopleCondition `json:"people,omitempty"`     // People involved in the condition.
}

type Device

type Device struct {
	Created             string          `json:"created,omitempty"`             // The timestamp when the device was created.
	ID                  string          `json:"id,omitempty"`                  // The unique key for the device.
	LastUpdated         string          `json:"lastUpdated,omitempty"`         // The timestamp when the device was last updated.
	Links               *Link           `json:"_links,omitempty"`              // A set of key/value pairs that provide additional information about the device.
	Profile             *DeviceProfile  `json:"profile,omitempty"`             // The device profile.
	ResourceAlternate   interface{}     `json:"resourceAlternateId,omitempty"` // The alternate ID of the device.
	ResourceDisplayName *DisplayName    `json:"resourceDisplayName,omitempty"` // The display name of the device.
	ResourceID          string          `json:"resourceId,omitempty"`          // The ID of the device.
	ResourceType        string          `json:"resourceType,omitempty"`        // The type of the device.
	Status              string          `json:"status,omitempty"`              // The status of the device.
	Embedded            *DeviceEmbedded `json:"_embedded,omitempty"`           // The users assigned to the device.
}

type DeviceEmbedded

type DeviceEmbedded struct {
	DeviceUsers *DeviceUsers `json:"users,omitempty"`
}

type DeviceProfile

type DeviceProfile struct {
	DisplayName           string `json:"displayName,omitempty"`           // The display name of the device.
	Manufacturer          string `json:"manufacturer,omitempty"`          // The manufacturer of the device.
	Model                 string `json:"model,omitempty"`                 // The model of the device.
	OSVersion             string `json:"osVersion,omitempty"`             // The OS version of the device.
	Platform              string `json:"platform,omitempty"`              // The platform of the device.
	Registered            bool   `json:"registered,omitempty"`            // Indicates whether the device is registered with Okta.
	SecureHardwarePresent bool   `json:"secureHardwarePresent,omitempty"` // Indicates whether the device has secure hardware.
	SerialNumber          string `json:"serialNumber,omitempty"`          // The serial number of the device.
	SID                   string `json:"sid,omitempty"`                   // The SID of the device.
	UDID                  string `json:"udid,omitempty"`                  // The UDID of the device.
}

type DeviceQuery

type DeviceQuery struct {
	After  string `url:"after,omitempty"`  // The cursor to use for pagination. It is an opaque string that specifies your current location in the list and is obtained from the `Link` response header.
	Limit  string `url:"limit,omitempty"`  // Default: 200. A limit on the number of objects to return
	Search string `url:"search,omitempty"` // A SCIM filter expression that filters the results. Searches include all Device profile properties and the Device `id“, `status“, and `lastUpdated“ properties.
	Expand string `url:"expand,omitempty"` // Lists associated users for the device in `_embedded` element
}

- Query parameters for Devices

  • Example: Devices that have a `status` of `ACTIVE` search=status eq "ACTIVE"

    Devices last updated after a specific timestamp search=lastUpdated gt "yyyy-MM-dd'T'HH:mm:ss.SSSZ"

    Devices with a specified `id` search=id eq "guo4a5u7JHHhjXrMK0g4"

    Devices that have a `displayName` of `Bob` search=profile.displayName eq "Bob"

    Devices that have an `platform` of `WINDOWS` search=profile.platform eq "WINDOWS"

    Devices whose `sid` starts with `S-1` search=profile.sid sw "S-1"

type DeviceUser

type DeviceUser struct {
	Created          time.Time `json:"created,omitempty"`          // The timestamp when the device user was created.
	ManagementStatus string    `json:"managementStatus,omitempty"` // The management status of the device user.
	User             *User     `json:"user,omitempty"`             // The user assigned to the device.
}

type DeviceUsers

type DeviceUsers []*DeviceUser

type Devices

type Devices []*Device

### Okta Device Structs ---------------------------------------------------------------------

type DisplayName

type DisplayName struct {
	Value     string `json:"value"`     // The display name of the device.
	Sensitive bool   `json:"sensitive"` // Indicates whether the display name is sensitive.
}

type Error

type Error struct {
	ErrorCauses  []ErrorCause `json:"errorCauses,omitempty"`
	ErrorCode    string       `json:"errorCode,omitempty"`
	ErrorId      string       `json:"errorId,omitempty"`
	ErrorLink    string       `json:"errorLink,omitempty"`
	ErrorSummary string       `json:"errorSummary,omitempty"`
}

type ErrorCause

type ErrorCause struct {
	ErrorSummary string `json:"errorSummary,omitempty"`
}

type Factor

type Factor struct {
	ID         string        `json:"id,omitempty"`          // The ID of the factor.
	FactorType string        `json:"factorType,omitempty"`  // The type of factor.
	Provider   string        `json:"provider,omitempty"`    // The provider of the factor.
	Profile    FactorProfile `json:"profile,omitempty"`     // The profile of the factor.
	VendorName string        `json:"vendorName,omitempty"`  // The vendor of the factor.
	Status     string        `json:"status,omitempty"`      // The status of the factor.
	Created    string        `json:"created,omitempty"`     // The time the factor was created.
	Updated    string        `json:"lastUpdated,omitempty"` // The time the factor was updated.
	Embedded   interface{}   `json:"_embedded,omitempty"`   // Embedded properties, to be revisited.
	Links      *Links        `json:"_links,omitempty"`      // Links related to the factor.
}

type FactorProfile

type FactorProfile struct {
	PhoneExtension int    `json:"phoneExtension,omitempty"` // The phone extension of the user.
	PhoneNumber    string `json:"phoneNumber,omitempty"`    // The phone number of the user.
}

type FactorTypes

type FactorTypes struct {
	Call              string `json:"call,omitempty"`                // Software OTP sent using a voice call to a registered phone number
	SMS               string `json:"sms,omitempty"`                 // Software OTP sent using SMS to a registered phone number
	Email             string `json:"email,omitempty"`               // Software OTP sent using email
	Question          string `json:"question,omitempty"`            // Additional knowledge-based security question
	Push              string `json:"push,omitempty"`                // Out-of-band verification using a push notification to a device and transaction verification with digital signature
	Token             string `json:"token,omitempty"`               // Software or hardware OTP sent to a device
	TokenHardware     string `json:"token:hardware,omitempty"`      // Hardware OTP sent to a device
	TokenHOTP         string `json:"token:hotp,omitempty"`          // Custom TOTP factor that uses an extension of the HMAC-based one-time passcode (HOTP) algorithm
	TokenSoftwareTOTP string `json:"token:software:totp,omitempty"` // Software time-based one-time passcode (TOTP)
	U2F               string `json:"u2f,omitempty"`                 // Hardware Universal 2nd Factor (U2F) device
	Web               string `json:"web,omitempty"`                 // HTML inline frame (iframe) for embedding verification from a third party
	WebAuthn          string `json:"webauthn,omitempty"`            // Hardware WebAuthn device
	SignedNonce       string `json:"signed_nonce,omitempty"`        // Okta Fastpass (device-bound authentication). This is available for OIE orgs if the org has users that have enrolled with Okta Verify after the org started using OIE.
}

type Factors

type Factors []*Factor

### Okta Factor Structs ---------------------------------------------------------------------

type FactorsClient

type FactorsClient struct {
	*Client
}

FactorsClient for chaining methods

func (*FactorsClient) EnrollFactor

func (c *FactorsClient) EnrollFactor(userID string, factor Factor) (*Factor, error)

* # Enroll a Factor for a User * /api/v1/users/{userId}/factors * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserFactor/#tag/UserFactor/operation/enrollFactor

func (*FactorsClient) ListAllEnrolledFactors

func (c *FactorsClient) ListAllEnrolledFactors(userID string) (*Factors, error)

* # List all Enrolled Factors for a User * /api/v1/users/{userId}/factors * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserFactor/#tag/UserFactor/operation/listFactors

func (*FactorsClient) ListSupportedFactors

func (c *FactorsClient) ListSupportedFactors(userID string) (*Factors, error)

* # List all supported Factors that can be enrolled for a User * /api/v1/users/{userId}/factors/catalog * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/UserFactor/#tag/UserFactor/operation/listSupportedFactors

func (*FactorsClient) ResetFactors

func (c *FactorsClient) ResetFactors(userID string) error

* # Reset all Factors * /api/v1/users/{userId}/lifecycle/resetFactors * - https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/resetFactors

type Group

type Group struct {
	Created               time.Time     `json:"created,omitempty"`               // The creation time of the user group.
	ID                    string        `json:"id,omitempty"`                    // The ID of the user group.
	LastMembershipUpdated time.Time     `json:"lastMembershipUpdated,omitempty"` // The last time the membership of the user group was updated.
	LastUpdated           time.Time     `json:"lastUpdated,omitempty"`           // The last time the user group was updated.
	ObjectClass           []string      `json:"objectClass,omitempty"`           // Array of object classes.
	Profile               GroupProfile  `json:"profile,omitempty"`               // The profile of the user group.
	Type                  string        `json:"type,omitempty"`                  // The type of the user group.
	Embedded              GroupEmbedded `json:"_embedded,omitempty"`             // Embedded properties, to be revisited.
	Links                 Links         `json:"_links,omitempty"`                // Links related to the user group.
}

Group represents a user group object.

type GroupActions

type GroupActions struct {
	AssignUserToGroups GroupRuleGroupAssignment `json:"assignUserToGroups,omitempty"` // Group assignments for the action.
}

type GroupCondition

type GroupCondition struct {
	Exclude []string `json:"exclude,omitempty"` // Excluded from the condition.
	Include []string `json:"include,omitempty"` // Included in the condition.
}

type GroupEmbedded

type GroupEmbedded interface{}

type GroupExpression

type GroupExpression struct {
	Type  string `json:"type,omitempty"`  // Type of the expression.
	Value string `json:"value,omitempty"` // Value of the expression.
}

type GroupParameters

type GroupParameters struct {
	Q         string `json:"q,omitempty"`         // Searches the name property of groups for matching value.
	After     string `json:"after,omitempty"`     // Specifies the pagination cursor for the next page of groups.
	Expand    string `json:"expand,omitempty"`    // If specified, it causes additional metadata to be included in the response.
	Filter    string `json:"filter,omitempty"`    // Filter expression for groups.
	Limit     int32  `json:"limit,omitempty"`     // Default: (10000 for `Groups`) and (50 for Group Rules) . Specifies the number of group results in a page.
	Search    string `json:"search,omitempty"`    // Searches for groups with a supported filtering expression for all attributes except for _embedded, _links, and objectClass.
	SortBy    string `json:"sortBy,omitempty"`    // Specifies field to sort by and can be any single property (for search queries only).
	SortOrder string `json:"sortOrder,omitempty"` // Specifies sort order asc or desc (for search queries only). This parameter is ignored if sortBy is not present. Groups with the same value for the sortBy parameter are ordered by id.
}

* Query Parameters for Groups

type GroupProfile

type GroupProfile struct {
	Description string `json:"description,omitempty"` // The description of the user group.
	Name        string `json:"name,omitempty"`        // The name of the user group.
}

type GroupRule

type GroupRule struct {
	Actions     GroupActions `json:"actions,omitempty"`     // Defines the actions to be taken when the rule is triggered.
	Conditions  Conditions   `json:"conditions,omitempty"`  // Defines the conditions that would trigger the rule.
	Created     string       `json:"created,omitempty"`     // Date and time when the rule was created.
	ID          string       `json:"id,omitempty"`          // ID of the rule.
	LastUpdated string       `json:"lastUpdated,omitempty"` // Date and time when the rule was last updated.
	Name        string       `json:"name,omitempty"`        // Name of the rule.
	Status      string       `json:"status,omitempty"`      // Status of the rule.
	Type        string       `json:"type,omitempty"`        // Type of the rule.
}

type GroupRuleGroupAssignment

type GroupRuleGroupAssignment struct {
	GroupIDs []string `json:"groupIds,omitempty"` // IDs of the groups involved in the assignment.
}

type GroupRules

type GroupRules []*GroupRule

type Groups

type Groups []*Group

### Okta Group Structs ---------------------------------------------------------------------

type Hints

type Hints struct {
	Allow []string `json:"allow,omitempty"` // Allow is a list of allowed methods.
}

type Licensing

type Licensing struct {
	SeatCount int `json:"seatCount,omitempty"` // The seat count of the application.
}
type Link struct {
	Hints  Hints  `json:"hints,omitempty"`  // Hints is a list of hints for the link.
	Href   string `json:"href,omitempty"`   // Href is the URL for the link.
	Method string `json:"method,omitempty"` // Method is the HTTP method for the link.
	Type   string `json:"type,omitempty"`   // Type is the type of link.
}
type Links struct {
	AccessPolicy           Link   `json:"accessPolicy,omitempty"`           // AccessPolicy is a link to the access policy.
	Activate               Link   `json:"activate,omitempty"`               // Activate is a link to activate the user.
	ChangePassword         Link   `json:"changePassword,omitempty"`         // ChangePassword is a link to change the user's password.
	ChangeRecoveryQuestion Link   `json:"changeRecoveryQuestion,omitempty"` // ChangeRecoveryQuestion is a link to change the user's recovery question.
	Deactivate             Link   `json:"deactivate,omitempty"`             // Deactivate is a link to deactivate the user.
	ExpirePassword         Link   `json:"expirePassword,omitempty"`         // ExpirePassword is a link to expire the user's password.
	ForgotPassword         Link   `json:"forgotPassword,omitempty"`         // ForgotPassword is a link to reset the user's password.
	Groups                 Link   `json:"groups,omitempty"`                 // Groups is a link to the user's groups.
	Metadata               Link   `json:"metadata,omitempty"`               // Metadata is a link to the user's metadata.
	ResetFactors           Link   `json:"resetFactors,omitempty"`           // ResetFactors is a link to reset the user's factors.
	ResetPassword          Link   `json:"resetPassword,omitempty"`          // ResetPassword is a link to reset the user's password.
	Schema                 Link   `json:"schema,omitempty"`                 // Schema is a link to the user's schema.
	Self                   Link   `json:"self,omitempty"`                   // Self is a link to the user.
	Suspend                Link   `json:"suspend,omitempty"`                // Suspend is a link to suspend the user.
	Users                  Link   `json:"users,omitempty"`                  // Users is a link to the user's users.
}

type OktaPage

type OktaPage struct {
	Self          string   `json:"self"`
	NextPageLink  string   `json:"next"`
	NextPageToken string   `json:"next_page_token"`
	Paged         bool     `json:"paged"`
	Links         []string `json:"links"`
}

* OktaPage * @param Self string * @param NextPage string * @param Paged bool

func (*OktaPage) HasNextPage

func (p *OktaPage) HasNextPage(links []string) bool

func (*OktaPage) NextPage

func (p *OktaPage) NextPage(links []string) string

type PagedSlice

type PagedSlice[T Slice[E], E any] struct {
	Results *T
	*OktaPage
}

PagedSlice represents a page of slice results from the Okta API. It's a generic type that can handle any kind of slice (`T`) of elements (`E`).

type PagedStruct

type PagedStruct[T any] struct {
	Results *T
	*OktaPage
}

PagedStruct represents a page of struct results from the Okta API.

type PasswordCredentials

type PasswordCredentials struct {
	Hook  *PasswordHook `json:"hook,omitempty"`  // The password hook.
	Value string        `json:"value,omitempty"` // The password value.
	Hash  *PasswordHash `json:"hash,omitempty"`  // The password hash.
}

type PasswordHash

type PasswordHash struct {
	Algorithm       string `json:"algorithm,omitempty"`       // The algorithm used to hash the password.
	DigestAlgorithm string `json:"digestAlgorithm,omitempty"` // The digest algorithm used to hash the password.
	IterationCount  int    `json:"iterationCount,omitempty"`  // The iteration count used to hash the password.
	KeySize         int    `json:"keySize,omitempty"`         // The key size used to hash the password.
	Salt            string `json:"salt,omitempty"`            // The salt used to hash the password.
	SaltOrder       string `json:"saltOrder,omitempty"`       // The salt order used to hash the password.
	Value           string `json:"value,omitempty"`           // The password hash value.
	WorkFactor      int    `json:"workFactor,omitempty"`      // The work factor used to hash the password.
}

type PasswordHook

type PasswordHook struct {
	Type string `json:"type,omitempty"` // The type of the password hook.
}

type PeopleCondition

type PeopleCondition struct {
	Groups GroupCondition `json:"groups,omitempty"` // Groups involved in the people condition.
	Users  GroupCondition `json:"users,omitempty"`  // Users involved in the people condition.
}

type Permission

type Permission struct {
	Created     time.Time `json:"created,omitempty"`     // The timestamp when the permission was created.
	Label       string    `json:"label,omitempty"`       // The label of the permission.
	LastUpdated time.Time `json:"lastUpdated,omitempty"` // The timestamp when the permission was last updated.
	Links       *Links    `json:"_links,omitempty"`      // Links related to the permission.
}

type Provider

type Provider struct {
	Name string `json:"name,omitempty"` // The name of the provider.
	Type string `json:"type,omitempty"` // The type of the provider. Enum: "ACTIVE_DIRECTORY" "FEDERATION" "IMPORT" "LDAP" "OKTA" "SOCIAL"
}

type RecoveryQuestion

type RecoveryQuestion struct {
	Answer   string `json:"answer,omitempty"`   // The answer to the user's recovery question.
	Question string `json:"question,omitempty"` // The user's recovery question.
}

type Role

type Role struct {
	AssignmentType string    `json:"assignmentType,omitempty"` // The assignment type of the role.
	Created        time.Time `json:"created,omitempty"`        // The timestamp when the role was created.
	Description    string    `json:"description,omitempty"`    // The description of the role.
	ID             string    `json:"id,omitempty"`             // The ID of the role.
	Label          string    `json:"label,omitempty"`          // The label of the role.
	LastUpdated    time.Time `json:"lastUpdated,omitempty"`    // The timestamp when the role was last updated.
	Links          *Links    `json:"_links,omitempty"`         // Links related to the role.
	Status         string    `json:"status,omitempty"`         // The status of the role.
	Type           string    `json:"type,omitempty"`           // The type of the role.
}

type RoleReport

type RoleReport struct {
	Role  *Role  // The role.
	Users *Users // The users assigned to the role.
}

type RoleReports

type RoleReports []*RoleReport

type Roles

type Roles []*Role

type RolesList

type RolesList struct {
	Roles *Roles `json:"roles,omitempty"`
}

### Okta Roles Structs ---------------------------------------------------------------------

func (RolesList) Append

func (r RolesList) Append(result interface{})

func (RolesList) Init

func (r RolesList) Init() *RolesList

type Slice

type Slice[T any] interface {
	~[]T
}

Slice is an interface that ensures T is a slice type.

type Struct

type Struct[T any] interface {
	Init() *T
	Append(interface{})
}

Struct is an interface that ensures T is a struct type.

type User

type User struct {
	Activated             time.Time        `json:"activated,omitempty"`             // The timestamp when the user was activated.
	Created               time.Time        `json:"created,omitempty"`               // The timestamp when the user was created.
	Credentials           *UserCredentials `json:"credentials,omitempty"`           // The user's credentials.
	ID                    string           `json:"id,omitempty"`                    // The ID of the user.
	LastLogin             time.Time        `json:"lastLogin,omitempty"`             // The timestamp when the user last logged in.
	LastUpdated           time.Time        `json:"lastUpdated,omitempty"`           // The timestamp when the user was last updated.
	PasswordChanged       time.Time        `json:"passwordChanged,omitempty"`       // The timestamp when the user's password was last changed.
	Profile               *UserProfile     `json:"profile,omitempty"`               // The user's profile.
	Scope                 string           `json:"scope,omitempty"`                 // The user's assignment to an application [Individually,group assigned] {"USER","GROUP"}
	Status                string           `json:"status,omitempty"`                // The status of the user.
	StatusChanged         time.Time        `json:"statusChanged,omitempty"`         // The timestamp when the user's status was last changed.
	TransitioningToStatus string           `json:"transitioningToStatus,omitempty"` // The status that the user is transitioning to.
	Type                  *UserType        `json:"type,omitempty"`                  // The type of the user.
	Embedded              *UserEmbedded    `json:"_embedded,omitempty"`             // Embedded properties, to be revisited.
	Links                 *Links           `json:"_links,omitempty"`                // Links related to the user.
}

type UserCredentials

type UserCredentials struct {
	Password         *PasswordCredentials `json:"password,omitempty"`          // The user's password credentials.
	Provider         *Provider            `json:"provider,omitempty"`          // The user's provider credentials.
	RecoveryQuestion *RecoveryQuestion    `json:"recovery_question,omitempty"` // The user's recovery question credentials.
}

type UserEmbedded

type UserEmbedded interface{}

type UserFactorQuery

type UserFactorQuery struct {
	Activate                 bool   `url:"activate,omitempty"`                // If true, the `sms“ Factor is immediately activated as part of the enrollment. An activation text message isn't sent to the device.
	RemoveRecoveryEnrollment bool   `url:"removeRevokedEnrollment,omitempty"` // If true, revoked factors are removed from the user's factors list.
	TemplateID               string `url:"templateId,omitempty"`              // ID of an existing custom SMS template. Only applicable for SMS factors.
	TokenLifetime            int    `url:"tokenLifetime,omitempty"`           // Default: 300. The number of seconds before the token expires. Defaults to 3600 (1 hour).
	UpdatePhone              bool   `url:"updatePhone,omitempty"`             // If true, indicates you are replacing the currently registered phone number for the specified user. This parameter is ignored if the existing phone number is used by an activated Factor.
}

* Query Parameters for User Factors

type UserProfile

type UserProfile struct {
	UserProfileBase
	CustomAttributes map[string]interface{} `json:"-"` // Custom attributes
}

func (*UserProfile) UnmarshalJSON

func (u *UserProfile) UnmarshalJSON(data []byte) error

Custom unmarshaller for UserProfile

type UserProfileBase

type UserProfileBase struct {
	Aliases           []string `json:"emailAliases,omitempty"`      // Custom Property: The email aliases of the user.
	City              string   `json:"city,omitempty"`              // The city of the user's address. Maximum length is 128 characters.
	CostCenter        string   `json:"costCenter,omitempty"`        // The cost center of the user.
	CountryCode       string   `json:"countryCode,omitempty"`       // The country code of the user's address. [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) specification. Limit: <= 2 characters.
	Department        string   `json:"department,omitempty"`        // The department of the user.
	DisplayName       string   `json:"displayName,omitempty"`       // The display name of the user.
	Division          string   `json:"division,omitempty"`          // The division of the user.
	Email             string   `json:"email,omitempty"`             // The primary email address of the user, used as the login name and is always required for `create` requests. Must be unique. Limit: [5 - 100] characters.
	EmployeeNumber    string   `json:"employeeNumber,omitempty"`    // The employee number of the user.
	FirstName         string   `json:"firstName,omitempty"`         // The first name of the user. Limit: [1 .. 50] characters.
	HonorificPrefix   string   `json:"honorificPrefix,omitempty"`   // The honorific prefix of the user's name.
	HonorificSuffix   string   `json:"honorificSuffix,omitempty"`   // The honorific suffix of the user's name.
	LastName          string   `json:"lastName,omitempty"`          // The last name of the user. Limit: [1 .. 50] characters.
	Locale            string   `json:"locale,omitempty"`            // The locale of the user. Specified according to [IETF BCP 47 language tag](https://datatracker.ietf.org/doc/html/rfc5646). Example: `en-US`.
	Login             string   `json:"login,omitempty"`             // The login name of the user.
	Manager           string   `json:"manager,omitempty"`           // The manager of the user.
	ManagerID         string   `json:"managerId,omitempty"`         // The ID of the user's manager.
	MiddleName        string   `json:"middleName,omitempty"`        // The middle name of the user.
	MobilePhone       string   `json:"mobilePhone,omitempty"`       // The mobile phone number of the user. Maximum length is 100 characters.
	NickName          string   `json:"nickName,omitempty"`          // The nickname of the user.
	Organization      string   `json:"organization,omitempty"`      // The organization of the user.
	PostalAddress     string   `json:"postalAddress,omitempty"`     // The postal address of the user. Limit: <= 4096 characters.
	PreferredLanguage string   `json:"preferredLanguage,omitempty"` // The preferred language of the user.
	PrimaryPhone      string   `json:"primaryPhone,omitempty"`      // The primary phone number of the user.
	ProfileUrl        string   `json:"profileUrl,omitempty"`        // The profile URL of the user.
	SecondEmail       string   `json:"secondEmail,omitempty"`       // The secondary email address of the user. Limit: [5 - 100] characters.
	State             string   `json:"state,omitempty"`             // The state of the user's address. Limit: <= 128 characters.
	StreetAddress     string   `json:"streetAddress,omitempty"`     // The street address of the user. Limit: <= 1024 characters.
	Timezone          string   `json:"timezone,omitempty"`          // The time zone of the user.
	Title             string   `json:"title,omitempty"`             // The title of the user.
	UserType          string   `json:"userType,omitempty"`          // The type of the user.
	ZipCode           string   `json:"zipCode,omitempty"`           // The zip code of the user's address. Limit: <= 12 characters.
}

type UserQuery

type UserQuery struct {
	Q         string // Searches the records for matching value
	After     string // The cursor to use for pagination. It is an opaque string that specifies your current location in the list and is obtained from the `Link` response header.
	Limit     string // Default: 200. Specifies the number of results returned. Defaults to 10 if `q` is provided
	Filter    string // Filters users with a supported expression for a subset of properties
	Search    string // A SCIM filter expression for most properties. Okta recommends using this parameter for search for best performance
	SortBy    string // Specifies the attribute by which to sort the results. Valid values are `id`, `created`, `activated`, `status`, and `lastUpdated`. The default is `id`
	SoftOrder string // Sorting is done in ASCII sort order (that is, by ASCII character value), but isn't case sensitive
}

* Query Parameters for Users

type UserType

type UserType struct {
	Created       time.Time `json:"created,omitempty"`       // The timestamp when the user type was created.
	CreatedBy     string    `json:"createdBy,omitempty"`     // The ID of the user who created the user type.
	Default       bool      `json:"default,omitempty"`       // Indicates whether the user type is the default.
	Description   string    `json:"description,omitempty"`   // The description of the user type.
	DisplayName   string    `json:"displayName,omitempty"`   // The display name of the user type.
	ID            string    `json:"id,omitempty"`            // The ID of the user type.
	LastUpdated   time.Time `json:"lastUpdated,omitempty"`   // The timestamp when the user type was last updated.
	LastUpdatedBy string    `json:"lastUpdatedBy,omitempty"` // The ID of the user who last updated the user type.
	Name          string    `json:"name,omitempty"`          // The name of the user type.
	Links         *Links    `json:"_links,omitempty"`        // Links related to the user type.
}

type Users

type Users []*User

### Okta Users Structs ---------------------------------------------------------------------

func (*Users) Map

func (u *Users) Map() map[string]*User

type Visibility

type Visibility struct {
	AppLinks          map[string]bool `json:"appLinks,omitempty"`
	AutoLaunch        bool            `json:"autoLaunch,omitempty"`
	AutoSubmitToolbar bool            `json:"autoSubmitToolbar,omitempty"`
	Hide              map[string]bool `json:"hide,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL