Version: v0.0.0-...-93a261a Latest Latest

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 20 Imported by: 0




This section is empty.


This section is empty.


func AccessToken

func AccessToken(env *Environment, c *gin.Context) *oauth2.Token

func ClearSessionRedirect

func ClearSessionRedirect(env *Environment, c *gin.Context, state string)

func ConfigureOauth2

func ConfigureOauth2(env *Environment) gin.HandlerFunc

func CreateRandomStringWithNumberOfBytes

func CreateRandomStringWithNumberOfBytes(numberOfBytes int) (string, error)

func CreateSessionRedirect

func CreateSessionRedirect(env *Environment, c *gin.Context, state string, redirectTo string) (err error)

func FetchOAuth2Config

func FetchOAuth2Config(env *Environment, c *gin.Context) *oauth2.Config

func FetchPrecalculatedState

func FetchPrecalculatedState(env *Environment, c *gin.Context) (precaluclatedState string)

func FetchRequiredScopes

func FetchRequiredScopes(env *Environment, c *gin.Context) (requiredScopes []string)

func FetchSessionRedirect

func FetchSessionRedirect(env *Environment, c *gin.Context, state string) (redirectTo string, exists bool)

func GetIdentity

func GetIdentity(env *Environment, c *gin.Context) *idp.Human

func IdToken

func IdToken(env *Environment, c *gin.Context) *oidc.IDToken

func IdTokenHint

func IdTokenHint(env *Environment, c *gin.Context) string

func IdpClientUsingAuthorizationCode

func IdpClientUsingAuthorizationCode(env *Environment, oauth2Delegator *oauth2.Config, c *gin.Context) *idp.IdpClient

func IdpClientUsingClientCredentials

func IdpClientUsingClientCredentials(env *Environment, c *gin.Context) *idp.IdpClient

func RegisterChallengeSession

func RegisterChallengeSession(env *Environment, c *gin.Context, state string, challenge string) (err error)

func RequestId

func RequestId() gin.HandlerFunc

func RequestLogger

func RequestLogger(env *Environment, appFields logrus.Fields) gin.HandlerFunc

func RequestTokenUsingAuthorizationCode

func RequestTokenUsingAuthorizationCode(env *Environment) gin.HandlerFunc

This implements authorization code flow exchange controller functionality to prevent session storage on normal callback endpoints.

func RequireIdentity

func RequireIdentity(env *Environment) gin.HandlerFunc

func RequireScopes

func RequireScopes(env *Environment, requiredScopes ...string) gin.HandlerFunc

func StartAuthenticationSession

func StartAuthenticationSession(env *Environment, c *gin.Context, oauth2Config *oauth2.Config, idTokenHint string, state string) (authorizationCodeUrl *url.URL, err error)

func UsePrecalculatedStateFromQuery

func UsePrecalculatedStateFromQuery(env *Environment, queryParamKey string) gin.HandlerFunc

func ValidateSessionState

func ValidateSessionState(env *Environment, c *gin.Context, state string) (valid bool)


type ChallengeSession

type ChallengeSession struct {
	State string

	RedirectToOnSuccess string
	RedirectToOnFailure string

func StartChallengeSession

func StartChallengeSession(env *Environment, c *gin.Context, newChallengeSession ChallengeSession) (challengeSession *ChallengeSession, err error)

type Environment

type Environment struct {
	Constants *EnvironmentConstants

	Logger *logrus.Logger

	Provider *oidc.Provider

	ClientId     string
	ClientSecret string

	IdpConfig *clientcredentials.Config
	AapConfig *clientcredentials.Config

type EnvironmentConstants

type EnvironmentConstants struct {
	RequestIdKey   string
	LogKey         string
	AccessTokenKey string
	IdTokenKey     string

	SessionStoreKey             string // This holds the controller data
	SessionRedirectCsrfStoreKey string // This holds the data that is shared between controllers (redirects and state for CSRF over redirects)
	SessionChallengeStoreKey    string // This holds the data from challenges
	SessionLogoutStateKey       string

	ContextAccessTokenKey        string
	ContextIdTokenKey            string
	ContextIdTokenRawKey         string
	ContextIdTokenHintKey        string
	ContextIdentityKey           string
	ContextOAuth2ConfigKey       string
	ContextRequiredScopesKey     string
	ContextPrecalculatedStateKey string

Jump to

Keyboard shortcuts

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