permission

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasRequiredClaims

func HasRequiredClaims(token Token) bool

HasRequiredClaims returns false if the Token is missing any required elements

Types

type Token

type Token struct {

	// BookingID represents the booking id/name that the token has been generated
	// for, so that connections can be dropped / denied if a booked session
	// is cancelled
	BookingID string `json:"booking_id"`

	// Topic identifies the communication channel;
	// think of it as a session_id, or room (webrtc)
	// Don't reuse standard claim Subject as that is for a
	// usually for a user and is reserved for later usage.
	Topic string `json:"topic"`

	// Determines the type of communication channel
	// and hence required scopes + hub/client implementation
	// e.g. "session" or "shell"
	ConnectionType string `json:"prefix"`

	// Scopes controlling access to relay;
	// either ["read"],["write"], or ["read","write"] for session, or ["host"]/["client"] for shell
	Scopes []string `json:"scopes"`

	jwt.RegisteredClaims `yaml:",omitempty"`
}

Token represents a JWT token

func NewToken

func NewToken(audience, connectionType, topic string, scopes []string, iat, nbf, exp int64) Token

NewToken returns a Token populated with the supplied information

func (*Token) SetBookingID added in v0.3.0

func (t *Token) SetBookingID(bookingID string)

SetBookingID sets the bookingID (so that connections can be cancelled if a booking is cancelled)

Jump to

Keyboard shortcuts

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