auth

package
v0.0.0-...-1e50175 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBearerToken

func GetBearerToken(r *http.Request) (string, bool)

Types

type OidcClient

type OidcClient struct {
	Provider         oidc.Provider
	Verfier          oidc.IDTokenVerifier
	Oauth2Config     oauth2.Config
	ProviderMetadata ProviderMetadata
}

func NewOidcClient

func NewOidcClient(issuerUrl, discoveryEndpoint, clientID, clientSecret string) (*OidcClient, error)

func (*OidcClient) IntrospectToken

func (client *OidcClient) IntrospectToken(token string) (*TokenInfo, error)

type ProviderMetadata

type ProviderMetadata struct {
	Issuer                string   `json:"issuer"`
	AuthURL               string   `json:"authorization_endpoint"`
	TokenURL              string   `json:"token_endpoint"`
	JWKSURL               string   `json:"jwks_uri"`
	UserInfoURL           string   `json:"userinfo_endpoint"`
	IntrospectionEndpoint string   `json:"introspection_endpoint"`
	Algorithms            []string `json:"id_token_signing_alg_values_supported"`
}

type RealmAccess

type RealmAccess struct {
	Roles []string `json:"roles"`
}

type TokenInfo

type TokenInfo struct {
	Active      bool                      `json:"active"`
	ClientID    string                    `json:"client_id"`
	Subject     string                    `json:"sub"`
	Scope       string                    `json:"scope"`
	IssuedTime  int64                     `json:"iat"`
	ExpireTime  int64                     `json:"exp"`
	UserName    string                    `json:"username"`
	RealmAccess RealmAccess               `json:"realm_access"`
	Audience    utils.StringOrStringSlice `json:"aud"`
}

Jump to

Keyboard shortcuts

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