authn

package
v0.0.0-...-2e9186d Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const DECODE_TOKEN_FAILD = "decode token failed"
View Source
const MALFORMED_TOKEN = "malformed Token"
View Source
const NO_EXP_IN_TOKEN = "no [exp] in oidc token"
View Source
const NO_GROUPS_IN_TOKEN = "no [groups] in oidc token"
View Source
const PARSING_OIDC_TOKEN = "while parsing oidc token: "
View Source
const UNMARSHAL_TOKEN_FAILED = "unmarshal token failed"

Variables

View Source
var L2L3OperatiorRoles = []string{"runtimeAdmin", "runtimeOperator"}

Functions

func AuthMiddleware

func AuthMiddleware(a authenticator.Request) func(http.Handler) http.Handler

func DecodePayloadAsRawJSON

func DecodePayloadAsRawJSON(s string) ([]byte, error)

DecodePayloadAsRawJSON extracts the payload and returns the raw JSON.

func ExtractUserID

func ExtractUserID(dat map[string]interface{}) string

func ParseToken

func ParseToken(jwtToken string) (map[string]interface{}, string, int)

func StringWithCharset

func StringWithCharset(length int, charset string) string

Types

type CancelableAuthRequest

type CancelableAuthRequest interface {
	authenticator.Request
	Cancel() //Cancels (stops) the underlying instance
}

Extends authenticator.Request interface with Cancel() function used to stop underlying authenticator instance once it's not needed anymore

func NewOIDCAuthenticator

func NewOIDCAuthenticator(config *OIDCConfig) (CancelableAuthRequest, error)

NewOIDCAuthenticator returns OIDC authenticator wrapped as a CancelableAuthRequest instance. CancelableAuthRequest alows users to cancel the authenticator once it's not used anymore.

type OIDCConfig

type OIDCConfig struct {
	IssuerURL            string
	ClientID             string
	CAFilePath           string
	UsernameClaim        string
	UsernamePrefix       string
	GroupsClaim          string
	GroupsPrefix         string
	SupportedSigningAlgs []string
}

OIDCConfig represents configuration used for JWT request authentication

type UserInfo

type UserInfo struct {
	ID   string
	Role string
	Exp  time.Time
}

func ValidateToken

func ValidateToken(r *http.Request) (UserInfo, string, int)

Jump to

Keyboard shortcuts

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