auth

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MPL-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FirebaseAPIKey         = "AIzaSyCxsrwjABEF-dWLzUqmwiL-ct02cnG9GCs"
	TokenBaseURL           = "https://securetoken.googleapis.com"
	EnvVarCloudQueryAPIKey = "CLOUDQUERY_API_KEY"
	ExpiryBuffer           = 60 * time.Second
)

Variables

View Source
var UndefinedToken = Token{Type: Undefined, Value: ""}

Functions

func IsTokenExpiredError added in v1.6.3

func IsTokenExpiredError(err error) bool

func ReadRefreshToken

func ReadRefreshToken() (string, error)

ReadRefreshToken reads the refresh token from the token file

func RemoveRefreshToken

func RemoveRefreshToken() error

RemoveRefreshToken removes the token file

func SaveRefreshToken

func SaveRefreshToken(refreshToken string) error

SaveRefreshToken saves the refresh token to the token file

Types

type Token added in v1.5.0

type Token struct {
	Type  TokenType
	Value string
}

func (Token) String added in v1.5.1

func (t Token) String() string

type TokenClient

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

func NewTokenClient

func NewTokenClient() *TokenClient

func (*TokenClient) GetToken

func (tc *TokenClient) GetToken() (Token, error)

GetToken returns the ID token If CLOUDQUERY_API_KEY is set, it returns that value, otherwise it returns an ID token generated from the refresh token.

func (*TokenClient) GetTokenType added in v1.6.0

func (tc *TokenClient) GetTokenType() TokenType

GetTokenType returns the type of token that will be returned by GetToken

type TokenError added in v1.6.3

type TokenError struct {
	Body         []byte `json:"-"`
	ErrorDetails struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
		Status  string `json:"status"`
	} `json:"error"`
}

func TokenErrorFromBody added in v1.6.3

func TokenErrorFromBody(body []byte) *TokenError

func (TokenError) Error added in v1.6.3

func (t TokenError) Error() string

type TokenType added in v1.5.0

type TokenType int
const (
	Undefined TokenType = iota
	BearerToken
	APIKey
	SyncRunAPIKey
	SyncTestConnectionAPIKey
)

Jump to

Keyboard shortcuts

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