auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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