oktalib

package module
v0.0.0-...-1347d1d Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 18 Imported by: 0

README

Oktalib

CircleCI Go Report Card GoDoc GitHub license

Introduction

A library and functions for okta authentication chain against aws

Documentation

Index

Constants

View Source
const (
	// YubiKey the hardware mfa constant
	YubiKey = "token:hardware"
	// MfaPush the push notification constant
	MfaPush = "push"
	// MfaCode the code input constant
	MfaCode = "token:software:totp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertion

type Assertion struct {
	XMLName            xml.Name
	ID                 string `xml:"ID,attr"`
	Version            string `xml:"Version,attr"`
	XS                 string `xml:"xmlns:xs,attr"`
	XSI                string `xml:"xmlns:xsi,attr"`
	SAML               string `xml:"saml,attr"`
	IssueInstant       string `xml:"IssueInstant,attr"`
	Subject            Subject
	Conditions         Conditions
	AttributeStatement AttributeStatement
}

Assertion struct

type Attribute

type Attribute struct {
	XMLName         xml.Name
	Name            string           `xml:",attr"`
	FriendlyName    string           `xml:",attr"`
	NameFormat      string           `xml:",attr"`
	AttributeValues []AttributeValue `xml:"AttributeValue"`
}

Attribute struct

type AttributeStatement

type AttributeStatement struct {
	XMLName    xml.Name
	Attributes []Attribute `xml:"Attribute"`
}

AttributeStatement struct

type AttributeValue

type AttributeValue struct {
	XMLName xml.Name
	Type    string `xml:"xsi:type,attr"`
	Value   string `xml:",innerxml"`
}

AttributeValue struct

type Conditions

type Conditions struct {
	XMLName      xml.Name
	NotBefore    string `xml:",attr"`
	NotOnOrAfter string `xml:",attr"`
}

Conditions struct

type GetAwsCredentialsInput

type GetAwsCredentialsInput struct {
	RoleArn    string // RoleArn The Role ARN to assume. The user needs to have permission to assume the role in okta
	Expiration int64  // Expiration in seconds
}

GetAwsCredentialsInput : The input for the function

type GetAwsCredentialsOutput

type GetAwsCredentialsOutput struct {
	AwsAccessKeyId     string // AwsAccessKeyId
	AwsSecretAccessKey string // AwsSecretAccessKey
	AwsSessionToken    string // AwsSessionToken
}

GetAwsCredentialsOutput : The output for the function

type NameID

type NameID struct {
	XMLName xml.Name
	Format  string `xml:",attr"`
	Value   string `xml:",innerxml"`
}

NameID struct

type NewInput

type NewInput struct {
	Org                 string
	IdentityProviderArn string
	SamlURI             string
}

NewInput returns an OktaClient object, it's for initialization purposes.

type OktaClient

type OktaClient struct {
	Principle      string
	Role           string
	SamlData       *samlresp
	Username       string
	Password       string
	UserAuth       *OktaUserAuthn
	OktaAwsSAMLUrl string
	CookieJar      http.CookieJar
	OktaUrl        string
	AwsSamlUrl     string
}

OktaClient struct for methods

func New

func New(o *NewInput) (OktaClient, error)

New returns Oktaclient with checks

func (*OktaClient) GetAwsCredentials

GetAwsCredentials : Returns the secret,access and session token

func (*OktaClient) GetSamlAssertion

func (o *OktaClient) GetSamlAssertion() error

GetSamlAssertion This is the third step of the authentication chain where we obtain the SAML assertion.

func (*OktaClient) LdapLogin

func (o *OktaClient) LdapLogin() error

LdapLogin takes in user and password and authenticate against okta

func (*OktaClient) OktaMfa

func (o *OktaClient) OktaMfa(FactorType string, PassCode string) error

OktaMfa serve as the mfa part of okta's authentication chain

type OktaUserAuthn

type OktaUserAuthn struct {
	StateToken   string                `json:"stateToken"`
	SessionToken string                `json:"sessionToken"`
	ExpiresAt    string                `json:"expiresAt"`
	Status       string                `json:"status"`
	Embedded     OktaUserAuthnEmbedded `json:"_embedded"`
	FactorResult string                `json:"factorResult"`
	CookieJar    http.CookieJar
}

OktaUserAuthn a struct

type OktaUserAuthnEmbedded

type OktaUserAuthnEmbedded struct {
	Factors []OktaUserAuthnFactor `json:"factors"`
	Factor  OktaUserAuthnFactor   `json:"factor"`
}

OktaUserAuthnEmbedded struct

type OktaUserAuthnFactor

type OktaUserAuthnFactor struct {
	Id         string                      `json:"id"`
	FactorType string                      `json:"factorType"`
	Provider   string                      `json:"provider"`
	Embedded   OktaUserAuthnFactorEmbedded `json:"_embedded"`
}

OktaUserAuthnFactor struct

type OktaUserAuthnFactorEmbedded

type OktaUserAuthnFactorEmbedded struct {
	Verification OktaUserAuthnFactorEmbeddedVerification `json:"verification"`
	Challange    OktaUserAuthnFactorEmbeddedChallenge    `json:"challenge"`
}

OktaUserAuthnFactorEmbedded struct

type OktaUserAuthnFactorEmbeddedChallenge

type OktaUserAuthnFactorEmbeddedChallenge struct {
	CorrectAnswer int `json:"correctAnswer"`
}

OktaUserAuthnFactorEmbeddedChallenge

type OktaUserAuthnFactorEmbeddedVerification

type OktaUserAuthnFactorEmbeddedVerification struct {
	Host         string                                       `json:"host"`
	Signature    string                                       `json:"signature"`
	FactorResult string                                       `json:"factorResult"`
	Links        OktaUserAuthnFactorEmbeddedVerificationLinks `json:"_links"`
}

OktaUserAuthnFactorEmbeddedVerification struct

type OktaUserAuthnFactorEmbeddedVerificationLinks struct {
	Complete OktaUserAuthnFactorEmbeddedVerificationLinksComplete `json:"complete"`
}

OktaUserAuthnFactorEmbeddedVerificationLinks struct

type OktaUserAuthnFactorEmbeddedVerificationLinksComplete

type OktaUserAuthnFactorEmbeddedVerificationLinksComplete struct {
	Href string `json:"href"`
}

OktaUserAuthnFactorEmbeddedVerificationLinksComplete struct

type Response

type Response struct {
	XMLName      xml.Name
	SAMLP        string `xml:"xmlns:samlp,attr"`
	SAML         string `xml:"xmlns:saml,attr"`
	SAMLSIG      string `xml:"xmlns:samlsig,attr"`
	Destination  string `xml:"Destination,attr"`
	ID           string `xml:"ID,attr"`
	Version      string `xml:"Version,attr"`
	IssueInstant string `xml:"IssueInstant,attr"`
	InResponseTo string `xml:"InResponseTo,attr"`

	Assertion Assertion `xml:"Assertion"`
	Status    Status    `xml:"Status"`
	// contains filtered or unexported fields
}

Response struct

type Status

type Status struct {
	XMLName    xml.Name
	StatusCode StatusCode `xml:"StatusCode"`
}

Status struct

type StatusCode

type StatusCode struct {
	XMLName xml.Name
	Value   string `xml:",attr"`
}

StatusCode struct

type Subject

type Subject struct {
	XMLName             xml.Name
	NameID              NameID
	SubjectConfirmation SubjectConfirmation
}

Subject struct

type SubjectConfirmation

type SubjectConfirmation struct {
	XMLName                 xml.Name
	Method                  string `xml:",attr"`
	SubjectConfirmationData SubjectConfirmationData
}

SubjectConfirmation struct

type SubjectConfirmationData

type SubjectConfirmationData struct {
	InResponseTo string `xml:",attr"`
	NotOnOrAfter string `xml:",attr"`
	Recipient    string `xml:",attr"`
}

SubjectConfirmationData struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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