| 1 |
package oidc |
| 2 |
|
| 3 |
const ( |
| 4 |
DiscoveryEndpoint = "/.well-known/openid-configuration" |
| 5 |
) |
| 6 |
|
| 7 |
type DiscoveryConfiguration struct { |
| 8 |
// Issuer is the identifier of the OP and is used in the tokens as `iss` claim. |
| 9 |
Issuer string `json:"issuer,omitempty"` |
| 10 |
|
| 11 |
// AuthorizationEndpoint is the URL of the OAuth 2.0 Authorization Endpoint where all user interactive login start |
| 12 |
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"` |
| 13 |
|
| 14 |
// TokenEndpoint is the URL of the OAuth 2.0 Token Endpoint where all tokens are issued, except when using Implicit Flow |
| 15 |
TokenEndpoint string `json:"token_endpoint,omitempty"` |
| 16 |
|
| 17 |
// IntrospectionEndpoint is the URL of the OAuth 2.0 Introspection Endpoint. |
| 18 |
IntrospectionEndpoint string `json:"introspection_endpoint,omitempty"` |
| 19 |
|
| 20 |
// UserinfoEndpoint is the URL where an access_token can be used to retrieve the Userinfo. |
| 21 |
UserinfoEndpoint string `json:"userinfo_endpoint,omitempty"` |
| 22 |
|
| 23 |
// RevocationEndpoint is the URL of the OAuth 2.0 Revocation Endpoint. |
| 24 |
RevocationEndpoint string `json:"revocation_endpoint,omitempty"` |
| 25 |
|
| 26 |
// EndSessionEndpoint is a URL where the RP can perform a redirect to request that the End-User be logged out at the OP. |
| 27 |
EndSessionEndpoint string `json:"end_session_endpoint,omitempty"` |
| 28 |
|
| 29 |
DeviceAuthorizationEndpoint string `json:"device_authorization_endpoint,omitempty"` |
| 30 |
|
| 31 |
// CheckSessionIframe is a URL where the OP provides an iframe that support cross-origin communications for session state information with the RP Client. |
| 32 |
CheckSessionIframe string `json:"check_session_iframe,omitempty"` |
| 33 |
|
| 34 |
// JwksURI is the URL of the JSON Web Key Set. This site contains the signing keys that RPs can use to validate the signature. |
| 35 |
// It may also contain the OP's encryption keys that RPs can use to encrypt request to the OP. |
| 36 |
JwksURI string `json:"jwks_uri,omitempty"` |
| 37 |
|
| 38 |
// RegistrationEndpoint is the URL for the Dynamic Client Registration. |
| 39 |
RegistrationEndpoint string `json:"registration_endpoint,omitempty"` |
| 40 |
|
| 41 |
// ClientIDMetadataDocumentSupported indicates whether the OP can resolve a client_id that is an |
| 42 |
// HTTPS URL pointing to a client metadata document, per the OAuth Client ID Metadata Document spec. |
| 43 |
ClientIDMetadataDocumentSupported bool `json:"client_id_metadata_document_supported,omitempty"` |
| 44 |
|
| 45 |
// ScopesSupported lists an array of supported scopes. This list must not include every supported scope by the OP. |
| 46 |
ScopesSupported []string `json:"scopes_supported,omitempty"` |
| 47 |
|
| 48 |
// ResponseTypesSupported contains a list of the OAuth 2.0 response_type values that the OP supports (code, id_token, token id_token, ...). |
| 49 |
ResponseTypesSupported []string `json:"response_types_supported,omitempty"` |
| 50 |
|
| 51 |
// ResponseModesSupported contains a list of the OAuth 2.0 response_mode values that the OP supports. If omitted, the default value is ["query", "fragment"]. |
| 52 |
ResponseModesSupported []string `json:"response_modes_supported,omitempty"` |
| 53 |
|
| 54 |
// GrantTypesSupported contains a list of the OAuth 2.0 grant_type values that the OP supports. If omitted, the default value is ["authorization_code", "implicit"]. |
| 55 |
GrantTypesSupported []GrantType `json:"grant_types_supported,omitempty"` |
| 56 |
|
| 57 |
// ACRValuesSupported contains a list of Authentication Context Class References that the OP supports. |
| 58 |
ACRValuesSupported []string `json:"acr_values_supported,omitempty"` |
| 59 |
|
| 60 |
// SubjectTypesSupported contains a list of Subject Identifier types that the OP supports (pairwise, public). |
| 61 |
SubjectTypesSupported []string `json:"subject_types_supported,omitempty"` |
| 62 |
|
| 63 |
// IDTokenSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the OP for the ID Token. |
| 64 |
IDTokenSigningAlgValuesSupported []string `json:"id_token_signing_alg_values_supported,omitempty"` |
| 65 |
|
| 66 |
// IDTokenEncryptionAlgValuesSupported contains a list of JWE encryption algorithms (alg values) supported by the OP for the ID Token. |
| 67 |
IDTokenEncryptionAlgValuesSupported []string `json:"id_token_encryption_alg_values_supported,omitempty"` |
| 68 |
|
| 69 |
// IDTokenEncryptionEncValuesSupported contains a list of JWE encryption algorithms (enc values) supported by the OP for the ID Token. |
| 70 |
IDTokenEncryptionEncValuesSupported []string `json:"id_token_encryption_enc_values_supported,omitempty"` |
| 71 |
|
| 72 |
// UserinfoSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the OP for UserInfo Endpoint. |
| 73 |
UserinfoSigningAlgValuesSupported []string `json:"userinfo_signing_alg_values_supported,omitempty"` |
| 74 |
|
| 75 |
// UserinfoEncryptionAlgValuesSupported contains a list of JWE encryption algorithms (alg values) supported by the OP for the UserInfo Endpoint. |
| 76 |
UserinfoEncryptionAlgValuesSupported []string `json:"userinfo_encryption_alg_values_supported,omitempty"` |
| 77 |
|
| 78 |
// UserinfoEncryptionEncValuesSupported contains a list of JWE encryption algorithms (enc values) supported by the OP for the UserInfo Endpoint. |
| 79 |
UserinfoEncryptionEncValuesSupported []string `json:"userinfo_encryption_enc_values_supported,omitempty"` |
| 80 |
|
| 81 |
// RequestObjectSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the OP for Request Objects. |
| 82 |
// These algorithms are used both then the Request Object is passed by value (using the request parameter) and when it is passed by reference (using the request_uri parameter). |
| 83 |
RequestObjectSigningAlgValuesSupported []string `json:"request_object_signing_alg_values_supported,omitempty"` |
| 84 |
|
| 85 |
// RequestObjectEncryptionAlgValuesSupported contains a list of JWE encryption algorithms (alg values) supported by the OP for Request Objects. |
| 86 |
// These algorithms are used both when the Request Object is passed by value and by reference. |
| 87 |
RequestObjectEncryptionAlgValuesSupported []string `json:"request_object_encryption_alg_values_supported,omitempty"` |
| 88 |
|
| 89 |
// RequestObjectEncryptionEncValuesSupported contains a list of JWE encryption algorithms (enc values) supported by the OP for Request Objects. |
| 90 |
// These algorithms are used both when the Request Object is passed by value and by reference. |
| 91 |
RequestObjectEncryptionEncValuesSupported []string `json:"request_object_encryption_enc_values_supported,omitempty"` |
| 92 |
|
| 93 |
// TokenEndpointAuthMethodsSupported contains a list of Client Authentication methods supported by the Token Endpoint. If omitted, the default is client_secret_basic. |
| 94 |
TokenEndpointAuthMethodsSupported []AuthMethod `json:"token_endpoint_auth_methods_supported,omitempty"` |
| 95 |
|
| 96 |
// TokenEndpointAuthSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the Token Endpoint |
| 97 |
// for the signature of the JWT used to authenticate the Client by private_key_jwt and client_secret_jwt. |
| 98 |
TokenEndpointAuthSigningAlgValuesSupported []string `json:"token_endpoint_auth_signing_alg_values_supported,omitempty"` |
| 99 |
|
| 100 |
// RevocationEndpointAuthMethodsSupported contains a list of Client Authentication methods supported by the Revocation Endpoint. If omitted, the default is client_secret_basic. |
| 101 |
RevocationEndpointAuthMethodsSupported []AuthMethod `json:"revocation_endpoint_auth_methods_supported,omitempty"` |
| 102 |
|
| 103 |
// RevocationEndpointAuthSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the Revocation Endpoint |
| 104 |
// for the signature of the JWT used to authenticate the Client by private_key_jwt and client_secret_jwt. |
| 105 |
RevocationEndpointAuthSigningAlgValuesSupported []string `json:"revocation_endpoint_auth_signing_alg_values_supported,omitempty"` |
| 106 |
|
| 107 |
// IntrospectionEndpointAuthMethodsSupported contains a list of Client Authentication methods supported by the Introspection Endpoint. |
| 108 |
IntrospectionEndpointAuthMethodsSupported []AuthMethod `json:"introspection_endpoint_auth_methods_supported,omitempty"` |
| 109 |
|
| 110 |
// IntrospectionEndpointAuthSigningAlgValuesSupported contains a list of JWS signing algorithms (alg values) supported by the Revocation Endpoint |
| 111 |
// for the signature of the JWT used to authenticate the Client by private_key_jwt and client_secret_jwt. |
| 112 |
IntrospectionEndpointAuthSigningAlgValuesSupported []string `json:"introspection_endpoint_auth_signing_alg_values_supported,omitempty"` |
| 113 |
|
| 114 |
// DisplayValuesSupported contains a list of display parameter values that the OP supports (page, popup, touch, wap). |
| 115 |
DisplayValuesSupported []Display `json:"display_values_supported,omitempty"` |
| 116 |
|
| 117 |
// ClaimTypesSupported contains a list of Claim Types that the OP supports (normal, aggregated, distributed). If omitted, the default is normal Claims. |
| 118 |
ClaimTypesSupported []string `json:"claim_types_supported,omitempty"` |
| 119 |
|
| 120 |
// ClaimsSupported contains a list of Claim Names the OP may be able to supply values for. This list might not be exhaustive. |
| 121 |
ClaimsSupported []string `json:"claims_supported,omitempty"` |
| 122 |
|
| 123 |
// ClaimsParameterSupported specifies whether the OP supports use of the `claims` parameter. If omitted, the default is false. |
| 124 |
ClaimsParameterSupported bool `json:"claims_parameter_supported,omitempty"` |
| 125 |
|
| 126 |
// CodeChallengeMethodsSupported contains a list of Proof Key for Code Exchange (PKCE) code challenge methods supported by the OP. |
| 127 |
CodeChallengeMethodsSupported []CodeChallengeMethod `json:"code_challenge_methods_supported,omitempty"` |
| 128 |
|
| 129 |
// ServiceDocumentation is a URL where developers can get information about the OP and its usage. |
| 130 |
ServiceDocumentation string `json:"service_documentation,omitempty"` |
| 131 |
|
| 132 |
// ClaimsLocalesSupported contains a list of BCP47 language tag values that the OP supports for values of Claims returned. |
| 133 |
ClaimsLocalesSupported Locales `json:"claims_locales_supported,omitempty"` |
| 134 |
|
| 135 |
// UILocalesSupported contains a list of BCP47 language tag values that the OP supports for the user interface. |
| 136 |
UILocalesSupported Locales `json:"ui_locales_supported,omitempty"` |
| 137 |
|
| 138 |
// RequestParameterSupported specifies whether the OP supports use of the `request` parameter. If omitted, the default value is false. |
| 139 |
RequestParameterSupported bool `json:"request_parameter_supported,omitempty"` |
| 140 |
|
| 141 |
// RequestURIParameterSupported specifies whether the OP supports use of the `request_uri` parameter. If omitted, the default value is true. (therefore no omitempty) |
| 142 |
RequestURIParameterSupported bool `json:"request_uri_parameter_supported"` |
| 143 |
|
| 144 |
// RequireRequestURIRegistration specifies whether the OP requires any `request_uri` to be pre-registered using the request_uris registration parameter. If omitted, the default value is false. |
| 145 |
RequireRequestURIRegistration bool `json:"require_request_uri_registration,omitempty"` |
| 146 |
|
| 147 |
// OPPolicyURI is a URL the OP provides to the person registering the Client to read about the OP's requirements on how the RP can use the data provided by the OP. |
| 148 |
OPPolicyURI string `json:"op_policy_uri,omitempty"` |
| 149 |
|
| 150 |
// OPTermsOfServiceURI is a URL the OpenID Provider provides to the person registering the Client to read about OpenID Provider's terms of service. |
| 151 |
OPTermsOfServiceURI string `json:"op_tos_uri,omitempty"` |
| 152 |
|
| 153 |
// BackChannelLogoutSupported specifies whether the OP supports back-channel logout (https://openid.net/specs/openid-connect-backchannel-1_0.html), |
| 154 |
// with true indicating support. If omitted, the default value is false. |
| 155 |
BackChannelLogoutSupported bool `json:"backchannel_logout_supported,omitempty"` |
| 156 |
|
| 157 |
// BackChannelLogoutSessionSupported specifies whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP. |
| 158 |
// If supported, the sid Claim is also included in ID Tokens issued by the OP. If omitted, the default value is false. |
| 159 |
BackChannelLogoutSessionSupported bool `json:"backchannel_logout_session_supported,omitempty"` |
| 160 |
} |
| 161 |
|
| 162 |
type AuthMethod string |
| 163 |
|
| 164 |
const ( |
| 165 |
AuthMethodBasic AuthMethod = "client_secret_basic" |
| 166 |
AuthMethodPost AuthMethod = "client_secret_post" |
| 167 |
AuthMethodNone AuthMethod = "none" |
| 168 |
AuthMethodPrivateKeyJWT AuthMethod = "private_key_jwt" |
| 169 |
) |
| 170 |
|
| 171 |
var AllAuthMethods = []AuthMethod{ |
| 172 |
AuthMethodBasic, AuthMethodPost, AuthMethodNone, AuthMethodPrivateKeyJWT, |
| 173 |
} |