oidc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.2.0

type Client struct {
	Config   *Configuration
	Keystore *Keystore
	// contains filtered or unexported fields
}

Cient of an OIDC issuer

func NewOIDCClient added in v1.2.0

func NewOIDCClient(issuer, client_id, client_secret string) (*Client, error)

NewOIDCClient create OpenID client from auto-discovery issuer endpoint

func (*Client) Introspect added in v1.2.0

func (c *Client) Introspect(token string) (*IntrospectionResponse, error)

Introspect call token introspection endpoint

func (*Client) UserInfo added in v1.2.0

func (c *Client) UserInfo(token string) (*UserInfoResponse, error)

UserInfo call UserInfo endpoint

type Configuration

type Configuration struct {
	Issuer                            string   `json:"issuer"`
	JwksURI                           string   `json:"jwks_uri"`
	AuthorizationEndpoint             string   `json:"authorization_endpoint"`
	TokenEndpoint                     string   `json:"token_endpoint"`
	UserinfoEndpoint                  string   `json:"userinfo_endpoint"`
	EndSessionEndpoint                string   `json:"end_session_endpoint"`
	RevocationEndpoint                string   `json:"revocation_endpoint"`
	IntrospectionEndpoint             string   `json:"introspection_endpoint"`
	BackchannelLogoutSupported        bool     `json:"backchannel_logout_supported"`
	BackchannelLogoutSessionSupported bool     `json:"backchannel_logout_session_supported"`
	ScopesSupported                   []string `json:"scopes_supported"`
	ClaimsSupported                   []string `json:"claims_supported"`
	GrantTypesSupported               []string `json:"grant_types_supported"`
	ResponseTypesSupported            []string `json:"response_types_supported"`
	ResponseModesSupported            []string `json:"response_modes_supported"`
	TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
	SubjectTypesSupported             []string `json:"subject_types_supported"`
	CodeChallengeMethodsSupported     []string `json:"code_challenge_methods_supported"`
}

Configuration is the result from an OIDC discovery endpoint

type ErrorResponse added in v1.2.0

type ErrorResponse struct {
	Error       string `json:"error"`
	Description string `json:"error_description"`
}

ErrorResponse JSON error response

type IntrospectionResponse added in v1.2.0

type IntrospectionResponse struct {
	Sub               string `json:"sub"`
	Active            bool   `json:"active"`
	Username          string `json:"username"`
	PreferredUsername string `json:"preferred_username"`
}

IntrospectionResponse JSON introspection response

type JSONWebKey

type JSONWebKey struct {
	Kty string   `json:"kty"`
	Alg string   `json:"alg"`
	Kid string   `json:"kid"`
	Use string   `json:"use"`
	N   string   `json:"n"`
	E   string   `json:"e"`
	X5c []string `json:"x5c"`
}

JSONWebKey JSON web key

type JSONWebKeySet

type JSONWebKeySet struct {
	Keys []JSONWebKey `json:"keys"`
}

JSONWebKeySet JSON web key set

type Keystore

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

Keystore OIDC keystore

func NewOIDCKeystore

func NewOIDCKeystore(conf *Configuration) (*Keystore, error)

NewOIDCKeystore create a new OIDC keystore

func (*Keystore) GetKey

func (k *Keystore) GetKey(id string) (*rsa.PublicKey, error)

GetKey retrieve a key from the keystore

type UserInfoResponse added in v1.2.0

type UserInfoResponse struct {
	Sub               string `json:"sub"`
	Email             string `json:"email"`
	PreferredUsername string `json:"preferred_username"`
}

UserInfoResponse JSON user info response

Jump to

Keyboard shortcuts

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