okta

package
v0.0.0-...-416c7cc Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

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

View Source
const (
	StatusSuccess     = "SUCCESS"
	StatusMFARequired = "MFA_REQUIRED"
)
View Source
const (
	MFATypePush = "push"
	MFATypeTOTP = "token:software:totp"

	VerifyFactorStatusSuccess = "SUCCESS"
	VerifyFactorStatusWaiting = "WAITING"
)

Variables

This section is empty.

Functions

func Get

func Get(app, provider, pArn, awsRegion string, duration int32) (*aws.Credentials, error)

Get gets temporary credentials for the given app.

Types

type Client

type Client struct {
	http.Client
	BaseURL string
}

Client represents an Okta API client.

func NewClient

func NewClient(url string) (*Client, error)

NewClient creates a new Client and returns a pointer to it.

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

type LaunchAppParams struct {
	SessionToken string
	URL          string
}

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.

Jump to

Keyboard shortcuts

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