oidc

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTokenExpired = errors.New("access token has expired")

ErrTokenExpired indicates that the access token has expired and cannot be refreshed

Functions

func RetrieveAuthEndpoints

func RetrieveAuthEndpoints(openIDConfig *openIDConfiguration, mtlsEnabled bool) (string, string)

Types

type Client

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

Client is used to make http requests including bearer token automatically and refreshing it if necessary

func NewClient

func NewClient(options *auth.Options, token *auth.Token) (*Client, error)

NewClient builds configured HTTP client.

If token is provided will try to refresh the token if it has expired, otherwise if token is not provided will do client_credentials flow and fetch token

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do makes a http request with the underlying HTTP client which includes an access token in the request

func (*Client) Token

func (c *Client) Token() (*auth.Token, error)

Token returns the token, refreshing it if necessary

type DoRequestFunc

type DoRequestFunc func(request *http.Request) (*http.Response, error)

DoRequestFunc is an alias for any function that takes an http request and returns a response and error

type MTLSEndpointAliases

type MTLSEndpointAliases struct {
	TokenEndpoint         string `json:"token_endpoint"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
}

type OpenIDStrategy

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

OpenIDStrategy implementation of OpenID strategy

func NewOpenIDStrategy

func NewOpenIDStrategy(options *auth.Options) (*OpenIDStrategy, *auth.Options, error)

NewOpenIDStrategy returns OpenId auth strategy

func (*OpenIDStrategy) ClientCredentials

func (s *OpenIDStrategy) ClientCredentials() (*auth.Token, error)

ClientCredentials is used to perform client credentials grant type flow

func (*OpenIDStrategy) PasswordCredentials

func (s *OpenIDStrategy) PasswordCredentials(user, password string) (*auth.Token, error)

PasswordCredentials is used to perform password grant type flow

Jump to

Keyboard shortcuts

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