oauth

package
v0.0.0-...-6d13c91 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XExternalHost = "X-External-Host"

	GrantTypeFieldName   = "grant_type"
	CredentialsGrantType = "client_credentials"
	PasswordGrantType    = "password"
	ScopesFieldName      = "scopes"

	ClientIDKey     = "client_id"
	ClientSecretKey = "client_secret"
	UserNameKey     = "username"
	PasswordKey     = "password"
	ZidKey          = "x-zid"
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(expectedSecret, expectedID string) *handler

func NewHandlerWithSigningKey

func NewHandlerWithSigningKey(expectedSecret, expectedID, expectedUsername, expectedPassword, tenantHeaderName, externalHost string, signingKey *rsa.PrivateKey, staticMappingClaims map[string]ClaimsGetterFunc) *handler

func NewJWKSHandler

func NewJWKSHandler(key *rsa.PublicKey) *jwksHandler

func NewOpenIDConfigHandler

func NewOpenIDConfigHandler(baseURL, jwksPath string) *openIDConfigHandler

Types

type Claims

type Claims struct {
	ClientId string `json:"client_id,omitempty"`
	Scopes   string `json:"scopes,omitempty"`
	Tenant   string `json:"x-zid,omitempty"`
	jwt.StandardClaims
}

func (Claims) GetTenant

func (c Claims) GetTenant() string

func (Claims) Valid

func (c Claims) Valid() error

type ClaimsGetterFunc

type ClaimsGetterFunc func() map[string]interface{}

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
}

Jump to

Keyboard shortcuts

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