okta

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSAMLResponse = errors.New("okta: SAMLResponse form input not found")
	ErrNoAWSRoles     = errors.New("okta: no AWS roles in SAML assertion")
	ErrInvalidAWSRole = errors.New("okta: specified role is not available")
)

Possible errors returned when parsing AWS SAML assertion.

View Source
var ErrRateLimit = errors.New("okta: request rate limit exceeded")

ErrRateLimit is returned when too many requests are sent.

Functions

This section is empty.

Types

type AWSAuth

type AWSAuth struct {
	Assertion samlAssertion
	Roles     []awsRole
}

AWSAuth contains authentication data for AWS.

type AppLink struct {
	ID               string
	Label            string
	LinkURL          string
	LogoURL          string
	AppName          string
	AppInstanceID    string
	AppAssignmentID  string
	CredentialsSetup bool
	Hidden           bool
	SortOrder        int
}

AppLink is an app that the user can access.

type Authenticator

type Authenticator interface {
	Username() (string, error)
	Password() (string, error)
	Select(c []Choice) (Choice, error)
	Input(c Choice) (string, error)
	Notify(format string, a ...interface{})
}

Authenticator implements the user interface for multi-factor authentication.

type Choice

type Choice interface {
	Key() string
	Value() string
	Prompt() string
}

Choice is a user-selectable item.

type Client

type Client struct {
	BaseURL url.URL
	Client  *http.Client
	Sess    Session
}

Client provides access to Okta API.

func NewClient

func NewClient(host string) *Client

NewClient returns a new Okta API client for the specified subdomain (e.g. your-org.okta.com or dev-12345.oktapreview.com).

func (c *Client) AppLinks() ([]*AppLink, error)

AppLinks returns links for all applications assigned to the current user.

func (*Client) Authenticate

func (c *Client) Authenticate(authn Authenticator) error

Authenticate performs user authentication and creates a new session.

func (*Client) CloseSession

func (c *Client) CloseSession() error

CloseSession destroys the current session.

func (*Client) OpenAWS

func (c *Client) OpenAWS(appLink string, role arn.ARN) (*AWSAuth, error)

OpenAWS returns SAML authentication data for the AWS app specified by appLink. If roleARN is specified, the matching AWS role is pre-selected.

func (*Client) RefreshSession

func (c *Client) RefreshSession() error

RefreshSession extends the expiration time of the current session.

func (*Client) ValidSession

func (c *Client) ValidSession() bool

ValidSession returns true if the client has a valid Okta session ID.

type Error

type Error struct {
	Code    string   `json:"errorCode"`
	Summary string   `json:"errorSummary"`
	Link    string   `json:"errorLink"`
	ReqID   string   `json:"errorId"`
	Causes  []*Error `json:"errorCauses"`
}

Error is an error report from Okta.

func (*Error) Error

func (e *Error) Error() string

Error implements error interface.

type Factor

type Factor struct {
	ID         string                 `json:"id"`
	FactorType string                 `json:"factorType"`
	Provider   string                 `json:"provider"`
	VendorName string                 `json:"vendorName"`
	Profile    profile                `json:"profile"`
	Links      struct{ Verify *link } `json:"_links"`
	// contains filtered or unexported fields
}

Factor is a factor object returned by MFA_ENROLL, MFA_REQUIRED, or MFA_CHALLENGE authentication responses.

func (*Factor) Key

func (f *Factor) Key() string

Key implements Choice.Key method.

func (*Factor) Prompt

func (f *Factor) Prompt() string

Prompt implements Choice.Prompt method.

func (*Factor) Value

func (f *Factor) Value() string

Value implements Choice.Value method.

type Session

type Session struct {
	ID        string
	Login     string
	UserID    string
	CreatedAt time.Time
	ExpiresAt time.Time
	Status    string
}

Session contains Okta session information.

Jump to

Keyboard shortcuts

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