mytoken

package
v0.6.1-c Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTransferCode

func CreateTransferCode(
	rlog log.Ext1FieldLogger, myID mtid.MTID, jwt string, newMT bool, responseType model.ResponseType,
	clientMetaData api.ClientMetaData,
) (string, uint64, error)

CreateTransferCode creates a transfer code for the passed mytoken id

Types

type Mytoken

type Mytoken struct {
	api.Mytoken
	ExpiresAt    unixtime.UnixTime         `json:"exp,omitempty"`
	NotBefore    unixtime.UnixTime         `json:"nbf"`
	IssuedAt     unixtime.UnixTime         `json:"iat"`
	AuthTime     unixtime.UnixTime         `json:"auth_time,omitempty"`
	ID           mtid.MTID                 `json:"jti"`
	Restrictions restrictions.Restrictions `json:"restrictions,omitempty"`
	Rotation     *api.Rotation             `json:"rotation,omitempty"`
	// contains filtered or unexported fields
}

Mytoken is a mytoken Mytoken

func NewMytoken

func NewMytoken(
	oidcSub, oidcIss, name string, r restrictions.Restrictions, c api.Capabilities, rot *api.Rotation,
	authTime unixtime.UnixTime,
) *Mytoken

NewMytoken creates a new Mytoken

func ParseJWT

func ParseJWT(token string) (*Mytoken, error)

ParseJWT parses a token string into a Mytoken

func ParseJWTWithoutClaimsValidation added in v0.3.3

func ParseJWTWithoutClaimsValidation(token string) (*Mytoken, error)

ParseJWTWithoutClaimsValidation parses a token string into a Mytoken

func (*Mytoken) ExpiresIn

func (mt *Mytoken) ExpiresIn() uint64

ExpiresIn returns the amount of seconds in which this token expires

func (Mytoken) Rotate added in v0.3.0

func (mt Mytoken) Rotate() *Mytoken

Rotate returns a Mytoken and returns the new *Mytoken

func (*Mytoken) ToJWT

func (mt *Mytoken) ToJWT() (string, error)

ToJWT returns the Mytoken as JWT

func (*Mytoken) ToTokenResponse

func (mt *Mytoken) ToTokenResponse(
	rlog log.Ext1FieldLogger, responseType model.ResponseType, maxTokenLen int, networkData api.ClientMetaData,
	jwt string,
) (response.MytokenResponse, error)

ToTokenResponse creates a MytokenResponse for this Mytoken according to the passed model.ResponseType

func (*Mytoken) ToUniversalMytoken added in v0.4.0

func (mt *Mytoken) ToUniversalMytoken() universalmytoken.UniversalMytoken

ToUniversalMytoken returns a universalmytoken.UniversalMytoken for this Mytoken

func (*Mytoken) ToUsedMytoken

func (mt *Mytoken) ToUsedMytoken(rlog log.Ext1FieldLogger, tx *sqlx.Tx) (*UsedMytoken, error)

ToUsedMytoken turns a Mytoken into a UsedMytoken by adding information about its usages

func (*Mytoken) Valid

func (mt *Mytoken) Valid() error

Valid checks if this Mytoken is valid

func (*Mytoken) VerifyCapabilities

func (mt *Mytoken) VerifyCapabilities(required ...api.Capability) bool

VerifyCapabilities verifies that this Mytoken has the required capabilities

type UsedMytoken

type UsedMytoken struct {
	Mytoken
	Restrictions []restrictions.UsedRestriction `json:"restrictions,omitempty"`
}

UsedMytoken is a type for a Mytoken that has been used, it additionally has information how often it has been used

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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