onelogin

package
v0.1308.0-MLPAB2194con... Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigurationMissing = errors.New("openid configuration missing")
View Source
var ErrMissingCoreIdentityJWT = errors.New("UserInfo missing CoreIdentityJWT property")

Functions

This section is empty.

Types

type Client

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

func New added in v0.890.0

func New(ctx context.Context, logger Logger, httpClient *http.Client, secretsClient SecretsClient, issuer, clientID, redirectURL string, identityPublicKeyFunc IdentityPublicKeyFunc) *Client

func (*Client) AuthCodeURL

func (c *Client) AuthCodeURL(state, nonce, locale string, identity bool) (string, error)

func (*Client) CheckHealth added in v0.892.0

func (c *Client) CheckHealth(ctx context.Context) error

func (*Client) EndSessionURL

func (c *Client) EndSessionURL(idToken, postLogoutURL string) (string, error)

func (*Client) Exchange

func (c *Client) Exchange(ctx context.Context, code, nonce string) (idToken, accessToken string, err error)

func (*Client) ParseIdentityClaim

func (c *Client) ParseIdentityClaim(ctx context.Context, u UserInfo) (identity.UserData, error)

func (*Client) UserInfo

func (c *Client) UserInfo(ctx context.Context, idToken string) (UserInfo, error)

type CoreIdentityClaims

type CoreIdentityClaims struct {
	jwt.RegisteredClaims

	Vot string     `json:"vot"`
	Vtm string     `json:"vtm"`
	Vc  Credential `json:"vc"`
}

type Credential

type Credential struct {
	Type              []string          `json:"type"`
	CredentialSubject CredentialSubject `json:"credentialSubject"`
}

type CredentialBirthDate

type CredentialBirthDate struct {
	Value date.Date `json:"value"`
}

type CredentialName

type CredentialName struct {
	// ValidFrom shows when a name started to be used. If the zero value then the
	// user may have used that name from birth.
	ValidFrom Date `json:"validFrom"`

	// ValidUntil shows when the name ceased to be used. If the zero value then
	// this is the current name.
	ValidUntil Date `json:"validUntil"`

	// NameParts contains the components of the name in any order. The order of
	// names may depend on either your user’s preferences or the order they appear
	// on documents used to prove your user’s identity.
	NameParts []NamePart `json:"nameParts"`
}

type CredentialSubject

type CredentialSubject struct {
	Names []CredentialName `json:"name"`

	// BirthDate may list multiple values if there’s evidence an incorrect date of
	// birth was previously recorded for your user. The date of birth GOV.UK One
	// Login has highest confidence in will be the first item in the list.
	BirthDate []CredentialBirthDate `json:"birthDate"`
}

func (CredentialSubject) CurrentNameParts

func (s CredentialSubject) CurrentNameParts() []NamePart

type Date

type Date time.Time

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(text []byte) error

type Doer

type Doer interface {
	Do(r *http.Request) (*http.Response, error)
}

type IdentityPublicKeyFunc added in v0.876.0

type IdentityPublicKeyFunc func(context.Context) (*ecdsa.PublicKey, error)

type Logger

type Logger interface {
	WarnContext(ctx context.Context, msg string, args ...any)
}

type NamePart

type NamePart struct {
	Value string `json:"value"`

	// Type is either 'GivenName' or 'FamilyName'
	Type string `json:"type"`
}

type ReturnCodeInfo added in v0.1259.0

type ReturnCodeInfo struct {
	Code string `json:"code"`
}

type SecretsClient

type SecretsClient interface {
	SecretBytes(ctx context.Context, name string) ([]byte, error)
}

type UserInfo

type UserInfo struct {
	Sub             string              `json:"sub"`
	Email           string              `json:"email"`
	EmailVerified   bool                `json:"email_verified"`
	Phone           string              `json:"phone"`
	PhoneVerified   bool                `json:"phone_verified"`
	UpdatedAt       int                 `json:"updated_at"`
	CoreIdentityJWT string              `json:"https://vocab.account.gov.uk/v1/coreIdentityJWT"`
	ReturnCodes     []ReturnCodeInfo    `json:"https://vocab.account.gov.uk/v1/returnCode,omitempty"`
	Addresses       []credentialAddress `json:"https://vocab.account.gov.uk/v1/address,omitempty"`
}

Jump to

Keyboard shortcuts

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