claim

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package claim wraps the JWT claims with util functions

Index

Constants

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

Variables

This section is empty.

Functions

func UserNameFromIDToken added in v1.2.0

func UserNameFromIDToken(token string) string

UserNameFromIDToken parses an IDToken and extract the "name" field from the 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"`
	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"`
}

func (*Claims) DecodeSubject

func (c *Claims) DecodeSubject() (*IDTokenSubject, error)

Decode Subject field of the claims

func (*Claims) GetClientApp

func (c *Claims) GetClientApp() string

type IDTokenSubject

type IDTokenSubject struct {
	// UserId specific to cells
	UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId" json:"user_id,omitempty"`
	// ConnId defines the connector chosen to login
	ConnId string `protobuf:"bytes,2,opt,name=conn_id,json=connId" json:"conn_id,omitempty"`
}

IDTokenSubject is the representation of the format of subject we are using

func (*IDTokenSubject) Encode

func (s *IDTokenSubject) Encode() ([]byte, error)

Encode the content of the ID Token Subject

func (*IDTokenSubject) ProtoMessage

func (*IDTokenSubject) ProtoMessage()

ProtoMessage is used by the proto.Message interface

func (*IDTokenSubject) Reset

func (s *IDTokenSubject) Reset()

Reset the value to empty

func (*IDTokenSubject) String

func (s *IDTokenSubject) String() string

String representation

Jump to

Keyboard shortcuts

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