oidf

package module
v0.0.0-...-95977df Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: EUPL-1.2 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddApiKeyTransport

func AddApiKeyTransport(t http.RoundTripper) http.RoundTripper

Types

type CodeChallengeMethod

type CodeChallengeMethod string
const (
	CodeChallengeMethodS256 CodeChallengeMethod = "S256"
)

type EntityStatement

type EntityStatement struct {
	ExpiresAt      int64     `json:"exp"`
	IssuedAt       int64     `json:"iat"`
	Issuer         string    `json:"iss"`
	Subject        string    `json:"sub"`
	AuthorityHints []string  `json:"authority_hints"`
	Jwks           *Jwks     `json:"jwks"`
	Metadata       *Metadata `json:"metadata"`
}

type Error

type Error struct {
	Operation        string `json:"operation"`
	ErrorCode        string `json:"error"`
	Description      string `json:"error_description"`
	GematikTimestamp int64  `json:"gematik_timestamp,omitempty"`
	GematikUUID      string `json:"gematik_uuid,omitempty"`
	GematikCode      string `json:"gematik_code,omitempty"`
	// Some IDPs return description in camelCase instead of snake_case
	BadDescription string `json:"errorDescription,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

type FederationEntityMetadata

type FederationEntityMetadata struct {
	Name                    string   `json:"name,omitempty"`
	Contacts                []string `json:"contacts,omitempty"`
	HomepageURI             string   `json:"homepage_uri,omitempty"`
	FederationFetchEndpoint string   `json:"federation_fetch_endpoint,omitempty"`
	FederationListEndpoint  string   `json:"federation_list_endpoint,omitempty"`
	IdpListEndpoint         string   `json:"idp_list_endpoint,omitempty"`
}

type IdentityProviderInfo

type IdentityProviderInfo struct {
	Issuer           string   `json:"iss"`
	LogoURI          string   `json:"logo_uri"`
	OrganizationName string   `json:"organization_name"`
	IsPkv            bool     `json:"pkv"`
	UserType         UserType `json:"user_type_supported"`
}

type Jwk

type Jwk struct {
	Key jwk.Key
}

small trick to make jwk.Key JSON-serializable

func NewJwkFromJson

func NewJwkFromJson(data string) (*Jwk, error)

func (*Jwk) AsSet

func (j *Jwk) AsSet() *Jwks

func (*Jwk) MarshalJSON

func (j *Jwk) MarshalJSON() ([]byte, error)

func (*Jwk) UnmarshalJSON

func (j *Jwk) UnmarshalJSON(data []byte) error

func (*Jwk) UnmarshalYAML

func (j *Jwk) UnmarshalYAML(unmarshal func(interface{}) error) error

type Jwks

type Jwks struct {
	Keys jwk.Set
}

small trick to make jwk.Set JSON-serializable

func (*Jwks) MarshalJSON

func (j *Jwks) MarshalJSON() ([]byte, error)

func (*Jwks) UnmarshalJSON

func (j *Jwks) UnmarshalJSON(data []byte) error

type Metadata

type Metadata struct {
	OpenidRelyingParty *OpenIDRelyingPartyMetadata `json:"openid_relying_party,omitempty"`
	OpenidProvider     *OpenIDProviderMetadata     `json:"openid_provider,omitempty"`
	FederationEntity   *FederationEntityMetadata   `json:"federation_entity"`
}

type OpenIDProviderMetadata

type OpenIDProviderMetadata struct {
	AuthorizationEndpoint                 string   `json:"authorization_endpoint"`
	ClientRegistrationTypesSupported      []string `json:"client_registration_types_supported"`
	GrantTypesSupported                   []string `json:"grant_types_supported"`
	IDTokenEncryptionAlgValuesSupported   []string `json:"id_token_encryption_alg_values_supported"`
	IDTokenEncryptionEncValuesSupported   []string `json:"id_token_encryption_enc_values_supported"`
	IDTokenSigningAlgValuesSupported      []string `json:"id_token_signing_alg_values_supported"`
	Issuer                                string   `json:"issuer"`
	LogoURI                               string   `json:"logo_uri"`
	OrganizationName                      string   `json:"organization_name"`
	PushedAuthorizationRequestEndpoint    string   `json:"pushed_authorization_request_endpoint"`
	RequestAuthenticationMethodsSupported struct {
		Ar  []string `json:"ar"`
		Par []string `json:"par"`
	} `json:"request_authentication_methods_supported"`
	RequirePushedAuthorizationRequests         bool       `json:"require_pushed_authorization_requests"`
	ResponseModesSupported                     []string   `json:"response_modes_supported"`
	ResponseTypesSupported                     []string   `json:"response_types_supported"`
	ScopesSupported                            []string   `json:"scopes_supported"`
	SignedJwksUri                              string     `json:"signed_jwks_uri"`
	SubjectTypesSupported                      []string   `json:"subject_types_supported"`
	TokenEndpoint                              string     `json:"token_endpoint"`
	TokenEndpointAuthMethodsSupported          []string   `json:"token_endpoint_auth_methods_supported"`
	TokenEndpointAuthSigningAlgValuesSupported []string   `json:"token_endpoint_auth_signing_alg_values_supported"`
	UserTypeSupported                          []UserType `json:"user_type_supported"`
}

type OpenIDRelyingPartyMetadata

type OpenIDRelyingPartyMetadata struct {
	SignedJwksUri                      string   `json:"signed_jwks_uri,omitempty"`
	Jwks                               *Jwks    `json:"jwks"`
	OrganizationName                   string   `json:"organization_name"`
	ClientName                         string   `json:"client_name"`
	LogoURI                            string   `json:"logo_uri"`
	RedirectURIs                       []string `json:"redirect_uris"`
	ResponseTypes                      []string `json:"response_types"`
	ClientRegistrationTypes            []string `json:"client_registration_types"`
	GrantTypes                         []string `json:"grant_types"`
	RequirePushedAuthorizationRequests bool     `json:"require_pushed_authorization_requests"`
	TokenEndpointAuthMethod            string   `json:"token_endpoint_auth_method"`
	DefaultACRValues                   []string `json:"default_acr_values"`
	IDTokenSignedResponseAlg           string   `json:"id_token_signed_response_alg"`
	IDTokenEncryptedResponseAlg        string   `json:"id_token_encrypted_response_alg"`
	IDTokenEncryptedResponseEnc        string   `json:"id_token_encrypted_response_enc"`
	Scope                              string   `json:"scope"`
}

type OpenidFederation

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

func NewOpenidFederation

func NewOpenidFederation(fedMasterURL string, jwks jwk.Set) (*OpenidFederation, error)

func (*OpenidFederation) FederationMasterURL

func (f *OpenidFederation) FederationMasterURL() string

func (*OpenidFederation) FetchEntityStatement

func (f *OpenidFederation) FetchEntityStatement(iss string) (*EntityStatement, error)

fetches and verifies the entity statement for the given issuer

func (*OpenidFederation) FetchIdpList

func (f *OpenidFederation) FetchIdpList() ([]IdentityProviderInfo, error)

func (*OpenidFederation) FetchSignedJwks

func (f *OpenidFederation) FetchSignedJwks(op *EntityStatement) (jwk.Set, error)

type OpenidProvider

type OpenidProvider struct {
	Issuer string
}

type RelyingParty

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

func NewRelyingPartyFromConfig

func NewRelyingPartyFromConfig(cfg *RelyingPartyConfig) (*RelyingParty, error)

func NewRelyingPartyFromConfigFile

func NewRelyingPartyFromConfigFile(path string) (*RelyingParty, error)

func (*RelyingParty) ClientID

func (rp *RelyingParty) ClientID() string

func (*RelyingParty) Federation

func (rp *RelyingParty) Federation() *OpenidFederation

func (*RelyingParty) NewClient

func (rp *RelyingParty) NewClient(issuer string) (oidc.Client, error)

func (*RelyingParty) Serve

func (rp *RelyingParty) Serve(w http.ResponseWriter, r *http.Request)

func (*RelyingParty) ServeSignedJwks

func (rp *RelyingParty) ServeSignedJwks(w http.ResponseWriter, r *http.Request)

func (*RelyingParty) SignEntityStatement

func (rp *RelyingParty) SignEntityStatement() ([]byte, error)

type RelyingPartyClient

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

func (*RelyingPartyClient) AuthenticationURL

func (c *RelyingPartyClient) AuthenticationURL(state, nonce, verifier string, options ...oidc.Option) (string, error)

func (*RelyingPartyClient) ClientID

func (c *RelyingPartyClient) ClientID() string

func (*RelyingPartyClient) ExchangeForIdentity

func (c *RelyingPartyClient) ExchangeForIdentity(code, verifier string, options ...oidc.Option) (*oidc.TokenResponse, error)

func (*RelyingPartyClient) Issuer

func (c *RelyingPartyClient) Issuer() string

func (*RelyingPartyClient) LogoURI

func (c *RelyingPartyClient) LogoURI() string

func (*RelyingPartyClient) Name

func (c *RelyingPartyClient) Name() string

func (*RelyingPartyClient) RedirectURI

func (c *RelyingPartyClient) RedirectURI() string

type RelyingPartyConfig

type RelyingPartyConfig struct {
	BaseDir              string                 `yaml:"-"`
	Subject              string                 `yaml:"sub" validate:"required"`
	FedMasterURL         string                 `yaml:"fed_master_url" validate:"required"`
	FedMasterJwk         Jwk                    `yaml:"fed_master_jwk" validate:"required"`
	SignKid              string                 `yaml:"sign_kid" validate:"required"`
	SignPrivateKeyPath   string                 `yaml:"sign_private_key_path" validate:"required"`
	EncKid               string                 `yaml:"enc_kid" validate:"required"`
	EncPrivateKeyPath    string                 `yaml:"enc_private_key_path" validate:"required"`
	ClientKid            string                 `yaml:"client_kid" validate:"required"`
	ClientPrivateKeyPath string                 `yaml:"client_private_key_path" validate:"required"`
	ClientCertPath       string                 `yaml:"client_cert_path" validate:"required"`
	MetadataTemplate     map[string]interface{} `yaml:"metadata_template" validate:"required"`
}

func LoadRelyingPartyConfig

func LoadRelyingPartyConfig(path string) (*RelyingPartyConfig, error)

type UserType

type UserType string
const (
	UserTypeIP  UserType = "IP"  // Insured Person
	UserTypeHP  UserType = "HP"  // Health Professional
	UserTypeHCI UserType = "HCI" // Health Care Institution
)

Jump to

Keyboard shortcuts

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