Documentation ¶
Index ¶
Constants ¶
View Source
const ( ContextUsernameKey contextKey = "username" // Does not use contextKey type because the jwt middleware improperly updates context with string key type // See https://github.com/auth0/go-jwt-middleware/blob/master/jwtmiddleware.go#L232 ContextAuthKey string = "user" )
Variables ¶
This section is empty.
Functions ¶
func GetUsernameFromContext ¶
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct{}
func NewAuthMiddleware ¶
func NewAuthMiddleware() (*AuthMiddleware, error)
func (*AuthMiddleware) AuthenticateAccountJWT ¶
func (a *AuthMiddleware) AuthenticateAccountJWT(next http.Handler) http.Handler
Middleware handler to validate JWT tokens and authenticate users
type AuthMiddlewareMock ¶
type AuthMiddlewareMock struct{}
func (*AuthMiddlewareMock) AuthenticateAccountJWT ¶
func (a *AuthMiddlewareMock) AuthenticateAccountJWT(next http.Handler) http.Handler
type AuthPayload ¶
type AuthPayload struct { Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` Issuer string `json:"iss"` ClientID string `json:"clientId"` }
AuthPayload defines the structure of the JWT payload we expect from RHD JWT tokens
func GetAuthPayload ¶
func GetAuthPayload(r *http.Request) (*AuthPayload, error)
func GetAuthPayloadFromContext ¶
func GetAuthPayloadFromContext(ctx context.Context) (*AuthPayload, error)
Get authorization payload api object from context
type AuthorizationMiddleware ¶
func NewAuthzMiddleware ¶
func NewAuthzMiddleware(ocmClient *ocm.Client, action, resourceType string) AuthorizationMiddleware
func NewAuthzMiddlewareMock ¶
func NewAuthzMiddlewareMock() AuthorizationMiddleware
Click to show internal directories.
Click to hide internal directories.