Documentation ¶
Overview ¶
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.
Index ¶
Constants ¶
const ( StatusSuccess = "SUCCESS" StatusMFARequired = "MFA_REQUIRED" )
const ( MFATypePush = "push" MFATypeTOTP = "token:software:totp" VerifyFactorStatusSuccess = "SUCCESS" VerifyFactorStatusWaiting = "WAITING" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client represents an Okta API client.
func (*Client) GetSessionToken ¶
func (c *Client) GetSessionToken(p *GetSessionTokenParams) (*GetSessionTokenResponse, error)
GetSessionToken performs a login operation against the Okta API and returns a session token upon successful login.
Following a successful call (error == nil), the Status field of the response must be checked. If the status is StatusSuccess then the SessionToken field contains a valid session token and the authentication action is complete. If the status is StatusMFARequired, the user needs to provide an MFA one-time password before a session token can be retrieved. In this case, the StateToken field will contain the state token to pass to the MFA verification API endpoint, and the Embedded field will contain information about the available factor(s). The caller will then need to call the VerifyFactor function to complete the authentication and obtain a session token. See the Okta API documentation for more details: https://developer.okta.com/docs/api/resources/authn#verify-totp-factor
func (*Client) LaunchApp ¶
func (c *Client) LaunchApp(p *LaunchAppParams) (*string, error)
LaunchApp launches an Okta app and returns a SAML assertion. TODO Error handling
func (*Client) VerifyFactor ¶
func (c *Client) VerifyFactor(p *VerifyFactorParams) (*VerifyFactorResponse, error)
VerifyFactor performs MFA verification.
type GetSessionTokenParams ¶
type GetSessionTokenParams struct { Username string `json:"username"` Password string `json:"password"` }
GetSessionTokenParams represents the parameters for GetSessionToken.
type GetSessionTokenResponse ¶
type GetSessionTokenResponse struct { ExpiresAt time.Time `json:"expiresAt"` SessionToken string `json:"sessionToken"` StateToken string `json:"stateToken"` Status string `json:"status"` Embedded struct { Factors []struct { ID string `json:"id"` Links struct { Verify struct { Href string `json:"href"` } `json:"verify"` } `json:"_links"` FactorType string `json:"factorType"` } `json:"factors"` } `json:"_embedded"` }
GetSessionTokenResponse represents the result of a call to GetSessionToken.
type LaunchAppParams ¶
LaunchAppParams represents the parameters for LaunchApp.
type VerifyFactorParams ¶
type VerifyFactorParams struct { FactorID string `json:"factorId"` StateToken string `json:"stateToken"` PassCode string `json:"passCode"` }
VerifyFactorParams represents the parameters for VerifyFactor.
type VerifyFactorResponse ¶
type VerifyFactorResponse struct { ExpiresAt time.Time `json:"expiresAt"` SessionToken string `json:"sessionToken"` Status string `json:"status"` FactorResult string `json:"factorResult,omitempty"` Embedded struct { Factor struct { Embedded struct { Challenge struct { CorrectAnswer int `json:"correctAnswer"` } `json:"challenge"` } `json:"_embedded"` } `json:"factor"` } `json:"_embedded"` }
VerifyFactorResponse represents the result of a call to VerifyFactor.