claim

package
v5.0.0-...-3817779 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package claim wraps the JWT claims with util functions

Index

Constants

View Source
const (
	ContextKey contextKey = "pydio-claims"
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, claims Claims) context.Context

ToContext feeds context with correct Keys and Metadata for a given Claims

func UserNameFromContext

func UserNameFromContext(ctx context.Context) string

UserNameFromContext looks up for various keys to find username and **optionally** claims

Types

type Claims

type Claims struct {
	ClientApp      interface{} `json:"aud" mapstructure:"aud"`
	Issuer         string      `json:"iss" mapstructure:"iss"`
	SessionID      string      `json:"sid" mapstructure:"sid"`
	Subject        string      `json:"sub" mapstructure:"sub"`
	Nonce          string      `json:"nonce" mapstructure:"nonce"`
	Name           string      `json:"name" mapstructure:"name"`
	Email          string      `json:"email" mapstructure:"email"`
	Profile        string      `json:"profile" mapstructure:"profile"`
	Verified       bool        `json:"email_verified" mapstructure:"email_verified"`
	Public         bool        `json:"public" mapstructure:"public"`
	Roles          string      `json:"roles" mapstructure:"roles"`
	Expiry         time.Time   `json:"expiry" mapstructure:"expiry"`
	AuthSource     string      `json:"authSource" mapstructure:"authSource"`
	DisplayName    string      `json:"displayName" mapstructure:"displayName"`
	GroupPath      string      `json:"groupPath" mapstructure:"groupPath"`
	ProvidesScopes bool        `json:"providesScopes" mapstructure:"providesScopes"`
	Scopes         []string    `json:"scopes" mapstructure:"scopes"`
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) (Claims, bool)

FromContext retrieves claims from context

func (*Claims) AttachSecretPair

func (c *Claims) AttachSecretPair(sp string)

func (*Claims) GetClientApp

func (c *Claims) GetClientApp() string

func (*Claims) GetSecretPair

func (c *Claims) GetSecretPair() string

func (*Claims) GetUniqueKey

func (c *Claims) GetUniqueKey() string

GetUniqueKey returns a key that is unique to a given claim value

Jump to

Keyboard shortcuts

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