googleid

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidToken = errors.New("invalid token")
)

Functions

This section is empty.

Types

type AuthorizedUserTokenSource added in v0.0.3

type AuthorizedUserTokenSource struct {
}

func NewAuthorizedUserTokenSource added in v0.0.3

func NewAuthorizedUserTokenSource() *AuthorizedUserTokenSource

func (*AuthorizedUserTokenSource) GetIDToken added in v0.0.3

func (s *AuthorizedUserTokenSource) GetIDToken(ctx context.Context) (string, error)

Retrieve ID-Token using Google Application Default Credentials: authorized_user will have id_token, service_account will not

type Certs

type Certs struct {
	Keys []Keys `json:"keys"`
}

func GetCerts

func GetCerts(ctx context.Context) (*Certs, error)

type ClaimSet

type ClaimSet struct {
	Iss           string `json:"iss"`             // email address of the client_id of the application making the access token request
	Scope         string `json:"scope,omitempty"` // space-delimited list of the permissions the application requests
	Aud           string `json:"aud"`             // descriptor of the intended target of the assertion (Optional).
	Azp           string `json:"azp"`
	Exp           int64  `json:"exp"`           // the expiration time of the assertion (seconds since Unix epoch)
	Iat           int64  `json:"iat"`           // the time the assertion was issued (seconds since Unix epoch)
	Typ           string `json:"typ,omitempty"` // token type (Optional).
	Sub           string `json:"sub,omitempty"` // Email for which the application is requesting delegated access (Optional).
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

ClaimSet represents claim set

type Keys

type Keys struct {
	Kty string `json:"kty"`
	Alg string `json:"alg"`
	Use string `json:"use"`
	Kid string `json:"kid"`
	N   string `json:"n"`
	E   string `json:"e"`
}

https://tools.ietf.org/html/rfc7517#appendix-A

func (*Keys) GetPublicKey

func (key *Keys) GetPublicKey() (*rsa.PublicKey, error)

type ServiceAccountTokenSource added in v0.0.3

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

func NewServiceAccountTokenSource added in v0.0.3

func NewServiceAccountTokenSource(credentialsFile string, targetAudience string) (*ServiceAccountTokenSource, error)

func (*ServiceAccountTokenSource) GetIDToken added in v0.0.3

func (s *ServiceAccountTokenSource) GetIDToken(parent context.Context) (string, error)

type Token

type Token struct {
	Raw      string
	Header   *jws.Header
	ClaimSet *ClaimSet
}

func ParseJWT

func ParseJWT(token string) (*Token, error)

Jump to

Keyboard shortcuts

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