gsa

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOIDCTokenSource

func NewOIDCTokenSource(ctx context.Context, logger *log.Logger, googleServiceAccountJSON []byte, provider string, cfg OIDCConfig) (src oidc.TokenSource, clearIDToken func() error, err error)

NewOIDCTokenSource constructs OIDCTokenSource. Only JSON files are supported as ServiceAccount files. We are making request to Google in constructor (with context ctx) to maintain fresh public key set for Google provider.

Types

type OIDCConfig

type OIDCConfig struct {
	Provider     string   `json:"provider"`
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"secret"`
	Scopes       []string `json:"scopes"`
}

type OIDCTokenSource

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

OIDCTokenSource implements `oidc.TokenSource` interface to perform oidc-browser-dance. Strictly for Google Service Accounts.

func (*OIDCTokenSource) OIDCToken

func (s *OIDCTokenSource) OIDCToken(ctx context.Context) (*oidc.Token, error)

OIDCToken is used to obtain new OIDC Token (which includes e.g access token and id token). No refresh token will be returned, because this is token source is only service Accounts and we don't need login for that anyway. No caching is in place. We base for reuse token source to cache valid tokens in memory.

func (*OIDCTokenSource) Verifier

func (s *OIDCTokenSource) Verifier() oidc.Verifier

Verifier returns verifier for tokens.

Jump to

Keyboard shortcuts

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