app

package
v0.0.0-...-9e5282c Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidDeviceID

func IsValidDeviceID(ID string) bool

IsValidDeviceID validates the given identifier for string length and characters used

Validation is based on the RFC952 for hostnames.

Types

type PubKeyRepository

type PubKeyRepository interface {

	// LookupKey retrieves the public key of a device from the repository.
	// An empty string return indicates that no key exists for the given identifier or
	// that the device is blocked.
	LookupKey(ctx context.Context, deviceID string) (string, error)
	PublishKey(ctx context.Context, deviceID, publicKey string) error
}

type TokenVendor

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

func NewTokenVendor

func NewTokenVendor(ctx context.Context, repo PubKeyRepository, v *oauth.TokenVerifier, ts *tokensource.GCPTokenSource, acceptedAudience string) (*TokenVendor, error)

func (*TokenVendor) GetOAuth2Token

func (tv *TokenVendor) GetOAuth2Token(ctx context.Context, jwtk string) (*tokensource.TokenResponse, error)

func (*TokenVendor) PublishPublicKey

func (tv *TokenVendor) PublishPublicKey(ctx context.Context, deviceID, publicKey string) error

func (*TokenVendor) ReadPublicKey

func (tv *TokenVendor) ReadPublicKey(ctx context.Context, deviceID string) (string, error)

func (*TokenVendor) VerifyToken

func (tv *TokenVendor) VerifyToken(ctx context.Context, token oauth.Token, robots bool) error

Jump to

Keyboard shortcuts

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