oidc

package
v0.0.0-...-cc89b97 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScope = errors.New("invalid_scope")
	ErrAccessDenied = errors.New("access_denied")
	ErrInvalidState = errors.New("invalid_state")
	ErrInvalidToken = errors.New("invalid_token")
	ErrExpiredToken = errors.New("expired_token")
)

Functions

func ParseJWT

func ParseJWT(token string) (jwt.Token, error)

Types

type Client

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

func NewClient

func NewClient(providerURL string, config ClientConfig) (*Client, error)

func (*Client) FetchUserInfo

func (c *Client) FetchUserInfo(userID, accessToken string) (UserInfo, error)

func (*Client) FinishAuthFlow

func (c *Client) FinishAuthFlow(w http.ResponseWriter, r *http.Request) (userID, access, refresh, id string, err error)

func (*Client) FinishAuthFlowWithData

func (c *Client) FinishAuthFlowWithData(w http.ResponseWriter, r *http.Request) (userID, access, refresh, id string, data any, err error)

func (*Client) InitiateAuthFlow

func (c *Client) InitiateAuthFlow(w http.ResponseWriter, r *http.Request, scopes []string)

func (*Client) InitiateAuthFlowWithData

func (c *Client) InitiateAuthFlowWithData(w http.ResponseWriter, r *http.Request, scopes []string, data any)

func (*Client) RefreshTokens

func (c *Client) RefreshTokens(refreshToken string) (userID, access, refresh, id string, err error)

func (*Client) VerifyIDToken

func (c *Client) VerifyIDToken(idToken string) (jwt.Token, error)

type ClientConfig

type ClientConfig struct {
	ClientID     string
	ClientSecret string
	RedirectURI  string
}

type UserInfo

type UserInfo struct {
	Subject       string `json:"sub"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
}

Jump to

Keyboard shortcuts

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