oauthrelyingpartyutil

package
v0.0.0-...-ee57881 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContextForTheUnusedContextArgumentInJWXV2API = context.TODO()

jwx@v2 takes context in some of the APIs. But jwx@v3 remove context in those APIs. And actually, the context argument is unused. So we can safely pass it a context.TODO().

View Source
var InvalidConfiguration = apierrors.InternalError.WithReason("InvalidConfiguration")
View Source
var OAuthError = apierrors.BadRequest.WithReason("OAuthError")
View Source
var OAuthProtocolError = apierrors.BadRequest.WithReason("OAuthProtocolError")

Functions

func Email_AssumeVerified_NOT_Required

func Email_AssumeVerified_NOT_Required() oauthrelyingparty.ProviderClaimConfig

func Email_AssumeVerified_Required

func Email_AssumeVerified_Required() oauthrelyingparty.ProviderClaimConfig

func FetchUserProfile

func FetchUserProfile(
	ctx context.Context,
	client *http.Client,
	accessTokenResp AccessTokenResp,
	userProfileURL string,
) (userProfile map[string]interface{}, err error)

func GetCode

func GetCode(query string) (code string, err error)

func MakeAuthorizationURL

func MakeAuthorizationURL(base string, query url.Values) string

func NewOAuthError

func NewOAuthError(errResp *oauthrelyingparty.ErrorResponse) error

Types

type AccessTokenResp

type AccessTokenResp map[string]interface{}

func FetchAccessTokenResp

func FetchAccessTokenResp(
	ctx context.Context,
	client *http.Client,
	code string,
	accessTokenURL string,
	redirectURL string,
	clientID string,
	clientSecret string,
) (r AccessTokenResp, err error)

func NewBearerAccessTokenResp

func NewBearerAccessTokenResp(accessToken string) AccessTokenResp

func (AccessTokenResp) AccessToken

func (r AccessTokenResp) AccessToken() string

func (AccessTokenResp) ExpiresIn

func (r AccessTokenResp) ExpiresIn() int

func (AccessTokenResp) IDToken

func (r AccessTokenResp) IDToken() string

func (AccessTokenResp) TokenType

func (r AccessTokenResp) TokenType() string

type AuthorizationURLParams

type AuthorizationURLParams struct {
	ClientID     string
	RedirectURI  string
	Scope        []string
	ResponseType string
	ResponseMode string
	State        string
	Prompt       []string
	Nonce        string

	WechatAppID string
}

func (AuthorizationURLParams) Query

func (p AuthorizationURLParams) Query() url.Values

type OIDCDiscoveryDocument

type OIDCDiscoveryDocument struct {
	Issuer                string `json:"issuer"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	UserInfoEndpoint      string `json:"userinfo_endpoint"`
	JWKSUri               string `json:"jwks_uri"`
}

func FetchOIDCDiscoveryDocument

func FetchOIDCDiscoveryDocument(ctx context.Context, client *http.Client, endpoint string) (*OIDCDiscoveryDocument, error)

func (*OIDCDiscoveryDocument) ExchangeCode

func (d *OIDCDiscoveryDocument) ExchangeCode(
	ctx context.Context,
	client *http.Client,
	clock oauthrelyingparty.Clock,
	code string,
	jwks jwk.Set,
	clientID string,
	clientSecret string,
	redirectURI string,
	nonce string,
	tokenResp *AccessTokenResp,
) (jwt.Token, error)

func (*OIDCDiscoveryDocument) FetchJWKs

func (d *OIDCDiscoveryDocument) FetchJWKs(ctx context.Context, client *http.Client) (jwk.Set, error)

func (*OIDCDiscoveryDocument) FetchUserInfo

func (d *OIDCDiscoveryDocument) FetchUserInfo(ctx context.Context, client *http.Client, accessTokenResp AccessTokenResp) (userInfo map[string]interface{}, err error)

func (*OIDCDiscoveryDocument) MakeOAuthURL

func (d *OIDCDiscoveryDocument) MakeOAuthURL(params AuthorizationURLParams) string

Jump to

Keyboard shortcuts

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