oidc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 10 Imported by: 2

Documentation

Overview

Package oidc provides OpenID Connect clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client a client for fetching the OpenID Provider configuration.

func NewClient

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

NewClient returns a new client.

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (*Config, error)

GetConfig get the OpenID Provider configuration from the issuer.

func (*Client) GetJWKS

func (c *Client) GetJWKS(ctx context.Context) (*jwk.Set, error)

GetJWKS gets JWKS (JSON Web Key Set). GetJWKS uses the OpenID Provider configuration for getting the url of JWKS.

func (*Client) GetJWKSFromURL

func (c *Client) GetJWKSFromURL(ctx context.Context, url string) (*jwk.Set, error)

GetJWKSFromURL gets JWKS (JSON Web Key Set) from url.

type ClientConfig

type ClientConfig struct {
	// Doer is used for http requests.
	// If it nil, http.DefaultClient is used.
	Doer Doer

	// UserAgent is the value of User-Agent header in http requests.
	// If it is empty string, "https://github.com/shogo82148/goat" is used.
	UserAgent string

	// Issuer is the issuer.
	Issuer string
}

ClientConfig is configure for client.

type Config

type Config struct {
	Issuer                                     string                       `json:"issuer,omitempty"`
	AuthorizationEndpoint                      string                       `json:"authorization_endpoint,omitempty"`
	TokenEndpoint                              string                       `json:"token_endpoint,omitempty"`
	UserinfoEndpoint                           string                       `json:"userinfo_endpoint,omitempty"`
	JWKSURI                                    string                       `json:"jwks_uri,omitempty"`
	RegistrationEndpoint                       string                       `json:"registration_endpoint,omitempty"`
	ScopesSupported                            []string                     `json:"scopes_supported,omitempty"`
	ResponseTypesSupported                     []string                     `json:"response_types_supported,omitempty"`
	GrantTypesSupported                        []string                     `json:"grant_types_supported,omitempty"`
	ACRValuesSupported                         []string                     `json:"acr_values_supported,omitempty"`
	SubjectTypesSupported                      []string                     `json:"subject_types_supported,omitempty"`
	IDTokenSigningAlgValuesSupported           []jwa.SignatureAlgorithm     `json:"id_token_signing_alg_values_supported,omitempty"`
	IDTokenEncryptionAlgValuesSupported        []jwa.KeyManagementAlgorithm `json:"id_token_encryption_alg_values_supported,omitempty"`
	IDTokenEncryptionEncValuesSupported        []jwa.EncryptionAlgorithm    `json:"id_token_encryption_enc_values_supported,omitempty"`
	UserinfoSigningAlgValuesSupported          []jwa.SignatureAlgorithm     `json:"userinfo_signing_alg_values_supported,omitempty"`
	UserinfoEncryptionAlgValuesSupported       []jwa.KeyManagementAlgorithm `json:"userinfo_encryption_alg_values_supported,omitempty"`
	UserinfoEncryptionEncValuesSupported       []jwa.EncryptionAlgorithm    `json:"userinfo_encryption_enc_values_supported,omitempty"`
	RequestObjectSigningAlgValuesSupported     []jwa.SignatureAlgorithm     `json:"request_object_signing_alg_values_supported,omitempty"`
	RequestObjectEncryptionAlgValuesSupported  []jwa.KeyManagementAlgorithm `json:"request_object_encryption_alg_values_supported,omitempty"`
	RequestObjectEncryptionEncValuesSupported  []jwa.SignatureAlgorithm     `json:"request_object_encryption_enc_values_supported,omitempty"`
	TokenEndpointAuthMethodsSupported          []string                     `json:"token_endpoint_auth_methods_supported,omitempty"`
	TokenEndpointAuthSigningAlgValuesSupported []string                     `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"`
	DisplayValuesSupported                     []string                     `json:"display_values_supported,omitempty"`
	ClaimTypesSupported                        []string                     `json:"claim_types_supported,omitempty"`
	ClaimsSupported                            []string                     `json:"claims_supported,omitempty"`
	ServiceDocumentation                       string                       `json:"service_documentation,omitempty"`
	ClaimsLocalesSupported                     []string                     `json:"claims_locales_supported,omitempty"`
	UILocalesSupported                         []string                     `json:"ui_locales_supported,omitempty"`
	ClaimsParameterSupported                   bool                         `json:"claims_parameter_supported,omitempty"`
	RequestParameterSupported                  bool                         `json:"request_parameter_supported,omitempty"`
	RequestURIParameterSupported               bool                         `json:"request_uri_parameter_supported,omitempty"`
	RequireRequestURIRegistration              bool                         `json:"require_request_uri_registration,omitempty"`
	OPPolicyURI                                string                       `json:"op_policy_uri,omitempty"`
	OPTOSURI                                   string                       `json:"op_tos_uri,omitempty"`
}

Config is OpenID Provider Metadata defined in OpenID Connect Discovery 1.0.

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer is a interface for doing an http request, such as http.Client.

Jump to

Keyboard shortcuts

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