app

package
v0.0.0-...-53608c7 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 16 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(env *Environment, requiredScopes ...string) gin.HandlerFunc

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

Types

type Environment

type Environment struct {
	Provider        *oidc.Provider
	OAuth2Delegator *EnvironmentOauth2Delegator
	Driver          neo4j.Driver
	Constants       *EnvironmentConstants
	Nats            *nats.Conn
}

type EnvironmentConstants

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

type EnvironmentOauth2Delegator

type EnvironmentOauth2Delegator struct {
	Config             *clientcredentials.Config
	IntrospectTokenUrl string
}

type Introspection

type Introspection struct {
	Subject aap.Identity
	Client  aap.Identity
	Caller  aap.Identity
}

type JsonError

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

type JudgeVerdict

type JudgeVerdict struct {
	Introspection Introspection
	Verdict       aap.Verdict
	Reason        string
}

func Judge

func Judge(tx neo4j.Transaction, token *oauth2.Token, iPublisher aap.Identity, iScopes []aap.Scope, iOwners []aap.Identity, iCaller aap.Identity, hydraClient *hydra.HydraClient, introspectTokenUrl string) (judgeVerdict JudgeVerdict, err error)

Jump to

Keyboard shortcuts

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