Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CtxPrincipalKey in ctx CtxPrincipalKey key = iota )
Variables ¶
This section is empty.
Functions ¶
func CheckRequestIsAllowed ¶
func CheckRequestIsAllowed(principal *model.Principal, requestType requestobjects.RequestType, project string) bool
CheckRequestIsAllowed check if user is allowed to perform request
Types ¶
type AuthenticationMiddleware ¶
type AuthenticationMiddleware struct {
// contains filtered or unexported fields
}
AuthenticationMiddleware is a middleware for auth process
func NewAuthenticationMiddleware ¶
func NewAuthenticationMiddleware(validator TokenValidator, principalRetriever PrincipalRetriever) (*AuthenticationMiddleware, error)
NewAuthenticationMiddleware return instance of AuthenticationMiddleware
func (*AuthenticationMiddleware) AddAuthentication ¶
func (a *AuthenticationMiddleware) AddAuthentication(next http.HandlerFunc) http.HandlerFunc
AddAuthentication add new auth method
type PrincipalRetriever ¶
type PrincipalRetriever interface {
RetrieveCurrentPrincipal(ctxIn context.Context, r *http.Request) (*model.Principal, error)
}
PrincipalRetriever retriever to fetch principal of request
func NewPrincipalRetriever ¶
func NewPrincipalRetriever(provider provider.PrincipalProvider) (PrincipalRetriever, error)
NewPrincipalRetriever
type TokenValidator ¶
tokenValidator defines operations for JWT token validation
func NewEmptyTokenValidator ¶
func NewEmptyTokenValidator() TokenValidator
NewEmptyTokenValidator return instance of jwtTokenValidator
func NewTokenValidator ¶
func NewTokenValidator(keyForToken string, audience string) (TokenValidator, error)
NewTokenValidator return instance of jwtTokenValidator
Click to show internal directories.
Click to hide internal directories.