auth

package
v0.0.0-...-145cf54 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

func GetUsernameFromContext(ctx context.Context) string

func SetUsernameContext

func SetUsernameContext(ctx context.Context, username string) context.Context

Types

type AuthorizationMiddleware

type AuthorizationMiddleware interface {
	AuthorizeApi(next http.Handler) http.Handler
}

func NewAuthzMiddleware

func NewAuthzMiddleware(ocmClient *ocm.Client, action, resourceType string) AuthorizationMiddleware

func NewAuthzMiddlewareMock

func NewAuthzMiddlewareMock() AuthorizationMiddleware

type JWTMiddleware

type JWTMiddleware interface {
	AuthenticateAccountJWT(next http.Handler) http.Handler
}

type Middleware

type Middleware struct{}

func NewAuthMiddleware

func NewAuthMiddleware() (*Middleware, error)

func (*Middleware) AuthenticateAccountJWT

func (a *Middleware) AuthenticateAccountJWT(next http.Handler) http.Handler

AuthenticateAccountJWT Middleware handler to validate JWT tokens and authenticate users

type MiddlewareMock

type MiddlewareMock struct{}

func (*MiddlewareMock) AuthenticateAccountJWT

func (a *MiddlewareMock) AuthenticateAccountJWT(next http.Handler) http.Handler

type Payload

type Payload 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) (*Payload, error)

func GetAuthPayloadFromContext

func GetAuthPayloadFromContext(ctx context.Context) (*Payload, error)

GetAuthPayloadFromContext Get authorization payload api object from context

Jump to

Keyboard shortcuts

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