auth

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractEmail added in v0.1.16

func ExtractEmail(token string) (email string, verified bool, err error)

func ExtractExpiry

func ExtractExpiry(token string) (time.Time, error)

func ExtractIssuer

func ExtractIssuer(token string) (string, error)

func ExtractIssuerAndSubject

func ExtractIssuerAndSubject(token string) (string, string, error)

func GetToken

func GetToken(ctx context.Context) string

GetToken fetches the token from the context.

func NewFromContext

func NewFromContext(_ context.Context, requireTransportSecurity bool) credentials.PerRPCCredentials

NewFromContext creates a new credentials.PerRPCCredentials based on a token stored in context. This allows callers to provide a token for each RPC.

func NewFromFile

func NewFromFile(ctx context.Context, path string, requireTransportSecurity bool) credentials.PerRPCCredentials

NewFromFile attempts to create a new credentials.PerRPCCredentials based on the provided file. Returns nil if not found.

func NewFromToken

func NewFromToken(_ context.Context, token string, requireTransportSecurity bool) credentials.PerRPCCredentials

NewFromToken attempts to create a new credentials.PerRPCCredentials based on provided OIDC token.

func NormalizeIssuer

func NormalizeIssuer(issuer string) string

NormalizeIssuer massages an issuer string into a canonical form, such as attaching a scheme when certain "special" vendors omit them.

func WithToken

func WithToken(ctx context.Context, authz string) context.Context

WithToken associates the token with the returned context.

Types

type Actor

type Actor struct {
	Audience string `json:"aud"`
	Issuer   string `json:"iss"`
	Subject  string `json:"sub"`
}

func ExtractActor

func ExtractActor(token string) (*Actor, error)

Directories

Path Synopsis
Package login implements client login functionality shared between various clients
Package login implements client login functionality shared between various clients

Jump to

Keyboard shortcuts

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