login

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasRequiredClaims

func HasRequiredClaims(token Token) bool

HasRequiredClaims checks that there is at least one group, and at least one scope, returning true if there is at least one group and one scope

func SetSubject

func SetSubject(token *Token, subject string)

SetSubject sets the subject of the token

func Signed

func Signed(token Token, secret string) (string, error)

Signed signs a token and returns the signed token as a string

Types

type Token

type Token struct {

	// Groups represent the group names for the sets of pools
	// which a user can access
	Groups []string `json:"groups"`

	// Scopes controlling access to relay;
	// either ["login"],["user"], or ["login","admin"]
	Scopes []string `json:"scopes"`

	// Pools is a list of pool_id for the pools in the groups
	Pools []string `json:"pools"`

	jwt.RegisteredClaims
}

Token represents a token used for login or booking

func NewToken

func NewToken(audience string, groups, pools []string, scopes []string, iat, nbf, exp int64) Token

NewToken creates a new token (but does not sign it)

func (*Token) String

func (t *Token) String() string

String converts a token into a string, returning the string

type TokenInBody

type TokenInBody struct {
	Token string `json:"token"`
}

TokenInBody represents a token marshalled into a string

Jump to

Keyboard shortcuts

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