auth

package
v0.0.0-...-ce99978 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Username string   `json:"preferred_username,omitempty"`
	Groups   []string `json:"groups,omitempty"`
}

Claims is how claims are structured in our bearer

type Client

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

Client represents our auth client's configuration

func NewClient

func NewClient(clientID string, clientSecret string, issuerURL string, httpClient *http.Client) *Client

NewClient uses to OpenID Connect library to construct a provider which can be invoked within the internal 'authFn'.

func (*Client) AsHandlerFunc

func (c *Client) AsHandlerFunc(trustedHosts string) func(next http.Handler) http.HandlerFunc

AsHandlerFunc exposes the authFn as and http.HandlerFunc. This fn includes special cases where 'trusted hosts' can be verified via their client cert or websockets which are verified separately

func (*Client) AsMiddleWare

func (c *Client) AsMiddleWare(ctx context.Context) (context.Context, error)

AsMiddleWare exposes the authFn for use in a middleware chain

func (*Client) AsWSInitFunc

func (c *Client) AsWSInitFunc() func(context.Context, InitPayload) error

AsWSInitFunc exposes the authFn for use during websocket initialization

type InitPayload

type InitPayload interface {

	// Authorization gets the Authorization header from the init payload
	Authorization() string
}

InitPayload is able to provide the Authorization header from the init payload

Jump to

Keyboard shortcuts

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