myjwt

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROLE_SYSTEM        = "SYSTEM"
	ROLE_ADMINISTRATOR = "ADMINISTRATOR"
	ROLE_USER          = "USER"
)

Variables

This section is empty.

Functions

func ClaimFullName

func ClaimFullName(r *http.Request) string

func ClaimGetRoles

func ClaimGetRoles(r *http.Request) []string

func ClaimGetRolesFromContext

func ClaimGetRolesFromContext(ctx context.Context) []string

func ClaimIsInRole

func ClaimIsInRole(ctx context.Context, role string) bool

func ClaimUserName

func ClaimUserName(r *http.Request) string

func ClaimUserNameFromContext

func ClaimUserNameFromContext(ctx context.Context) string

func Init

func Init(cfg *utils.Config)

func JwtMSFTGetPemCert

func JwtMSFTGetPemCert(token *jwt.Token) (string, error)

func JwtRoleCheckerADMINISTRATOR

func JwtRoleCheckerADMINISTRATOR(next http.Handler) http.Handler

func JwtRoleCheckerContextADMINISTRATOR

func JwtRoleCheckerContextADMINISTRATOR(ctx context.Context) (err error)

func JwtRoleCheckerContextUSER

func JwtRoleCheckerContextUSER(ctx context.Context) (err error)

func JwtRoleCheckerSYSTEM

func JwtRoleCheckerSYSTEM(next http.Handler) http.Handler

func JwtRoleCheckerUSER

func JwtRoleCheckerUSER(next http.Handler) http.Handler

Types

type CustomClaimsShieldoo

type CustomClaimsShieldoo struct {
	Name          string   `json:"name"`
	Upn           string   `json:"upn,omitempty"`
	UniqueName    string   `json:"unique_name,omitempty"`
	PreferredName string   `json:"preferred_username,omitempty"`
	Roles         []string `json:"roles,omitempty"`
	Provider      string   `json:"provider,omitempty"`
	Tenant        string   `json:"tenant,omitempty"`
}

func ClaimGetCustom

func ClaimGetCustom(r *http.Request) *CustomClaimsShieldoo

func ClaimGetCustomFromContext

func ClaimGetCustomFromContext(ctx context.Context) *CustomClaimsShieldoo

func (*CustomClaimsShieldoo) Validate

func (c *CustomClaimsShieldoo) Validate(ctx context.Context) error

Validate does nothing for this example.

type JSONWebKeys

type JSONWebKeys struct {
	Kty string   `json:"kty"`
	Kid string   `json:"kid"`
	Use string   `json:"use"`
	N   string   `json:"n"`
	E   string   `json:"e"`
	X5c []string `json:"x5c"`
}

type Jwks

type Jwks struct {
	Keys []JSONWebKeys `json:"keys"`
}

Jump to

Keyboard shortcuts

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