Documentation
¶
Index ¶
- type AppLinks
- type AuthnRequest
- type AuthnResponse
- type Client
- func (c *Client) AppLinks(userID string, appName string) (*AppLinks, error)
- func (c *Client) Authenticate(username, password string) (*AuthnResponse, error)
- func (c *Client) Groups(userID string) (*Groups, error)
- func (c *Client) Session(sessionToken string) (*SessionResponse, error)
- func (c *Client) User(userID string) (*User, error)
- type ErrorResponse
- type Factor
- type Groups
- type SessionRequest
- type SessionResponse
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppLinks ¶
type AppLinks []struct { AppAssignmentID string `json:"appAssignmentId"` AppInstanceID string `json:"appInstanceId"` AppName string `json:"appName"` CredentialsSetup bool `json:"credentialsSetup"` Hidden bool `json:"hidden"` ID string `json:"id"` Label string `json:"label"` LinkURL string `json:"linkUrl"` LogoURL string `json:"logoUrl"` SortOrder int64 `json:"sortOrder"` }
type AuthnRequest ¶
type AuthnRequest struct { Username string `json:"username"` Password string `json:"password"` RelayState string `json:"relayState"` Options struct { MultiOptionalFactorEnroll bool `json:"multiOptionalFactorEnroll"` WarnBeforePasswordExpired bool `json:"warnBeforePasswordExpired"` } `json:"options"` }
type AuthnResponse ¶
type AuthnResponse struct { StateToken string `json:"stateToken"` ExpiresAt time.Time `json:"expiresAt"` Status string `json:"status"` RelayState string `json:"relayState"` FactorResult string `json:"factorResult"` SessionToken string `json:"sessionToken"` Embedded struct { User struct { ID string `json:"id"` PasswordChanged time.Time `json:"passwordChanged"` Profile struct { Login string `json:"login"` FirstName string `json:"firstName"` LastName string `json:"lastName"` Locale string `json:"locale"` TimeZone string `json:"timeZone"` } `json:"profile"` } `json:"user"` Factors []Factor `json:"factors"` Policy struct { AllowRememberDevice bool `json:"allowRememberDevice"` RememberDeviceLifetimeInMinutes int `json:"rememberDeviceLifetimeInMinutes"` RememberDeviceByDefault bool `json:"rememberDeviceByDefault"` } `json:"policy"` } `json:"_embedded"` Links struct { Cancel struct { Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } `json:"cancel"` Next struct { Name string `json:"name"` Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } } `json:"_links"` }
func (*AuthnResponse) GetSupportedFactors ¶
func (r *AuthnResponse) GetSupportedFactors() []Factor
type Client ¶
type Client struct { Url string ApiToken string SessionCookie *http.Cookie // contains filtered or unexported fields }
Client to access okta
func (*Client) Authenticate ¶
func (c *Client) Authenticate(username, password string) (*AuthnResponse, error)
Authenticate with okta using username and password
type ErrorResponse ¶
type Factor ¶
type Factor struct { ID string `json:"id"` FactorType string `json:"factorType"` Provider string `json:"provider"` VendorName string `json:"vendorName"` Profile struct { CredentialID string `json:"credentialId"` } `json:"profile"` Links struct { Verify struct { Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } `json:"verify"` } `json:"_links"` }
func (Factor) VerifyOTP ¶
func (f Factor) VerifyOTP(stateToken string, code string) (*AuthnResponse, error)
https://developer.okta.com/docs/api/resources/factors#verify-totp-factor https://developer.okta.com/docs/api/resources/factors#verify-token-factor
func (Factor) VerifyPush ¶
func (f Factor) VerifyPush( stateToken string, userAgent string, pollInterval time.Duration, pollTimeout time.Duration) (*AuthnResponse, error)
https://developer.okta.com/docs/api/resources/factors#verify-push-factor API diverges quite a bit from the API reference, this is the result of trial and error.
type SessionRequest ¶
type SessionRequest struct {
SessionToken string `json:"sessionToken"`
}
type SessionResponse ¶
type SessionResponse struct { ID string `json:"id"` Login string `json:"login"` UserID string `json:"userId"` ExpiresAt time.Time `json:"expiresAt"` Status string `json:"status"` LastPasswordVerification time.Time `json:"lastPasswordVerification"` LastFactorVerification interface{} `json:"lastFactorVerification"` Amr []string `json:"amr"` Idp struct { ID string `json:"id"` Type string `json:"type"` } `json:"idp"` MfaActive bool `json:"mfaActive"` Links struct { Self struct { Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } `json:"self"` Refresh struct { Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } `json:"refresh"` User struct { Name string `json:"name"` Href string `json:"href"` Hints struct { Allow []string `json:"allow"` } `json:"hints"` } `json:"user"` } `json:"_links"` }
type User ¶
type User struct { ID string `json:"id"` Status string `json:"status"` Created *time.Time `json:"created"` Activated *time.Time `json:"activated"` StatusChanged *time.Time `json:"statusChanged"` LastLogin *time.Time `json:"lastLogin"` LastUpdated *time.Time `json:"lastUpdated"` PasswordChanged *time.Time `json:"passwordChanged"` Profile struct { Login string `json:"login"` FirstName string `json:"firstName"` LastName string `json:"lastName"` NickName string `json:"nickName"` DisplayName string `json:"displayName"` Email string `json:"email"` SecondEmail string `json:"secondEmail"` ProfileURL string `json:"profileUrl"` PreferredLanguage string `json:"preferredLanguage"` UserType string `json:"userType"` Organization string `json:"organization"` Title string `json:"title"` Division string `json:"division"` Department string `json:"department"` CostCenter string `json:"costCenter"` EmployeeNumber string `json:"employeeNumber"` MobilePhone string `json:"mobilePhone"` PrimaryPhone string `json:"primaryPhone"` StreetAddress string `json:"streetAddress"` City string `json:"city"` State string `json:"state"` ZipCode string `json:"zipCode"` CountryCode string `json:"countryCode"` } `json:"profile"` Credentials struct { Password struct { } `json:"password"` RecoveryQuestion struct { Question string `json:"question"` } `json:"recovery_question"` Provider struct { Type string `json:"type"` Name string `json:"name"` } `json:"provider"` } `json:"credentials"` Links struct { ResetPassword struct { Href string `json:"href"` } `json:"resetPassword"` ResetFactors struct { Href string `json:"href"` } `json:"resetFactors"` ExpirePassword struct { Href string `json:"href"` } `json:"expirePassword"` ForgotPassword struct { Href string `json:"href"` } `json:"forgotPassword"` ChangeRecoveryQuestion struct { Href string `json:"href"` } `json:"changeRecoveryQuestion"` Deactivate struct { Href string `json:"href"` } `json:"deactivate"` ChangePassword struct { Href string `json:"href"` } `json:"changePassword"` } `json:"_links"` }
Click to show internal directories.
Click to hide internal directories.