oidc

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnregisteredRedirectURL = errors.New("oidc: unregistered redirectURL")
	ErrBadRequest              = errors.New("oidc: bad request")
)

Functions

func ExtractRawIDToken

func ExtractRawIDToken(token *oauth2.Token) string

Types

type Claims

type Claims struct {
	Iss           string `json:"iss"`
	Sub           string `json:"sub"`
	Aud           string `json:"aud"`
	Exp           int64  `json:"exp"`
	Iat           int64  `json:"iat"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
}

type OIDC

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

func NewOIDC

func NewOIDC(
	ctx context.Context,
	issuerURL, issuerCertPath, clientID, clientSecret string,
	redirectURLs []string,
	opts ...Option,
) (*OIDC, error)

func (*OIDC) AuthCodeURL

func (o *OIDC) AuthCodeURL(state, redirectURL string) (string, error)

func (*OIDC) Exchange

func (o *OIDC) Exchange(ctx context.Context, code, redirectURL string) (*oauth2.Token, error)

func (*OIDC) RefreshToken

func (o *OIDC) RefreshToken(
	ctx context.Context,
	token string,
	expires time.Duration,
	redirectURL string,
) (*oauth2.Token, error)

func (*OIDC) Verify

func (o *OIDC) Verify(ctx context.Context, rawIDToken string) (*Claims, error)

type Option

type Option func(*options)

func WithHTTPTimeout

func WithHTTPTimeout(timeout time.Duration) Option

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithScopes

func WithScopes(scopes []string) Option

Jump to

Keyboard shortcuts

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