auth

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeysMissing = errors.New("missing API key or secret key")
)

Functions

This section is empty.

Types

type APIKeyTokenVerifier

type APIKeyTokenVerifier struct {
	// contains filtered or unexported fields
}

func ParseAPIToken

func ParseAPIToken(raw string) (*APIKeyTokenVerifier, error)

ParseAPIToken parses an encoded JWT token and

func (*APIKeyTokenVerifier) APIKey

func (v *APIKeyTokenVerifier) APIKey() string

APIKey returns the API key this token was signed with

func (*APIKeyTokenVerifier) Identity

func (v *APIKeyTokenVerifier) Identity() string

func (*APIKeyTokenVerifier) Verify

func (v *APIKeyTokenVerifier) Verify(key interface{}) (*ClaimGrants, error)

type AccessToken

type AccessToken struct {
	// contains filtered or unexported fields
}

AccessToken produces token signed with API key and secret

func NewAccessToken

func NewAccessToken(key string, secret string) *AccessToken

func (*AccessToken) AddGrant

func (t *AccessToken) AddGrant(grant *VideoGrant) *AccessToken

func (*AccessToken) SetIdentity

func (t *AccessToken) SetIdentity(identity string) *AccessToken

func (*AccessToken) SetMetadata

func (t *AccessToken) SetMetadata(md string) *AccessToken

func (*AccessToken) SetName

func (t *AccessToken) SetName(name string) *AccessToken

func (*AccessToken) SetSha256

func (t *AccessToken) SetSha256(sha string) *AccessToken

func (*AccessToken) SetValidFor

func (t *AccessToken) SetValidFor(duration time.Duration) *AccessToken

func (*AccessToken) ToJWT

func (t *AccessToken) ToJWT() (string, error)

type ClaimGrants

type ClaimGrants struct {
	Identity string      `json:"-"`
	Name     string      `json:"name,omitempty"`
	Video    *VideoGrant `json:"video,omitempty"`
	// for verifying integrity of the message body
	Sha256   string `json:"sha256,omitempty"`
	Metadata string `json:"metadata,omitempty"`
}

func (*ClaimGrants) Clone

func (c *ClaimGrants) Clone() *ClaimGrants

type FileBasedKeyProvider

type FileBasedKeyProvider struct {
	// contains filtered or unexported fields
}

func NewFileBasedKeyProviderFromMap

func NewFileBasedKeyProviderFromMap(keys map[string]string) *FileBasedKeyProvider

func NewFileBasedKeyProviderFromReader

func NewFileBasedKeyProviderFromReader(r io.Reader) (p *FileBasedKeyProvider, err error)

func (*FileBasedKeyProvider) GetSecret

func (p *FileBasedKeyProvider) GetSecret(key string) string

func (*FileBasedKeyProvider) NumKeys

func (p *FileBasedKeyProvider) NumKeys() int

type KeyProvider

type KeyProvider interface {
	GetSecret(key string) string
	NumKeys() int
}

type SimpleKeyProvider

type SimpleKeyProvider struct {
	// contains filtered or unexported fields
}

func NewSimpleKeyProvider

func NewSimpleKeyProvider(apiKey, apiSecret string) *SimpleKeyProvider

func (*SimpleKeyProvider) GetSecret

func (p *SimpleKeyProvider) GetSecret(key string) string

func (*SimpleKeyProvider) NumKeys

func (p *SimpleKeyProvider) NumKeys() int

type TokenVerifier

type TokenVerifier interface {
	Identity() string
	Verify(key interface{}) (*ClaimGrants, error)
}

type VideoGrant

type VideoGrant struct {
	// actions on rooms
	RoomCreate bool `json:"roomCreate,omitempty"`
	RoomList   bool `json:"roomList,omitempty"`
	RoomRecord bool `json:"roomRecord,omitempty"`

	// actions on a particular room
	RoomAdmin bool   `json:"roomAdmin,omitempty"`
	RoomJoin  bool   `json:"roomJoin,omitempty"`
	Room      string `json:"room,omitempty"`

	// permissions within a room, if none of the permissions are set explicitly
	// it will be granted with all publish and subscribe permissions
	CanPublish     *bool `json:"canPublish,omitempty"`
	CanSubscribe   *bool `json:"canSubscribe,omitempty"`
	CanPublishData *bool `json:"canPublishData,omitempty"`
	// TrackSource types that a participant may publish.
	// When set, it supersedes CanPublish. Only sources explicitly set here can be published
	CanPublishSources []string `json:"canPublishSources,omitempty"` // keys keep track of each source
	// by default, a participant is not allowed to update its own metadata
	CanUpdateOwnMetadata *bool `json:"canUpdateOwnMetadata,omitempty"`

	// actions on ingresses
	IngressAdmin bool `json:"ingressAdmin,omitempty"` // applies to all ingress

	// participant is not visible to other participants
	Hidden bool `json:"hidden,omitempty"`
	// indicates to the room that current participant is a recorder
	Recorder bool `json:"recorder,omitempty"`
}

func (*VideoGrant) Clone

func (v *VideoGrant) Clone() *VideoGrant

func (*VideoGrant) GetCanPublish

func (v *VideoGrant) GetCanPublish() bool

func (*VideoGrant) GetCanPublishData

func (v *VideoGrant) GetCanPublishData() bool

func (*VideoGrant) GetCanPublishSource

func (v *VideoGrant) GetCanPublishSource(source livekit.TrackSource) bool

func (*VideoGrant) GetCanPublishSources

func (v *VideoGrant) GetCanPublishSources() []livekit.TrackSource

func (*VideoGrant) GetCanSubscribe

func (v *VideoGrant) GetCanSubscribe() bool

func (*VideoGrant) GetCanUpdateOwnMetadata

func (v *VideoGrant) GetCanUpdateOwnMetadata() bool

func (*VideoGrant) MatchesPermission

func (v *VideoGrant) MatchesPermission(permission *livekit.ParticipantPermission) bool

func (*VideoGrant) SetCanPublish

func (v *VideoGrant) SetCanPublish(val bool)

func (*VideoGrant) SetCanPublishData

func (v *VideoGrant) SetCanPublishData(val bool)

func (*VideoGrant) SetCanPublishSources

func (v *VideoGrant) SetCanPublishSources(sources []livekit.TrackSource)

func (*VideoGrant) SetCanSubscribe

func (v *VideoGrant) SetCanSubscribe(val bool)

func (*VideoGrant) SetCanUpdateOwnMetadata

func (v *VideoGrant) SetCanUpdateOwnMetadata(val bool)

func (*VideoGrant) ToPermission

func (v *VideoGrant) ToPermission() *livekit.ParticipantPermission

func (*VideoGrant) UpdateFromPermission

func (v *VideoGrant) UpdateFromPermission(permission *livekit.ParticipantPermission)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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