app

package
Version: v0.0.0-...-976a764 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ERROR_INVALID_ACCESS_TOKEN = 1
View Source
const ERROR_MISSING_BEARER_TOKEN = 2
View Source
const ERROR_MISSING_REQUIRED_SCOPES = 3

Variables

This section is empty.

Functions

func AccessToken

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

func AuthenticationRequired

func AuthenticationRequired(logKey string, accessTokenKey string) gin.HandlerFunc

func AuthorizationRequired

func AuthorizationRequired(aconf AuthorizationConfig, requiredScopes ...string) gin.HandlerFunc

func FetchRequiredScopes

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

func IdToken

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

func ProcessMethodOverride

func ProcessMethodOverride(r *gin.Engine) gin.HandlerFunc

func RequestId

func RequestId() gin.HandlerFunc

func RequestLogger

func RequestLogger(logKey string, requestIdKey string, log *logrus.Logger, appFields logrus.Fields) gin.HandlerFunc

func RequireScopes

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

Types

type AuthorizationConfig

type AuthorizationConfig struct {
	LogKey             string
	AccessTokenKey     string
	HydraConfig        *clientcredentials.Config
	HydraIntrospectUrl string
	AapConfig          *clientcredentials.Config
}

type EmailTemplate

type EmailTemplate struct {
	Sender  idp.SMTPSender
	File    string
	Subject string
}

type Environment

type Environment struct {
	Constants *EnvironmentConstants

	Logger *logrus.Logger

	Provider *oidc.Provider

	HydraConfig *clientcredentials.Config
	AapConfig   *clientcredentials.Config

	Driver          neo4j.Driver
	BannedUsernames map[string]bool
	IssuerSignKey   *rsa.PrivateKey
	IssuerVerifyKey *rsa.PublicKey
	Nats            *nats.Conn
	TemplateMap     *map[idp.ChallengeType]EmailTemplate
}

type EnvironmentConstants

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

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

type JsonError

type JsonError struct {
	ErrorCode int    `json:"error_code" binding:"required"`
	Error     string `json:"error" binding:"required"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL