auth

package
v0.0.0-...-cb90f35 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const IdTokenKey = "idToken"
View Source
const OidcTokenKey = "oidcToken"
View Source
const OidcTokenStrKey = "oidcTokenStr"

Variables

This section is empty.

Functions

func ExtractToken

func ExtractToken(request *http.Request) string

func GetOidcTokenCtx

func GetOidcTokenCtx(ctx context.Context) *oidc.IDToken

func GetOidcTokenReq

func GetOidcTokenReq(r *http.Request) *oidc.IDToken

func GetOidcTokenStrCtx

func GetOidcTokenStrCtx(ctx context.Context) string

func GetOidcTokenStrReq

func GetOidcTokenStrReq(r *http.Request) string

func JwtAuth

func JwtAuth(ctx context.Context, jwtToken string, oidcConfig OIDCConfig) (token *oidc.IDToken, err error)

func UseAuth

func UseAuth(next http.HandlerFunc) http.HandlerFunc

func UseIdToken

func UseIdToken(next http.HandlerFunc) http.HandlerFunc

func UseOidcToken

func UseOidcToken(next http.HandlerFunc, oidcConfig OIDCConfig) http.HandlerFunc

func UseOidcTokenStr

func UseOidcTokenStr(next http.HandlerFunc) http.HandlerFunc

Types

type IdToken

type IdToken struct {
	// this is used for identification
	Subject string `json:"sub"`
	// candidate for docker user name
	PreferredUsername string `json:"preferred_username"`
	// candidate for docker user name
	Email string `json:"email"`
	Name  string `json:"name"`
}

IdToken harbour expects

func GetIdTokenCtx

func GetIdTokenCtx(ctx context.Context) *IdToken

func GetIdTokenReq

func GetIdTokenReq(r *http.Request) *IdToken

func IdTokenFromToken

func IdTokenFromToken(token *oidc.IDToken) (idToken IdToken, err error)

IdTokenFromToken transforms a oidc.IDToken to a harbour IDToken

type OIDCConfig

type OIDCConfig struct {
	DiscoveryUrl string
	ClientId     string
}

OIDCConfig is the required minimum for token validation

func DefaultConfig

func DefaultConfig() OIDCConfig

func ParseViperConfig

func ParseViperConfig() OIDCConfig

ParseViperConfig tries to map a viper configuration

Jump to

Keyboard shortcuts

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