...

Package tokenmanager

import "github.com/google/s2a-go/internal/tokenmanager"
Overview
Index

Overview ▾

Package tokenmanager provides tokens for authenticating to S2A.

type AccessTokenManager

AccessTokenManager manages tokens for authenticating to S2A.

type AccessTokenManager interface {
    // DefaultToken returns a token that an application with no specified local
    // identity must use to authenticate to S2A.
    DefaultToken() (token string, err error)
    // Token returns a token that an application with local identity equal to
    // identity must use to authenticate to S2A.
    Token(identity *commonpb.Identity) (token string, err error)
}

func NewSingleTokenAccessTokenManager

func NewSingleTokenAccessTokenManager() (AccessTokenManager, error)

NewSingleTokenAccessTokenManager returns a new AccessTokenManager instance that will always manage the same token.

The token to be managed is read from the s2aAccessTokenEnvironmentVariable environment variable. If this environment variable is not set, then this function returns an error.