Documentation ¶
Index ¶
- func IsValidDeviceID(ID string) bool
- type PubKeyRepository
- type TokenVendor
- func (tv *TokenVendor) GetOAuth2Token(ctx context.Context, jwtk string) (*tokensource.TokenResponse, error)
- func (tv *TokenVendor) PublishPublicKey(ctx context.Context, deviceID, publicKey string) error
- func (tv *TokenVendor) ReadPublicKey(ctx context.Context, deviceID string) (string, error)
- func (tv *TokenVendor) VerifyToken(ctx context.Context, token oauth.Token, robots bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidDeviceID ¶
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 (*TokenVendor) VerifyToken ¶
Click to show internal directories.
Click to hide internal directories.