okta

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name   string   `xml:"Name,attr"`
	Values []string `xml:"AttributeValue"`
}

Attribute contains SAML attributes.

type Auth

type Auth struct {
	StateToken   string `json:"stateToken"`
	Status       string `json:"status"`
	SessionToken string `json:"sessionToken"`
	Embedded     struct {
		Factors []*Factor `json:"factors"`
	} `json:"_embedded"`
}

Auth represents the authentication response from Okta.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client contains the necessary information needed to communicate with the Okta API.

func NewClient

func NewClient(host, sessionCookie string) (*Client, error)

NewClient returns a newly configured Client with the given host and possible Okta session cookie. If the session cookie is empty, there was no session previously saved.

func (*Client) Get

func (c *Client) Get(path string) (reader io.Reader, err error)

Get makes an HTTP GET request and returns the response as a string.

func (*Client) Post

func (c *Client) Post(path string, payload []byte) (reader io.Reader, err error)

Post makes an HTTP POST request and returns the response as a string.

type Factor

type Factor struct {
	FactorType string `json:"factorType"`
	Profile    struct {
		CredentialID string `json:"credentialId"`
		PhoneNumber  string `json:"phoneNumber"`
	} `json:"profile"`
	Links struct {
		Verify struct {
			Href string `json:"href"`
		} `json:"verify"`
	} `json:"_links"`
}

Factor contains information about a specific MFA factor.

type SAMLResponse

type SAMLResponse struct {
	XMLName    xml.Name    `xml:"Response"`
	Attributes []Attribute `xml:"Assertion>AttributeStatement>Attribute"`
	Raw        string
}

SAMLResponse contains the parsed SAML assertion, along with the raw base64 encoded response.

func Login

func Login(conf *config.Config, p input.Prompter, sessionCookie, password string) (*SAMLResponse, string, error)

Login to Okta with the given username and password.

Jump to

Keyboard shortcuts

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