supertoken

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTransferCode

func CreateTransferCode(stid uuid.UUID, jwt string, newST bool, responseType model.ResponseType, clientMetaData serverModel.ClientMetaData) (string, uint64, error)

CreateTransferCode creates a transfer code for the passed super token

Types

type SuperToken

type SuperToken struct {
	Issuer               string                    `json:"iss"`
	Subject              string                    `json:"sub"`
	ExpiresAt            int64                     `json:"exp,omitempty"`
	NotBefore            int64                     `json:"nbf"`
	IssuedAt             int64                     `json:"iat"`
	ID                   uuid.UUID                 `json:"jti"`
	Audience             string                    `json:"aud"`
	OIDCSubject          string                    `json:"oidc_sub"`
	OIDCIssuer           string                    `json:"oidc_iss"`
	Restrictions         restrictions.Restrictions `json:"restrictions,omitempty"`
	Capabilities         capabilities.Capabilities `json:"capabilities"`
	SubtokenCapabilities capabilities.Capabilities `json:"subtoken_capabilities,omitempty"`
	// contains filtered or unexported fields
}

SuperToken is a mytoken SuperToken

func NewSuperToken

func NewSuperToken(oidcSub, oidcIss string, r restrictions.Restrictions, c, sc capabilities.Capabilities) *SuperToken

NewSuperToken creates a new SuperToken

func ParseJWT

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

ParseJWT parses a token string into a SuperToken

func (*SuperToken) ExpiresIn

func (st *SuperToken) ExpiresIn() uint64

ExpiresIn returns the amount of seconds in which this token expires

func (*SuperToken) Scan

func (st *SuperToken) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (*SuperToken) ToJWT

func (st *SuperToken) ToJWT() (string, error)

ToJWT returns the SuperToken as JWT

func (*SuperToken) ToTokenResponse

func (st *SuperToken) ToTokenResponse(responseType model.ResponseType, networkData serverModel.ClientMetaData, jwt string) (response.SuperTokenResponse, error)

ToTokenResponse creates a SuperTokenResponse for this SuperToken according to the passed model.ResponseType

func (*SuperToken) Valid

func (st *SuperToken) Valid() error

Valid checks if this SuperToken is valid

func (*SuperToken) Value

func (st *SuperToken) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

func (*SuperToken) VerifyCapabilities

func (st *SuperToken) VerifyCapabilities(required ...capabilities.Capability) bool

VerifyCapabilities verifies that this super token has the required capabilities

Jump to

Keyboard shortcuts

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