diff --git a/cmd/cmd_create_jwks.go b/cmd/cmd_create_jwks.go index fa304734030..d0f98ee63bf 100644 --- a/cmd/cmd_create_jwks.go +++ b/cmd/cmd_create_jwks.go @@ -54,7 +54,7 @@ func NewCreateJWKSCmd() *cobra.Command { } //nolint:bodyclose - jwks, _, err := m.V0alpha2Api.AdminCreateJsonWebKeySet(context.Background(), args[0]).AdminCreateJsonWebKeySetBody(hydra.AdminCreateJsonWebKeySetBody{ + jwks, _, err := m.JwkApi.CreateJsonWebKeySet(context.Background(), args[0]).CreateJsonWebKeySet(hydra.CreateJsonWebKeySet{ Alg: flagx.MustGetString(cmd, alg), Kid: kid, Use: flagx.MustGetString(cmd, use), diff --git a/cmd/cmd_delete_jwks.go b/cmd/cmd_delete_jwks.go index d5073310d34..deddb16a814 100644 --- a/cmd/cmd_delete_jwks.go +++ b/cmd/cmd_delete_jwks.go @@ -49,7 +49,7 @@ func NewDeleteJWKSCommand() *cobra.Command { ) for _, c := range args { - _, err = m.V0alpha2Api.AdminDeleteJsonWebKeySet(context.Background(), c).Execute() //nolint:bodyclose + _, err = m.JwkApi.DeleteJsonWebKeySet(context.Background(), c).Execute() //nolint:bodyclose if err != nil { return cmdx.PrintOpenAPIError(cmd, err) } diff --git a/cmd/cmd_get_jwks.go b/cmd/cmd_get_jwks.go index d8d899b5207..67d57935bb6 100644 --- a/cmd/cmd_get_jwks.go +++ b/cmd/cmd_get_jwks.go @@ -45,7 +45,7 @@ func NewGetJWKSCmd() *cobra.Command { var sets outputJSONWebKeyCollection for _, set := range args { - key, _, err := m.V0alpha2Api.AdminGetJsonWebKeySet(cmd.Context(), set).Execute() //nolint:bodyclose + key, _, err := m.JwkApi.GetJsonWebKeySet(cmd.Context(), set).Execute() //nolint:bodyclose if err != nil { return cmdx.PrintOpenAPIError(cmd, err) } diff --git a/cmd/cmd_import_jwk.go b/cmd/cmd_import_jwk.go index 3d21a4ad86c..10d5c155cf9 100644 --- a/cmd/cmd_import_jwk.go +++ b/cmd/cmd_import_jwk.go @@ -125,7 +125,7 @@ the imported keys will be added to that set. Otherwise, a new set will be create failed := make(map[string]error) for src, kk := range keys { for _, k := range kk { - result, _, err := m.V0alpha2Api.AdminUpdateJsonWebKey(cmd.Context(), k.Kid, set).JsonWebKey(k).Execute() //nolint:bodyclose + result, _, err := m.JwkApi.SetJsonWebKey(cmd.Context(), k.Kid, set).JsonWebKey(k).Execute() //nolint:bodyclose if err != nil { failed[src] = cmdx.PrintOpenAPIError(cmd, err) continue diff --git a/consent/handler.go b/consent/handler.go index ed6ce4939aa..4490e019811 100644 --- a/consent/handler.go +++ b/consent/handler.go @@ -271,7 +271,7 @@ func (h *Handler) revokeOAuth2LoginSessions(w http.ResponseWriter, r *http.Reque w.WriteHeader(http.StatusNoContent) } -// Get OAuth 2.0 Login Request Parameters +// Get OAuth 2.0 Login Request // // swagger:parameters getOAuth2LoginRequest type getOAuth2LoginRequest struct { @@ -335,7 +335,7 @@ func (h *Handler) getOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, h.r.Writer().Write(w, r, request) } -// Accept OAuth 2.0 Login Request Parameters +// Accept OAuth 2.0 Login Request // // swagger:parameters acceptOAuth2LoginRequest type acceptOAuth2LoginRequest struct { @@ -437,7 +437,7 @@ func (h *Handler) acceptOAuth2LoginRequest(w http.ResponseWriter, r *http.Reques }) } -// Reject OAuth 2.0 Login Request Parameters +// Reject OAuth 2.0 Login Request // // swagger:parameters rejectOAuth2LoginRequest type rejectOAuth2LoginRequest struct { @@ -524,7 +524,7 @@ func (h *Handler) rejectOAuth2LoginRequest(w http.ResponseWriter, r *http.Reques }) } -// Get OAuth 2.0 Consent Request Parameters +// Get OAuth 2.0 Consent Request // // swagger:parameters getOAuth2ConsentRequest type getOAuth2ConsentRequest struct { @@ -596,7 +596,7 @@ func (h *Handler) getOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request h.r.Writer().Write(w, r, request) } -// Accept OAuth 2.0 Consent Request Parameters +// Accept OAuth 2.0 Consent Request // // swagger:parameters acceptOAuth2ConsentRequest type acceptOAuth2ConsentRequest struct { @@ -689,7 +689,7 @@ func (h *Handler) acceptOAuth2ConsentRequest(w http.ResponseWriter, r *http.Requ }) } -// Reject OAuth 2.0 Consent Request Parameters +// Reject OAuth 2.0 Consent Request // // swagger:parameters rejectOAuth2ConsentRequest type adminRejectOAuth2ConsentRequest struct { @@ -782,7 +782,7 @@ func (h *Handler) rejectOAuth2ConsentRequest(w http.ResponseWriter, r *http.Requ }) } -// Accept OAuth 2.0 Logout Request Parameters +// Accept OAuth 2.0 Logout Request // // swagger:parameters acceptOAuth2LogoutRequest type acceptOAuth2LogoutRequest struct { @@ -826,7 +826,7 @@ func (h *Handler) acceptOAuth2LogoutRequest(w http.ResponseWriter, r *http.Reque }) } -// Reject OAuth 2.0 Logout Request Parameters +// Reject OAuth 2.0 Logout Request // // swagger:parameters rejectOAuth2LogoutRequest type rejectOAuth2LogoutRequest struct { @@ -866,7 +866,7 @@ func (h *Handler) rejectOAuth2LogoutRequest(w http.ResponseWriter, r *http.Reque w.WriteHeader(http.StatusNoContent) } -// Get OAuth 2.0 Logout Request Parameters +// Get OAuth 2.0 Logout Request // // swagger:parameters getOAuth2LogoutRequest type getOAuth2LogoutRequest struct { diff --git a/consent/types.go b/consent/types.go index ed8d2f253bd..cb4f4587712 100644 --- a/consent/types.go +++ b/consent/types.go @@ -213,26 +213,37 @@ type oAuth2ConsentSessions []OAuth2ConsentSession // // swagger:model oAuth2ConsentSession type OAuth2ConsentSession struct { - // Named ID because of pop ID string `json:"-" db:"challenge"` + // Scope Granted + // // GrantScope sets the scope the user authorized the client to use. Should be a subset of `requested_scope`. GrantedScope sqlxx.StringSliceJSONFormat `json:"grant_scope" db:"granted_scope"` + // Audience Granted + // // GrantedAudience sets the audience the user authorized the client to use. Should be a subset of `requested_access_token_audience`. GrantedAudience sqlxx.StringSliceJSONFormat `json:"grant_access_token_audience" db:"granted_at_audience"` + // Session Details + // // Session allows you to set (optional) session data for access and ID tokens. Session *AcceptOAuth2ConsentRequestSession `json:"session" db:"-"` + // Remember Consent + // // Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same // client asks the same user for the same, or a subset of, scope. Remember bool `json:"remember" db:"remember"` + // Remember Consent For + // // RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the // authorization will be remembered indefinitely. RememberFor int `json:"remember_for" db:"remember_for"` + // Consent Handled At + // // HandledAt contains the timestamp the consent request was handled. HandledAt sqlxx.NullTime `json:"handled_at" db:"handled_at"` @@ -242,10 +253,14 @@ type OAuth2ConsentSession struct { // the flow. WasHandled bool `json:"-" db:"was_used"` - ConsentRequest *OAuth2ConsentRequest `json:"consent_request" db:"-"` - Error *RequestDeniedError `json:"-" db:"error"` - RequestedAt time.Time `json:"-" db:"requested_at"` - AuthenticatedAt sqlxx.NullTime `json:"-" db:"authenticated_at"` + // Consent Request + // + // The consent request that lead to this consent session. + ConsentRequest *OAuth2ConsentRequest `json:"consent_request" db:"-"` + + Error *RequestDeniedError `json:"-" db:"error"` + RequestedAt time.Time `json:"-" db:"requested_at"` + AuthenticatedAt sqlxx.NullTime `json:"-" db:"authenticated_at"` SessionIDToken sqlxx.MapStringInterface `db:"session_id_token" json:"-"` SessionAccessToken sqlxx.MapStringInterface `db:"session_access_token" json:"-"` diff --git a/internal/httpclient/.openapi-generator/FILES b/internal/httpclient/.openapi-generator/FILES index d3119da5032..b201209fff7 100644 --- a/internal/httpclient/.openapi-generator/FILES +++ b/internal/httpclient/.openapi-generator/FILES @@ -3,17 +3,19 @@ .travis.yml README.md api/openapi.yaml +api_jwk.go api_metadata.go api_o_auth2.go api_oidc.go api_v0alpha2.go +api_wellknown.go client.go configuration.go docs/AcceptOAuth2ConsentRequest.md docs/AcceptOAuth2ConsentRequestSession.md docs/AcceptOAuth2LoginRequest.md -docs/AdminCreateJsonWebKeySetBody.md docs/AdminTrustOAuth2JwtGrantIssuerBody.md +docs/CreateJsonWebKeySet.md docs/ErrorOAuth2.md docs/GenericError.md docs/GetVersion200Response.md @@ -27,6 +29,7 @@ docs/IsReady503Response.md docs/JsonPatch.md docs/JsonWebKey.md docs/JsonWebKeySet.md +docs/JwkApi.md docs/MetadataApi.md docs/OAuth2AccessRequest.md docs/OAuth2Api.md @@ -56,14 +59,15 @@ docs/TrustedOAuth2JwtGrantIssuer.md docs/TrustedOAuth2JwtGrantJsonWebKey.md docs/V0alpha2Api.md docs/Version.md +docs/WellknownApi.md git_push.sh go.mod go.sum model_accept_o_auth2_consent_request.go model_accept_o_auth2_consent_request_session.go model_accept_o_auth2_login_request.go -model_admin_create_json_web_key_set_body.go model_admin_trust_o_auth2_jwt_grant_issuer_body.go +model_create_json_web_key_set.go model_error_o_auth2.go model_generic_error.go model_get_version_200_response.go diff --git a/internal/httpclient/README.md b/internal/httpclient/README.md index c0c683a1fc2..3e1b477db08 100644 --- a/internal/httpclient/README.md +++ b/internal/httpclient/README.md @@ -87,62 +87,62 @@ ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVari All URIs are relative to _http://localhost_ -| Class | Method | HTTP request | Description | -| ------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -| _MetadataApi_ | [**GetVersion**](docs/MetadataApi.md#getversion) | **Get** /version | Return Running Software Version. | -| _MetadataApi_ | [**IsAlive**](docs/MetadataApi.md#isalive) | **Get** /health/alive | Check HTTP Server Status | -| _MetadataApi_ | [**IsReady**](docs/MetadataApi.md#isready) | **Get** /health/ready | Check HTTP Server and Database Status | -| _OAuth2Api_ | [**AcceptOAuth2ConsentRequest**](docs/OAuth2Api.md#acceptoauth2consentrequest) | **Put** /admin/oauth2/auth/requests/consent/accept | Accept OAuth 2.0 Consent Request | -| _OAuth2Api_ | [**AcceptOAuth2LoginRequest**](docs/OAuth2Api.md#acceptoauth2loginrequest) | **Put** /admin/oauth2/auth/requests/login/accept | Accept OAuth 2.0 Login Request | -| _OAuth2Api_ | [**AcceptOAuth2LogoutRequest**](docs/OAuth2Api.md#acceptoauth2logoutrequest) | **Put** /admin/oauth2/auth/requests/logout/accept | Accept OAuth 2.0 Session Logout Request | -| _OAuth2Api_ | [**CreateOAuth2Client**](docs/OAuth2Api.md#createoauth2client) | **Post** /admin/clients | Create OAuth 2.0 Client | -| _OAuth2Api_ | [**DeleteOAuth2Client**](docs/OAuth2Api.md#deleteoauth2client) | **Delete** /admin/clients/{id} | Delete OAuth 2.0 Client | -| _OAuth2Api_ | [**GetOAuth2Client**](docs/OAuth2Api.md#getoauth2client) | **Get** /admin/clients/{id} | Get an OAuth 2.0 Client | -| _OAuth2Api_ | [**GetOAuth2ConsentRequest**](docs/OAuth2Api.md#getoauth2consentrequest) | **Get** /admin/oauth2/auth/requests/consent | Get OAuth 2.0 Consent Request | -| _OAuth2Api_ | [**GetOAuth2LoginRequest**](docs/OAuth2Api.md#getoauth2loginrequest) | **Get** /admin/oauth2/auth/requests/login | Get OAuth 2.0 Login Request | -| _OAuth2Api_ | [**GetOAuth2LogoutRequest**](docs/OAuth2Api.md#getoauth2logoutrequest) | **Get** /admin/oauth2/auth/requests/logout | Get OAuth 2.0 Session Logout Request | -| _OAuth2Api_ | [**ListOAuth2Clients**](docs/OAuth2Api.md#listoauth2clients) | **Get** /admin/clients | List OAuth 2.0 Clients | -| _OAuth2Api_ | [**ListOAuth2ConsentSessions**](docs/OAuth2Api.md#listoauth2consentsessions) | **Get** /admin/oauth2/auth/sessions/consent | List OAuth 2.0 Consent Sessions of a Subject | -| _OAuth2Api_ | [**PatchOAuth2Client**](docs/OAuth2Api.md#patchoauth2client) | **Patch** /admin/clients/{id} | Patch OAuth 2.0 Client | -| _OAuth2Api_ | [**RejectOAuth2ConsentRequest**](docs/OAuth2Api.md#rejectoauth2consentrequest) | **Put** /admin/oauth2/auth/requests/consent/reject | Reject OAuth 2.0 Consent Request | -| _OAuth2Api_ | [**RejectOAuth2LoginRequest**](docs/OAuth2Api.md#rejectoauth2loginrequest) | **Put** /admin/oauth2/auth/requests/login/reject | Reject OAuth 2.0 Login Request | -| _OAuth2Api_ | [**RejectOAuth2LogoutRequest**](docs/OAuth2Api.md#rejectoauth2logoutrequest) | **Put** /admin/oauth2/auth/requests/logout/reject | Reject OAuth 2.0 Session Logout Request | -| _OAuth2Api_ | [**RevokeOAuth2ConsentSessions**](docs/OAuth2Api.md#revokeoauth2consentsessions) | **Delete** /admin/oauth2/auth/sessions/consent | Revoke OAuth 2.0 Consent Sessions of a Subject | -| _OAuth2Api_ | [**RevokeOAuth2LoginSessions**](docs/OAuth2Api.md#revokeoauth2loginsessions) | **Delete** /admin/oauth2/auth/sessions/login | Revokes All OAuth 2.0 Login Sessions of a Subject | -| _OAuth2Api_ | [**SetOAuth2Client**](docs/OAuth2Api.md#setoauth2client) | **Put** /admin/clients/{id} | Set OAuth 2.0 Client | -| _OAuth2Api_ | [**SetOAuth2ClientLifespans**](docs/OAuth2Api.md#setoauth2clientlifespans) | **Put** /admin/clients/{id}/lifespans | Set OAuth2 Client Token Lifespans | -| _OidcApi_ | [**CreateOidcDynamicClient**](docs/OidcApi.md#createoidcdynamicclient) | **Post** /oauth2/register | Register OAuth2 Client using OpenID Dynamic Client Registration | -| _OidcApi_ | [**GetOidcDynamicClient**](docs/OidcApi.md#getoidcdynamicclient) | **Get** /oauth2/register/{id} | Get OAuth2 Client using OpenID Dynamic Client Registration | -| _OidcApi_ | [**SetOidcDynamicClient**](docs/OidcApi.md#setoidcdynamicclient) | **Put** /oauth2/register/{id} | Set OAuth2 Client using OpenID Dynamic Client Registration | -| _V0alpha2Api_ | [**AdminCreateJsonWebKeySet**](docs/V0alpha2Api.md#admincreatejsonwebkeyset) | **Post** /admin/keys/{set} | Generate a New JSON Web Key | -| _V0alpha2Api_ | [**AdminDeleteJsonWebKey**](docs/V0alpha2Api.md#admindeletejsonwebkey) | **Delete** /admin/keys/{set}/{kid} | Delete a JSON Web Key | -| _V0alpha2Api_ | [**AdminDeleteJsonWebKeySet**](docs/V0alpha2Api.md#admindeletejsonwebkeyset) | **Delete** /admin/keys/{set} | Delete a JSON Web Key Set | -| _V0alpha2Api_ | [**AdminDeleteOAuth2Token**](docs/V0alpha2Api.md#admindeleteoauth2token) | **Delete** /admin/oauth2/tokens | Delete OAuth2 Access Tokens from a Client | -| _V0alpha2Api_ | [**AdminDeleteTrustedOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admindeletetrustedoauth2jwtgrantissuer) | **Delete** /admin/trust/grants/jwt-bearer/issuers/{id} | Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer | -| _V0alpha2Api_ | [**AdminGetJsonWebKey**](docs/V0alpha2Api.md#admingetjsonwebkey) | **Get** /admin/keys/{set}/{kid} | Fetch a JSON Web Key | -| _V0alpha2Api_ | [**AdminGetJsonWebKeySet**](docs/V0alpha2Api.md#admingetjsonwebkeyset) | **Get** /admin/keys/{set} | Retrieve a JSON Web Key Set | -| _V0alpha2Api_ | [**AdminGetTrustedOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admingettrustedoauth2jwtgrantissuer) | **Get** /admin/trust/grants/jwt-bearer/issuers/{id} | Get a Trusted OAuth2 JWT Bearer Grant Type Issuer | -| _V0alpha2Api_ | [**AdminIntrospectOAuth2Token**](docs/V0alpha2Api.md#adminintrospectoauth2token) | **Post** /admin/oauth2/introspect | Introspect OAuth2 Access or Refresh Tokens | -| _V0alpha2Api_ | [**AdminListTrustedOAuth2JwtGrantIssuers**](docs/V0alpha2Api.md#adminlisttrustedoauth2jwtgrantissuers) | **Get** /admin/trust/grants/jwt-bearer/issuers | List Trusted OAuth2 JWT Bearer Grant Type Issuers | -| _V0alpha2Api_ | [**AdminTrustOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admintrustoauth2jwtgrantissuer) | **Post** /admin/trust/grants/jwt-bearer/issuers | Trust an OAuth2 JWT Bearer Grant Type Issuer | -| _V0alpha2Api_ | [**AdminUpdateJsonWebKey**](docs/V0alpha2Api.md#adminupdatejsonwebkey) | **Put** /admin/keys/{set}/{kid} | Update a JSON Web Key | -| _V0alpha2Api_ | [**AdminUpdateJsonWebKeySet**](docs/V0alpha2Api.md#adminupdatejsonwebkeyset) | **Put** /admin/keys/{set} | Update a JSON Web Key Set | -| _V0alpha2Api_ | [**DeleteOidcDynamicClient**](docs/V0alpha2Api.md#deleteoidcdynamicclient) | **Delete** /oauth2/register/{id} | Delete OAuth 2.0 Client using the OpenID Dynamic Client Registration Management Protocol | -| _V0alpha2Api_ | [**DiscoverJsonWebKeys**](docs/V0alpha2Api.md#discoverjsonwebkeys) | **Get** /.well-known/jwks.json | Discover JSON Web Keys | -| _V0alpha2Api_ | [**DiscoverOidcConfiguration**](docs/V0alpha2Api.md#discoveroidcconfiguration) | **Get** /.well-known/openid-configuration | OpenID Connect Discovery | -| _V0alpha2Api_ | [**GetOidcUserInfo**](docs/V0alpha2Api.md#getoidcuserinfo) | **Get** /userinfo | OpenID Connect Userinfo | -| _V0alpha2Api_ | [**PerformOAuth2AuthorizationFlow**](docs/V0alpha2Api.md#performoauth2authorizationflow) | **Get** /oauth2/auth | The OAuth 2.0 Authorize Endpoint | -| _V0alpha2Api_ | [**PerformOAuth2TokenFlow**](docs/V0alpha2Api.md#performoauth2tokenflow) | **Post** /oauth2/token | The OAuth 2.0 Token Endpoint | -| _V0alpha2Api_ | [**PerformOidcFrontOrBackChannelLogout**](docs/V0alpha2Api.md#performoidcfrontorbackchannellogout) | **Get** /oauth2/sessions/logout | OpenID Connect Front- or Back-channel Enabled Logout | -| _V0alpha2Api_ | [**RevokeOAuth2Token**](docs/V0alpha2Api.md#revokeoauth2token) | **Post** /oauth2/revoke | Revoke an OAuth2 Access or Refresh Token | +| Class | Method | HTTP request | Description | +| -------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- | +| _JwkApi_ | [**CreateJsonWebKeySet**](docs/JwkApi.md#createjsonwebkeyset) | **Post** /admin/keys/{set} | Create JSON Web Key | +| _JwkApi_ | [**DeleteJsonWebKey**](docs/JwkApi.md#deletejsonwebkey) | **Delete** /admin/keys/{set}/{kid} | Delete JSON Web Key | +| _JwkApi_ | [**DeleteJsonWebKeySet**](docs/JwkApi.md#deletejsonwebkeyset) | **Delete** /admin/keys/{set} | Delete JSON Web Key Set | +| _JwkApi_ | [**GetJsonWebKey**](docs/JwkApi.md#getjsonwebkey) | **Get** /admin/keys/{set}/{kid} | Get JSON Web Key | +| _JwkApi_ | [**GetJsonWebKeySet**](docs/JwkApi.md#getjsonwebkeyset) | **Get** /admin/keys/{set} | Retrieve a JSON Web Key Set | +| _JwkApi_ | [**SetJsonWebKey**](docs/JwkApi.md#setjsonwebkey) | **Put** /admin/keys/{set}/{kid} | Set JSON Web Key | +| _JwkApi_ | [**SetJsonWebKeySet**](docs/JwkApi.md#setjsonwebkeyset) | **Put** /admin/keys/{set} | Update a JSON Web Key Set | +| _MetadataApi_ | [**GetVersion**](docs/MetadataApi.md#getversion) | **Get** /version | Return Running Software Version. | +| _MetadataApi_ | [**IsAlive**](docs/MetadataApi.md#isalive) | **Get** /health/alive | Check HTTP Server Status | +| _MetadataApi_ | [**IsReady**](docs/MetadataApi.md#isready) | **Get** /health/ready | Check HTTP Server and Database Status | +| _OAuth2Api_ | [**AcceptOAuth2ConsentRequest**](docs/OAuth2Api.md#acceptoauth2consentrequest) | **Put** /admin/oauth2/auth/requests/consent/accept | Accept OAuth 2.0 Consent Request | +| _OAuth2Api_ | [**AcceptOAuth2LoginRequest**](docs/OAuth2Api.md#acceptoauth2loginrequest) | **Put** /admin/oauth2/auth/requests/login/accept | Accept OAuth 2.0 Login Request | +| _OAuth2Api_ | [**AcceptOAuth2LogoutRequest**](docs/OAuth2Api.md#acceptoauth2logoutrequest) | **Put** /admin/oauth2/auth/requests/logout/accept | Accept OAuth 2.0 Session Logout Request | +| _OAuth2Api_ | [**CreateOAuth2Client**](docs/OAuth2Api.md#createoauth2client) | **Post** /admin/clients | Create OAuth 2.0 Client | +| _OAuth2Api_ | [**DeleteOAuth2Client**](docs/OAuth2Api.md#deleteoauth2client) | **Delete** /admin/clients/{id} | Delete OAuth 2.0 Client | +| _OAuth2Api_ | [**GetOAuth2Client**](docs/OAuth2Api.md#getoauth2client) | **Get** /admin/clients/{id} | Get an OAuth 2.0 Client | +| _OAuth2Api_ | [**GetOAuth2ConsentRequest**](docs/OAuth2Api.md#getoauth2consentrequest) | **Get** /admin/oauth2/auth/requests/consent | Get OAuth 2.0 Consent Request | +| _OAuth2Api_ | [**GetOAuth2LoginRequest**](docs/OAuth2Api.md#getoauth2loginrequest) | **Get** /admin/oauth2/auth/requests/login | Get OAuth 2.0 Login Request | +| _OAuth2Api_ | [**GetOAuth2LogoutRequest**](docs/OAuth2Api.md#getoauth2logoutrequest) | **Get** /admin/oauth2/auth/requests/logout | Get OAuth 2.0 Session Logout Request | +| _OAuth2Api_ | [**ListOAuth2Clients**](docs/OAuth2Api.md#listoauth2clients) | **Get** /admin/clients | List OAuth 2.0 Clients | +| _OAuth2Api_ | [**ListOAuth2ConsentSessions**](docs/OAuth2Api.md#listoauth2consentsessions) | **Get** /admin/oauth2/auth/sessions/consent | List OAuth 2.0 Consent Sessions of a Subject | +| _OAuth2Api_ | [**PatchOAuth2Client**](docs/OAuth2Api.md#patchoauth2client) | **Patch** /admin/clients/{id} | Patch OAuth 2.0 Client | +| _OAuth2Api_ | [**RejectOAuth2ConsentRequest**](docs/OAuth2Api.md#rejectoauth2consentrequest) | **Put** /admin/oauth2/auth/requests/consent/reject | Reject OAuth 2.0 Consent Request | +| _OAuth2Api_ | [**RejectOAuth2LoginRequest**](docs/OAuth2Api.md#rejectoauth2loginrequest) | **Put** /admin/oauth2/auth/requests/login/reject | Reject OAuth 2.0 Login Request | +| _OAuth2Api_ | [**RejectOAuth2LogoutRequest**](docs/OAuth2Api.md#rejectoauth2logoutrequest) | **Put** /admin/oauth2/auth/requests/logout/reject | Reject OAuth 2.0 Session Logout Request | +| _OAuth2Api_ | [**RevokeOAuth2ConsentSessions**](docs/OAuth2Api.md#revokeoauth2consentsessions) | **Delete** /admin/oauth2/auth/sessions/consent | Revoke OAuth 2.0 Consent Sessions of a Subject | +| _OAuth2Api_ | [**RevokeOAuth2LoginSessions**](docs/OAuth2Api.md#revokeoauth2loginsessions) | **Delete** /admin/oauth2/auth/sessions/login | Revokes All OAuth 2.0 Login Sessions of a Subject | +| _OAuth2Api_ | [**SetOAuth2Client**](docs/OAuth2Api.md#setoauth2client) | **Put** /admin/clients/{id} | Set OAuth 2.0 Client | +| _OAuth2Api_ | [**SetOAuth2ClientLifespans**](docs/OAuth2Api.md#setoauth2clientlifespans) | **Put** /admin/clients/{id}/lifespans | Set OAuth2 Client Token Lifespans | +| _OidcApi_ | [**CreateOidcDynamicClient**](docs/OidcApi.md#createoidcdynamicclient) | **Post** /oauth2/register | Register OAuth2 Client using OpenID Dynamic Client Registration | +| _OidcApi_ | [**GetOidcDynamicClient**](docs/OidcApi.md#getoidcdynamicclient) | **Get** /oauth2/register/{id} | Get OAuth2 Client using OpenID Dynamic Client Registration | +| _OidcApi_ | [**SetOidcDynamicClient**](docs/OidcApi.md#setoidcdynamicclient) | **Put** /oauth2/register/{id} | Set OAuth2 Client using OpenID Dynamic Client Registration | +| _V0alpha2Api_ | [**AdminDeleteOAuth2Token**](docs/V0alpha2Api.md#admindeleteoauth2token) | **Delete** /admin/oauth2/tokens | Delete OAuth2 Access Tokens from a Client | +| _V0alpha2Api_ | [**AdminDeleteTrustedOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admindeletetrustedoauth2jwtgrantissuer) | **Delete** /admin/trust/grants/jwt-bearer/issuers/{id} | Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer | +| _V0alpha2Api_ | [**AdminGetTrustedOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admingettrustedoauth2jwtgrantissuer) | **Get** /admin/trust/grants/jwt-bearer/issuers/{id} | Get a Trusted OAuth2 JWT Bearer Grant Type Issuer | +| _V0alpha2Api_ | [**AdminIntrospectOAuth2Token**](docs/V0alpha2Api.md#adminintrospectoauth2token) | **Post** /admin/oauth2/introspect | Introspect OAuth2 Access or Refresh Tokens | +| _V0alpha2Api_ | [**AdminListTrustedOAuth2JwtGrantIssuers**](docs/V0alpha2Api.md#adminlisttrustedoauth2jwtgrantissuers) | **Get** /admin/trust/grants/jwt-bearer/issuers | List Trusted OAuth2 JWT Bearer Grant Type Issuers | +| _V0alpha2Api_ | [**AdminTrustOAuth2JwtGrantIssuer**](docs/V0alpha2Api.md#admintrustoauth2jwtgrantissuer) | **Post** /admin/trust/grants/jwt-bearer/issuers | Trust an OAuth2 JWT Bearer Grant Type Issuer | +| _V0alpha2Api_ | [**DeleteOidcDynamicClient**](docs/V0alpha2Api.md#deleteoidcdynamicclient) | **Delete** /oauth2/register/{id} | Delete OAuth 2.0 Client using the OpenID Dynamic Client Registration Management Protocol | +| _V0alpha2Api_ | [**DiscoverOidcConfiguration**](docs/V0alpha2Api.md#discoveroidcconfiguration) | **Get** /.well-known/openid-configuration | OpenID Connect Discovery | +| _V0alpha2Api_ | [**GetOidcUserInfo**](docs/V0alpha2Api.md#getoidcuserinfo) | **Get** /userinfo | OpenID Connect Userinfo | +| _V0alpha2Api_ | [**PerformOAuth2AuthorizationFlow**](docs/V0alpha2Api.md#performoauth2authorizationflow) | **Get** /oauth2/auth | The OAuth 2.0 Authorize Endpoint | +| _V0alpha2Api_ | [**PerformOAuth2TokenFlow**](docs/V0alpha2Api.md#performoauth2tokenflow) | **Post** /oauth2/token | The OAuth 2.0 Token Endpoint | +| _V0alpha2Api_ | [**PerformOidcFrontOrBackChannelLogout**](docs/V0alpha2Api.md#performoidcfrontorbackchannellogout) | **Get** /oauth2/sessions/logout | OpenID Connect Front- or Back-channel Enabled Logout | +| _V0alpha2Api_ | [**RevokeOAuth2Token**](docs/V0alpha2Api.md#revokeoauth2token) | **Post** /oauth2/revoke | Revoke an OAuth2 Access or Refresh Token | +| _WellknownApi_ | [**DiscoverJsonWebKeys**](docs/WellknownApi.md#discoverjsonwebkeys) | **Get** /.well-known/jwks.json | Discover Well-Known JSON Web Keys | ## Documentation For Models - [AcceptOAuth2ConsentRequest](docs/AcceptOAuth2ConsentRequest.md) - [AcceptOAuth2ConsentRequestSession](docs/AcceptOAuth2ConsentRequestSession.md) - [AcceptOAuth2LoginRequest](docs/AcceptOAuth2LoginRequest.md) -- [AdminCreateJsonWebKeySetBody](docs/AdminCreateJsonWebKeySetBody.md) - [AdminTrustOAuth2JwtGrantIssuerBody](docs/AdminTrustOAuth2JwtGrantIssuerBody.md) +- [CreateJsonWebKeySet](docs/CreateJsonWebKeySet.md) - [ErrorOAuth2](docs/ErrorOAuth2.md) - [GenericError](docs/GenericError.md) - [GetVersion200Response](docs/GetVersion200Response.md) diff --git a/internal/httpclient/api/openapi.yaml b/internal/httpclient/api/openapi.yaml index 831bd68e87c..931808ac433 100644 --- a/internal/httpclient/api/openapi.yaml +++ b/internal/httpclient/api/openapi.yaml @@ -43,9 +43,9 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Discover JSON Web Keys + summary: Discover Well-Known JSON Web Keys tags: - - v0alpha2 + - wellknown /.well-known/openid-configuration: get: description: "The well known endpoint an be used to retrieve information @@ -420,7 +420,7 @@ paths: \ keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens),\ \ and allows storing user-defined keys as well." - operationId: adminDeleteJsonWebKeySet + operationId: deleteJsonWebKeySet parameters: - description: The JSON Web Key Set explode: false @@ -442,9 +442,9 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Delete a JSON Web Key Set + summary: Delete JSON Web Key Set tags: - - v0alpha2 + - jwk get: description: "This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.\n\ @@ -459,9 +459,9 @@ paths: \ for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows\ \ storing user-defined keys as well." - operationId: adminGetJsonWebKeySet + operationId: getJsonWebKeySet parameters: - - description: The JSON Web Key Set + - description: JSON Web Key Set ID explode: false in: path name: set @@ -484,7 +484,7 @@ paths: description: errorOAuth2 summary: Retrieve a JSON Web Key Set tags: - - v0alpha2 + - jwk post: description: "This endpoint is capable of generating JSON Web Key Sets for you.\ @@ -505,9 +505,9 @@ paths: \ for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows\ \ storing user-defined keys as well." - operationId: adminCreateJsonWebKeySet + operationId: createJsonWebKeySet parameters: - - description: The JSON Web Key Set + - description: The JSON Web Key Set ID explode: false in: path name: set @@ -519,7 +519,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/adminCreateJsonWebKeySetBody" + $ref: "#/components/schemas/createJsonWebKeySet" required: true x-originalParamName: Body responses: @@ -535,9 +535,9 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Generate a New JSON Web Key + summary: Create JSON Web Key tags: - - v0alpha2 + - jwk put: description: "Use this method if you do not want to let Hydra generate the JWKs\ @@ -552,9 +552,9 @@ paths: \ to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID\ \ Connect ID tokens), and allows storing user-defined keys as well." - operationId: adminUpdateJsonWebKeySet + operationId: setJsonWebKeySet parameters: - - description: The JSON Web Key Set + - description: The JSON Web Key Set ID explode: false in: path name: set @@ -583,23 +583,23 @@ paths: description: errorOAuth2 summary: Update a JSON Web Key Set tags: - - v0alpha2 + - jwk /admin/keys/{set}/{kid}: delete: description: "Use this endpoint to delete a single JSON Web Key.\n\nA JSON Web\ \ Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents\ - \ a cryptographic key. A JWK Set is a JSON data structure that + \ a cryptographic key. A\nJWK Set is a JSON data structure that represents\ \ a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra\ - \ uses this functionality to store cryptographic keys used for TLS and + \ uses\nthis functionality to store cryptographic keys used for TLS and JSON\ - \ Web Tokens (such as OpenID Connect ID tokens), and allows storing + \ Web Tokens (such as OpenID Connect ID tokens),\nand allows storing user-defined\ \ keys as well." - operationId: adminDeleteJsonWebKey + operationId: deleteJsonWebKey parameters: - description: The JSON Web Key Set explode: false @@ -629,16 +629,16 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Delete a JSON Web Key + summary: Delete JSON Web Key tags: - - v0alpha2 + - jwk get: description: - This endpoint returns a singular JSON Web Key. It is identified by the - set and the specific key ID (kid). - operationId: adminGetJsonWebKey + This endpoint returns a singular JSON Web Key contained in a set. It is + identified by the set and the specific key ID (kid). + operationId: getJsonWebKey parameters: - - description: The JSON Web Key Set + - description: JSON Web Key Set ID explode: false in: path name: set @@ -646,7 +646,7 @@ paths: schema: type: string style: simple - - description: The JSON Web Key ID (kid) + - description: JSON Web Key ID explode: false in: path name: kid @@ -667,9 +667,9 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Fetch a JSON Web Key + summary: Get JSON Web Key tags: - - v0alpha2 + - jwk put: description: "Use this method if you do not want to let Hydra generate the JWKs\ @@ -684,9 +684,9 @@ paths: \ to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID\ \ Connect ID tokens), and allows storing user-defined keys as well." - operationId: adminUpdateJsonWebKey + operationId: setJsonWebKey parameters: - - description: The JSON Web Key Set + - description: The JSON Web Key Set ID explode: false in: path name: set @@ -694,7 +694,7 @@ paths: schema: type: string style: simple - - description: The JSON Web Key ID (kid) + - description: JSON Web Key ID explode: false in: path name: kid @@ -721,9 +721,9 @@ paths: schema: $ref: "#/components/schemas/errorOAuth2" description: errorOAuth2 - summary: Update a JSON Web Key + summary: Set JSON Web Key tags: - - v0alpha2 + - jwk /admin/oauth2/auth/requests/consent: get: description: "When an authorization code, hybrid, or implicit OAuth 2.0 @@ -2275,28 +2275,6 @@ components: HandledLoginRequest is the request payload used to accept a login request. type: object - adminCreateJsonWebKeySetBody: - properties: - alg: - description: "The algorithm to be used for creating the key. Supports - \"\ - RS256\", \"ES256\", \"ES512\", \"HS512\", and \"HS256\"" - type: string - kid: - description: The kid of the key to be created - type: string - use: - description: |- - The "use" (public key use) parameter identifies the intended use of - the public key. The "use" parameter is employed to indicate whether - a public key is used for encrypting data or verifying the signature - on data. Valid values are "enc" and "sig". - type: string - required: - - alg - - kid - - use - type: object adminTrustOAuth2JwtGrantIssuerBody: properties: allow_any_subject: @@ -2340,6 +2318,34 @@ components: - jwk - scope type: object + createJsonWebKeySet: + description: Create JSON Web Key Set Request Body + properties: + alg: + description: "JSON Web Key Algorithm\n\nThe algorithm to be used for + creating\ + \ the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`." + type: string + kid: + description: |- + JSON Web Key ID + + The Key ID of the key to be created. + type: string + use: + description: |- + JSON Web Key Use + + The "use" (public key use) parameter identifies the intended use of + the public key. The "use" parameter is employed to indicate whether + a public key is used for encrypting data or verifying the signature + on data. Valid values are "enc" and "sig". + type: string + required: + - alg + - kid + - use + type: object errorOAuth2: description: Error example: @@ -2728,15 +2734,7 @@ components: - use type: object jsonWebKeySet: - description: "It is important that this model object is named - JSONWebKeySet\ - \ for\n\"swagger generate spec\" to generate only on definition of - a\nJSONWebKeySet.\ - \ Since one with the same name is previously defined - as\nclient.Client.JSONWebKeys\ - \ and this one is last, this one will be\neffectively written in the - swagger\ - \ spec." + description: JSON Web Key Set example: keys: - d: T_N8I-6He3M8a7X1vWt6TGIx4xB_GP3Mb4SsZSA4v-orvJzzRiQhLlRR81naWYxfQAYt5isDI6_C2L9bdWo4FFPjGQFvNoRX-_sBJyBI_rl-TBgsZYoUlAj3J92WmY2inbA-PwyJfsaIIDceYBC-eX-xiCu6qMqkZi3MwQAFL6bMdPEM0z4JBcwFT3VdiWAIRUuACWQwrXMq672x7fMuaIaHi7XDGgt1ith23CLfaREmJku9PQcchbt_uEY-hqrFY6ntTtS4paWWQj86xLL94S-Tf6v6xkL918PfLSOTq6XCzxvlFwzBJqApnAhbwqLjpPhgUG04EDRrqrSBc5Y1BLevn6Ip5h1AhessBp3wLkQgz_roeckt-ybvzKTjESMuagnpqLvOT7Y9veIug2MwPJZI2VjczRc1vzMs25XrFQ8DpUy-bNdp89TmvAXwctUMiJdgHloJw23Cv03gIUAkDnsTqZmkpbIf-crpgNKFmQP_EDKoe8p_PXZZgfbRri3NoEVGP7Mk6yEu8LjJhClhZaBNjuWw2-KlBfOA3g79mhfBnkInee5KO9mGR50qPk1V-MorUYNTFMZIm0kFE6eYVWFBwJHLKYhHU34DoiK1VP-svZpC2uAMFNA_UJEwM9CQ2b8qe4-5e9aywMvwcuArRkAB5mBIfOaOJao3mfukKAE @@ -2779,15 +2777,15 @@ components: alg: RS256 properties: keys: - description: "The value of the \"keys\" parameter is an array of JSON - Web\ - \ Key (JWK)\nvalues. By default, the order of the JWK values within - the\ - \ array does\nnot imply an order of preference among them, although - applications\n\ - of JWK Sets can choose to assign a meaning to the order for - their\npurposes,\ - \ if desired." + description: "List of JSON Web Keys\n\nThe value of the \"keys\" + parameter\ + \ is an array of JSON Web Key (JWK)\nvalues. By default, the order + of\ + \ the JWK values within the array does\nnot imply an order of + preference\ + \ among them, although applications\nof JWK Sets can choose to + assign\ + \ a meaning to the order for their\npurposes, if desired." items: $ref: "#/components/schemas/jsonWebKey" type: array @@ -3771,18 +3769,18 @@ components: title: NullTime implements sql.NullTime functionality. type: string remember: - description: "Remember, if set to true, tells ORY Hydra to remember - this\ - \ consent authorization and reuse it if the same\nclient asks the - same\ - \ user for the same, or a subset of, scope." + description: "Remember Consent\n\nRemember, if set to true, tells ORY + Hydra\ + \ to remember this consent authorization and reuse it if the + same\nclient\ + \ asks the same user for the same, or a subset of, scope." type: boolean remember_for: - description: "RememberFor sets how long the consent authorization - should\ - \ be remembered for in seconds. If set to `0`, the\nauthorization - will\ - \ be remembered indefinitely." + description: "Remember Consent For\n\nRememberFor sets how long the + consent\ + \ authorization should be remembered for in seconds. If set to `0`, + the\n\ + authorization will be remembered indefinitely." format: int64 type: integer session: diff --git a/internal/httpclient/api_jwk.go b/internal/httpclient/api_jwk.go new file mode 100644 index 00000000000..eac14c93c1f --- /dev/null +++ b/internal/httpclient/api_jwk.go @@ -0,0 +1,831 @@ +/* +Ory Hydra API + +Documentation for all of Ory Hydra's APIs. + +API version: +Contact: hi@ory.sh +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + +// JwkApiService JwkApi service +type JwkApiService service + +type ApiCreateJsonWebKeySetRequest struct { + ctx context.Context + ApiService *JwkApiService + set string + createJsonWebKeySet *CreateJsonWebKeySet +} + +func (r ApiCreateJsonWebKeySetRequest) CreateJsonWebKeySet(createJsonWebKeySet CreateJsonWebKeySet) ApiCreateJsonWebKeySetRequest { + r.createJsonWebKeySet = &createJsonWebKeySet + return r +} + +func (r ApiCreateJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { + return r.ApiService.CreateJsonWebKeySetExecute(r) +} + +/* +CreateJsonWebKeySet Create JSON Web Key + +This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set The JSON Web Key Set ID + @return ApiCreateJsonWebKeySetRequest +*/ +func (a *JwkApiService) CreateJsonWebKeySet(ctx context.Context, set string) ApiCreateJsonWebKeySetRequest { + return ApiCreateJsonWebKeySetRequest{ + ApiService: a, + ctx: ctx, + set: set, + } +} + +// Execute executes the request +// +// @return JsonWebKeySet +func (a *JwkApiService) CreateJsonWebKeySetExecute(r ApiCreateJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKeySet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.CreateJsonWebKeySet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createJsonWebKeySet == nil { + return localVarReturnValue, nil, reportError("createJsonWebKeySet is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createJsonWebKeySet + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteJsonWebKeyRequest struct { + ctx context.Context + ApiService *JwkApiService + set string + kid string +} + +func (r ApiDeleteJsonWebKeyRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteJsonWebKeyExecute(r) +} + +/* +DeleteJsonWebKey Delete JSON Web Key + +Use this endpoint to delete a single JSON Web Key. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A +JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses +this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), +and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set The JSON Web Key Set + @param kid The JSON Web Key ID (kid) + @return ApiDeleteJsonWebKeyRequest +*/ +func (a *JwkApiService) DeleteJsonWebKey(ctx context.Context, set string, kid string) ApiDeleteJsonWebKeyRequest { + return ApiDeleteJsonWebKeyRequest{ + ApiService: a, + ctx: ctx, + set: set, + kid: kid, + } +} + +// Execute executes the request +func (a *JwkApiService) DeleteJsonWebKeyExecute(r ApiDeleteJsonWebKeyRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.DeleteJsonWebKey") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}/{kid}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteJsonWebKeySetRequest struct { + ctx context.Context + ApiService *JwkApiService + set string +} + +func (r ApiDeleteJsonWebKeySetRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteJsonWebKeySetExecute(r) +} + +/* +DeleteJsonWebKeySet Delete JSON Web Key Set + +Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set The JSON Web Key Set + @return ApiDeleteJsonWebKeySetRequest +*/ +func (a *JwkApiService) DeleteJsonWebKeySet(ctx context.Context, set string) ApiDeleteJsonWebKeySetRequest { + return ApiDeleteJsonWebKeySetRequest{ + ApiService: a, + ctx: ctx, + set: set, + } +} + +// Execute executes the request +func (a *JwkApiService) DeleteJsonWebKeySetExecute(r ApiDeleteJsonWebKeySetRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.DeleteJsonWebKeySet") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.model = v + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetJsonWebKeyRequest struct { + ctx context.Context + ApiService *JwkApiService + set string + kid string +} + +func (r ApiGetJsonWebKeyRequest) Execute() (*JsonWebKeySet, *http.Response, error) { + return r.ApiService.GetJsonWebKeyExecute(r) +} + +/* +GetJsonWebKey Get JSON Web Key + +This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set JSON Web Key Set ID + @param kid JSON Web Key ID + @return ApiGetJsonWebKeyRequest +*/ +func (a *JwkApiService) GetJsonWebKey(ctx context.Context, set string, kid string) ApiGetJsonWebKeyRequest { + return ApiGetJsonWebKeyRequest{ + ApiService: a, + ctx: ctx, + set: set, + kid: kid, + } +} + +// Execute executes the request +// +// @return JsonWebKeySet +func (a *JwkApiService) GetJsonWebKeyExecute(r ApiGetJsonWebKeyRequest) (*JsonWebKeySet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKeySet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.GetJsonWebKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}/{kid}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetJsonWebKeySetRequest struct { + ctx context.Context + ApiService *JwkApiService + set string +} + +func (r ApiGetJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { + return r.ApiService.GetJsonWebKeySetExecute(r) +} + +/* +GetJsonWebKeySet Retrieve a JSON Web Key Set + +This endpoint can be used to retrieve JWK Sets stored in ORY Hydra. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set JSON Web Key Set ID + @return ApiGetJsonWebKeySetRequest +*/ +func (a *JwkApiService) GetJsonWebKeySet(ctx context.Context, set string) ApiGetJsonWebKeySetRequest { + return ApiGetJsonWebKeySetRequest{ + ApiService: a, + ctx: ctx, + set: set, + } +} + +// Execute executes the request +// +// @return JsonWebKeySet +func (a *JwkApiService) GetJsonWebKeySetExecute(r ApiGetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKeySet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.GetJsonWebKeySet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSetJsonWebKeyRequest struct { + ctx context.Context + ApiService *JwkApiService + set string + kid string + jsonWebKey *JsonWebKey +} + +func (r ApiSetJsonWebKeyRequest) JsonWebKey(jsonWebKey JsonWebKey) ApiSetJsonWebKeyRequest { + r.jsonWebKey = &jsonWebKey + return r +} + +func (r ApiSetJsonWebKeyRequest) Execute() (*JsonWebKey, *http.Response, error) { + return r.ApiService.SetJsonWebKeyExecute(r) +} + +/* +SetJsonWebKey Set JSON Web Key + +Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set The JSON Web Key Set ID + @param kid JSON Web Key ID + @return ApiSetJsonWebKeyRequest +*/ +func (a *JwkApiService) SetJsonWebKey(ctx context.Context, set string, kid string) ApiSetJsonWebKeyRequest { + return ApiSetJsonWebKeyRequest{ + ApiService: a, + ctx: ctx, + set: set, + kid: kid, + } +} + +// Execute executes the request +// +// @return JsonWebKey +func (a *JwkApiService) SetJsonWebKeyExecute(r ApiSetJsonWebKeyRequest) (*JsonWebKey, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKey + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.SetJsonWebKey") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}/{kid}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.jsonWebKey + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSetJsonWebKeySetRequest struct { + ctx context.Context + ApiService *JwkApiService + set string + jsonWebKeySet *JsonWebKeySet +} + +func (r ApiSetJsonWebKeySetRequest) JsonWebKeySet(jsonWebKeySet JsonWebKeySet) ApiSetJsonWebKeySetRequest { + r.jsonWebKeySet = &jsonWebKeySet + return r +} + +func (r ApiSetJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { + return r.ApiService.SetJsonWebKeySetExecute(r) +} + +/* +SetJsonWebKeySet Update a JSON Web Key Set + +Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. + +A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param set The JSON Web Key Set ID + @return ApiSetJsonWebKeySetRequest +*/ +func (a *JwkApiService) SetJsonWebKeySet(ctx context.Context, set string) ApiSetJsonWebKeySetRequest { + return ApiSetJsonWebKeySetRequest{ + ApiService: a, + ctx: ctx, + set: set, + } +} + +// Execute executes the request +// +// @return JsonWebKeySet +func (a *JwkApiService) SetJsonWebKeySetExecute(r ApiSetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKeySet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JwkApiService.SetJsonWebKeySet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/admin/keys/{set}" + localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.jsonWebKeySet + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/httpclient/api_v0alpha2.go b/internal/httpclient/api_v0alpha2.go index e85b0dc1a60..6ac8256f1e5 100644 --- a/internal/httpclient/api_v0alpha2.go +++ b/internal/httpclient/api_v0alpha2.go @@ -23,183 +23,59 @@ import ( // V0alpha2ApiService V0alpha2Api service type V0alpha2ApiService service -type ApiAdminCreateJsonWebKeySetRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string - adminCreateJsonWebKeySetBody *AdminCreateJsonWebKeySetBody +type ApiAdminDeleteOAuth2TokenRequest struct { + ctx context.Context + ApiService *V0alpha2ApiService + clientId *string } -func (r ApiAdminCreateJsonWebKeySetRequest) AdminCreateJsonWebKeySetBody(adminCreateJsonWebKeySetBody AdminCreateJsonWebKeySetBody) ApiAdminCreateJsonWebKeySetRequest { - r.adminCreateJsonWebKeySetBody = &adminCreateJsonWebKeySetBody +func (r ApiAdminDeleteOAuth2TokenRequest) ClientId(clientId string) ApiAdminDeleteOAuth2TokenRequest { + r.clientId = &clientId return r } -func (r ApiAdminCreateJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { - return r.ApiService.AdminCreateJsonWebKeySetExecute(r) -} - -/* -AdminCreateJsonWebKeySet Generate a New JSON Web Key - -This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created. - -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @return ApiAdminCreateJsonWebKeySetRequest -*/ -func (a *V0alpha2ApiService) AdminCreateJsonWebKeySet(ctx context.Context, set string) ApiAdminCreateJsonWebKeySetRequest { - return ApiAdminCreateJsonWebKeySetRequest{ - ApiService: a, - ctx: ctx, - set: set, - } -} - -// Execute executes the request -// -// @return JsonWebKeySet -func (a *V0alpha2ApiService) AdminCreateJsonWebKeySetExecute(r ApiAdminCreateJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *JsonWebKeySet - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminCreateJsonWebKeySet") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/keys/{set}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.adminCreateJsonWebKeySetBody == nil { - return localVarReturnValue, nil, reportError("adminCreateJsonWebKeySetBody is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.adminCreateJsonWebKeySetBody - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiAdminDeleteJsonWebKeyRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string - kid string -} - -func (r ApiAdminDeleteJsonWebKeyRequest) Execute() (*http.Response, error) { - return r.ApiService.AdminDeleteJsonWebKeyExecute(r) +func (r ApiAdminDeleteOAuth2TokenRequest) Execute() (*http.Response, error) { + return r.ApiService.AdminDeleteOAuth2TokenExecute(r) } /* -AdminDeleteJsonWebKey Delete a JSON Web Key - -Use this endpoint to delete a single JSON Web Key. +AdminDeleteOAuth2Token Delete OAuth2 Access Tokens from a Client -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. +This endpoint deletes OAuth2 access tokens issued for a client from the database @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @param kid The JSON Web Key ID (kid) - @return ApiAdminDeleteJsonWebKeyRequest + @return ApiAdminDeleteOAuth2TokenRequest */ -func (a *V0alpha2ApiService) AdminDeleteJsonWebKey(ctx context.Context, set string, kid string) ApiAdminDeleteJsonWebKeyRequest { - return ApiAdminDeleteJsonWebKeyRequest{ +func (a *V0alpha2ApiService) AdminDeleteOAuth2Token(ctx context.Context) ApiAdminDeleteOAuth2TokenRequest { + return ApiAdminDeleteOAuth2TokenRequest{ ApiService: a, ctx: ctx, - set: set, - kid: kid, } } // Execute executes the request -func (a *V0alpha2ApiService) AdminDeleteJsonWebKeyExecute(r ApiAdminDeleteJsonWebKeyRequest) (*http.Response, error) { +func (a *V0alpha2ApiService) AdminDeleteOAuth2TokenExecute(r ApiAdminDeleteOAuth2TokenRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteJsonWebKey") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteOAuth2Token") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/admin/keys/{set}/{kid}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) + localVarPath := localBasePath + "/admin/oauth2/tokens" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.clientId == nil { + return nil, reportError("clientId is required and must be specified") + } + localVarQueryParams.Add("client_id", parameterToString(*r.clientId, "")) // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -252,50 +128,52 @@ func (a *V0alpha2ApiService) AdminDeleteJsonWebKeyExecute(r ApiAdminDeleteJsonWe return localVarHTTPResponse, nil } -type ApiAdminDeleteJsonWebKeySetRequest struct { +type ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest struct { ctx context.Context ApiService *V0alpha2ApiService - set string + id string } -func (r ApiAdminDeleteJsonWebKeySetRequest) Execute() (*http.Response, error) { - return r.ApiService.AdminDeleteJsonWebKeySetExecute(r) +func (r ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest) Execute() (*http.Response, error) { + return r.ApiService.AdminDeleteTrustedOAuth2JwtGrantIssuerExecute(r) } /* -AdminDeleteJsonWebKeySet Delete a JSON Web Key Set +AdminDeleteTrustedOAuth2JwtGrantIssuer Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer -Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set. +Use this endpoint to delete trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you +created the trust relationship. -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. +Once deleted, the associated issuer will no longer be able to perform the JSON Web Token (JWT) Profile +for OAuth 2.0 Client Authentication and Authorization Grant. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @return ApiAdminDeleteJsonWebKeySetRequest + @param id The id of the desired grant + @return ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest */ -func (a *V0alpha2ApiService) AdminDeleteJsonWebKeySet(ctx context.Context, set string) ApiAdminDeleteJsonWebKeySetRequest { - return ApiAdminDeleteJsonWebKeySetRequest{ +func (a *V0alpha2ApiService) AdminDeleteTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest { + return ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest{ ApiService: a, ctx: ctx, - set: set, + id: id, } } // Execute executes the request -func (a *V0alpha2ApiService) AdminDeleteJsonWebKeySetExecute(r ApiAdminDeleteJsonWebKeySetRequest) (*http.Response, error) { +func (a *V0alpha2ApiService) AdminDeleteTrustedOAuth2JwtGrantIssuerExecute(r ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteJsonWebKeySet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteTrustedOAuth2JwtGrantIssuer") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/admin/keys/{set}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -340,7 +218,7 @@ func (a *V0alpha2ApiService) AdminDeleteJsonWebKeySetExecute(r ApiAdminDeleteJso body: localVarBody, error: localVarHTTPResponse.Status, } - var v ErrorOAuth2 + var v GenericError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -353,780 +231,57 @@ func (a *V0alpha2ApiService) AdminDeleteJsonWebKeySetExecute(r ApiAdminDeleteJso return localVarHTTPResponse, nil } -type ApiAdminDeleteOAuth2TokenRequest struct { +type ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest struct { ctx context.Context ApiService *V0alpha2ApiService - clientId *string -} - -func (r ApiAdminDeleteOAuth2TokenRequest) ClientId(clientId string) ApiAdminDeleteOAuth2TokenRequest { - r.clientId = &clientId - return r + id string } -func (r ApiAdminDeleteOAuth2TokenRequest) Execute() (*http.Response, error) { - return r.ApiService.AdminDeleteOAuth2TokenExecute(r) +func (r ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { + return r.ApiService.AdminGetTrustedOAuth2JwtGrantIssuerExecute(r) } /* -AdminDeleteOAuth2Token Delete OAuth2 Access Tokens from a Client +AdminGetTrustedOAuth2JwtGrantIssuer Get a Trusted OAuth2 JWT Bearer Grant Type Issuer -This endpoint deletes OAuth2 access tokens issued for a client from the database +Use this endpoint to get a trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you +created the trust relationship. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiAdminDeleteOAuth2TokenRequest + @param id The id of the desired grant + @return ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest */ -func (a *V0alpha2ApiService) AdminDeleteOAuth2Token(ctx context.Context) ApiAdminDeleteOAuth2TokenRequest { - return ApiAdminDeleteOAuth2TokenRequest{ +func (a *V0alpha2ApiService) AdminGetTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest { + return ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest{ ApiService: a, ctx: ctx, + id: id, } } // Execute executes the request -func (a *V0alpha2ApiService) AdminDeleteOAuth2TokenExecute(r ApiAdminDeleteOAuth2TokenRequest) (*http.Response, error) { +// +// @return TrustedOAuth2JwtGrantIssuer +func (a *V0alpha2ApiService) AdminGetTrustedOAuth2JwtGrantIssuerExecute(r ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TrustedOAuth2JwtGrantIssuer ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteOAuth2Token") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/oauth2/tokens" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.clientId == nil { - return nil, reportError("clientId is required and must be specified") - } - - localVarQueryParams.Add("client_id", parameterToString(*r.clientId, "")) - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminGetTrustedOAuth2JwtGrantIssuer") if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - id string -} - -func (r ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest) Execute() (*http.Response, error) { - return r.ApiService.AdminDeleteTrustedOAuth2JwtGrantIssuerExecute(r) -} - -/* -AdminDeleteTrustedOAuth2JwtGrantIssuer Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer - -Use this endpoint to delete trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you -created the trust relationship. - -Once deleted, the associated issuer will no longer be able to perform the JSON Web Token (JWT) Profile -for OAuth 2.0 Client Authentication and Authorization Grant. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The id of the desired grant - @return ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest -*/ -func (a *V0alpha2ApiService) AdminDeleteTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest { - return ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -func (a *V0alpha2ApiService) AdminDeleteTrustedOAuth2JwtGrantIssuerExecute(r ApiAdminDeleteTrustedOAuth2JwtGrantIssuerRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminDeleteTrustedOAuth2JwtGrantIssuer") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers/{id}" localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarHTTPResponse, newErr - } - newErr.model = v - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type ApiAdminGetJsonWebKeyRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string - kid string -} - -func (r ApiAdminGetJsonWebKeyRequest) Execute() (*JsonWebKeySet, *http.Response, error) { - return r.ApiService.AdminGetJsonWebKeyExecute(r) -} - -/* -AdminGetJsonWebKey Fetch a JSON Web Key - -This endpoint returns a singular JSON Web Key. It is identified by the set and the specific key ID (kid). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @param kid The JSON Web Key ID (kid) - @return ApiAdminGetJsonWebKeyRequest -*/ -func (a *V0alpha2ApiService) AdminGetJsonWebKey(ctx context.Context, set string, kid string) ApiAdminGetJsonWebKeyRequest { - return ApiAdminGetJsonWebKeyRequest{ - ApiService: a, - ctx: ctx, - set: set, - kid: kid, - } -} - -// Execute executes the request -// -// @return JsonWebKeySet -func (a *V0alpha2ApiService) AdminGetJsonWebKeyExecute(r ApiAdminGetJsonWebKeyRequest) (*JsonWebKeySet, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *JsonWebKeySet - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminGetJsonWebKey") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/keys/{set}/{kid}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiAdminGetJsonWebKeySetRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string -} - -func (r ApiAdminGetJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { - return r.ApiService.AdminGetJsonWebKeySetExecute(r) -} - -/* -AdminGetJsonWebKeySet Retrieve a JSON Web Key Set - -This endpoint can be used to retrieve JWK Sets stored in ORY Hydra. - -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @return ApiAdminGetJsonWebKeySetRequest -*/ -func (a *V0alpha2ApiService) AdminGetJsonWebKeySet(ctx context.Context, set string) ApiAdminGetJsonWebKeySetRequest { - return ApiAdminGetJsonWebKeySetRequest{ - ApiService: a, - ctx: ctx, - set: set, - } -} - -// Execute executes the request -// -// @return JsonWebKeySet -func (a *V0alpha2ApiService) AdminGetJsonWebKeySetExecute(r ApiAdminGetJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *JsonWebKeySet - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminGetJsonWebKeySet") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/keys/{set}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - id string -} - -func (r ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { - return r.ApiService.AdminGetTrustedOAuth2JwtGrantIssuerExecute(r) -} - -/* -AdminGetTrustedOAuth2JwtGrantIssuer Get a Trusted OAuth2 JWT Bearer Grant Type Issuer - -Use this endpoint to get a trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you -created the trust relationship. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id The id of the desired grant - @return ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest -*/ -func (a *V0alpha2ApiService) AdminGetTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest { - return ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -// -// @return TrustedOAuth2JwtGrantIssuer -func (a *V0alpha2ApiService) AdminGetTrustedOAuth2JwtGrantIssuerExecute(r ApiAdminGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *TrustedOAuth2JwtGrantIssuer - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminGetTrustedOAuth2JwtGrantIssuer") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterToString(r.id, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v GenericError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiAdminIntrospectOAuth2TokenRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - token *string - scope *string -} - -// The string value of the token. For access tokens, this is the \\\"access_token\\\" value returned from the token endpoint defined in OAuth 2.0. For refresh tokens, this is the \\\"refresh_token\\\" value returned. -func (r ApiAdminIntrospectOAuth2TokenRequest) Token(token string) ApiAdminIntrospectOAuth2TokenRequest { - r.token = &token - return r -} - -// An optional, space separated list of required scopes. If the access token was not granted one of the scopes, the result of active will be false. -func (r ApiAdminIntrospectOAuth2TokenRequest) Scope(scope string) ApiAdminIntrospectOAuth2TokenRequest { - r.scope = &scope - return r -} - -func (r ApiAdminIntrospectOAuth2TokenRequest) Execute() (*IntrospectedOAuth2Token, *http.Response, error) { - return r.ApiService.AdminIntrospectOAuth2TokenExecute(r) -} - -/* -AdminIntrospectOAuth2Token Introspect OAuth2 Access or Refresh Tokens - -The introspection endpoint allows to check if a token (both refresh and access) is active or not. An active token -is neither expired nor revoked. If a token is active, additional information on the token will be included. You can -set additional data for a token by setting `accessTokenExtra` during the consent flow. - -For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-endpoint/). - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiAdminIntrospectOAuth2TokenRequest -*/ -func (a *V0alpha2ApiService) AdminIntrospectOAuth2Token(ctx context.Context) ApiAdminIntrospectOAuth2TokenRequest { - return ApiAdminIntrospectOAuth2TokenRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return IntrospectedOAuth2Token -func (a *V0alpha2ApiService) AdminIntrospectOAuth2TokenExecute(r ApiAdminIntrospectOAuth2TokenRequest) (*IntrospectedOAuth2Token, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *IntrospectedOAuth2Token - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminIntrospectOAuth2Token") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/oauth2/introspect" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.token == nil { - return localVarReturnValue, nil, reportError("token is required and must be specified") - } - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - if r.scope != nil { - localVarFormParams.Add("scope", parameterToString(*r.scope, "")) - } - localVarFormParams.Add("token", parameterToString(*r.token, "")) - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiAdminListTrustedOAuth2JwtGrantIssuersRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - maxItems *int64 - defaultItems *int64 - issuer *string - limit *int64 - offset *int64 -} - -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) MaxItems(maxItems int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - r.maxItems = &maxItems - return r -} - -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) DefaultItems(defaultItems int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - r.defaultItems = &defaultItems - return r -} - -// If optional \"issuer\" is supplied, only jwt-bearer grants with this issuer will be returned. -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Issuer(issuer string) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - r.issuer = &issuer - return r -} - -// The maximum amount of policies returned, upper bound is 500 policies -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Limit(limit int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - r.limit = &limit - return r -} - -// The offset from where to start looking. -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Offset(offset int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - r.offset = &offset - return r -} - -func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Execute() ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) { - return r.ApiService.AdminListTrustedOAuth2JwtGrantIssuersExecute(r) -} - -/* -AdminListTrustedOAuth2JwtGrantIssuers List Trusted OAuth2 JWT Bearer Grant Type Issuers - -Use this endpoint to list all trusted JWT Bearer Grant Type Issuers. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiAdminListTrustedOAuth2JwtGrantIssuersRequest -*/ -func (a *V0alpha2ApiService) AdminListTrustedOAuth2JwtGrantIssuers(ctx context.Context) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { - return ApiAdminListTrustedOAuth2JwtGrantIssuersRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return []TrustedOAuth2JwtGrantIssuer -func (a *V0alpha2ApiService) AdminListTrustedOAuth2JwtGrantIssuersExecute(r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue []TrustedOAuth2JwtGrantIssuer - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminListTrustedOAuth2JwtGrantIssuers") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - if r.maxItems != nil { - localVarQueryParams.Add("MaxItems", parameterToString(*r.maxItems, "")) - } - if r.defaultItems != nil { - localVarQueryParams.Add("DefaultItems", parameterToString(*r.defaultItems, "")) - } - if r.issuer != nil { - localVarQueryParams.Add("issuer", parameterToString(*r.issuer, "")) - } - if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } - if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1188,33 +343,43 @@ func (a *V0alpha2ApiService) AdminListTrustedOAuth2JwtGrantIssuersExecute(r ApiA return localVarReturnValue, localVarHTTPResponse, nil } -type ApiAdminTrustOAuth2JwtGrantIssuerRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - adminTrustOAuth2JwtGrantIssuerBody *AdminTrustOAuth2JwtGrantIssuerBody +type ApiAdminIntrospectOAuth2TokenRequest struct { + ctx context.Context + ApiService *V0alpha2ApiService + token *string + scope *string } -func (r ApiAdminTrustOAuth2JwtGrantIssuerRequest) AdminTrustOAuth2JwtGrantIssuerBody(adminTrustOAuth2JwtGrantIssuerBody AdminTrustOAuth2JwtGrantIssuerBody) ApiAdminTrustOAuth2JwtGrantIssuerRequest { - r.adminTrustOAuth2JwtGrantIssuerBody = &adminTrustOAuth2JwtGrantIssuerBody +// The string value of the token. For access tokens, this is the \\\"access_token\\\" value returned from the token endpoint defined in OAuth 2.0. For refresh tokens, this is the \\\"refresh_token\\\" value returned. +func (r ApiAdminIntrospectOAuth2TokenRequest) Token(token string) ApiAdminIntrospectOAuth2TokenRequest { + r.token = &token return r } -func (r ApiAdminTrustOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { - return r.ApiService.AdminTrustOAuth2JwtGrantIssuerExecute(r) +// An optional, space separated list of required scopes. If the access token was not granted one of the scopes, the result of active will be false. +func (r ApiAdminIntrospectOAuth2TokenRequest) Scope(scope string) ApiAdminIntrospectOAuth2TokenRequest { + r.scope = &scope + return r +} + +func (r ApiAdminIntrospectOAuth2TokenRequest) Execute() (*IntrospectedOAuth2Token, *http.Response, error) { + return r.ApiService.AdminIntrospectOAuth2TokenExecute(r) } /* -AdminTrustOAuth2JwtGrantIssuer Trust an OAuth2 JWT Bearer Grant Type Issuer +AdminIntrospectOAuth2Token Introspect OAuth2 Access or Refresh Tokens -Use this endpoint to establish a trust relationship for a JWT issuer -to perform JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication -and Authorization Grants [RFC7523](https://datatracker.ietf.org/doc/html/rfc7523). +The introspection endpoint allows to check if a token (both refresh and access) is active or not. An active token +is neither expired nor revoked. If a token is active, additional information on the token will be included. You can +set additional data for a token by setting `accessTokenExtra` during the consent flow. + +For more information [read this blog post](https://www.oauth.com/oauth2-servers/token-introspection-endpoint/). @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiAdminTrustOAuth2JwtGrantIssuerRequest + @return ApiAdminIntrospectOAuth2TokenRequest */ -func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuer(ctx context.Context) ApiAdminTrustOAuth2JwtGrantIssuerRequest { - return ApiAdminTrustOAuth2JwtGrantIssuerRequest{ +func (a *V0alpha2ApiService) AdminIntrospectOAuth2Token(ctx context.Context) ApiAdminIntrospectOAuth2TokenRequest { + return ApiAdminIntrospectOAuth2TokenRequest{ ApiService: a, ctx: ctx, } @@ -1222,28 +387,31 @@ func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuer(ctx context.Context) // Execute executes the request // -// @return TrustedOAuth2JwtGrantIssuer -func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuerExecute(r ApiAdminTrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { +// @return IntrospectedOAuth2Token +func (a *V0alpha2ApiService) AdminIntrospectOAuth2TokenExecute(r ApiAdminIntrospectOAuth2TokenRequest) (*IntrospectedOAuth2Token, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *TrustedOAuth2JwtGrantIssuer + localVarReturnValue *IntrospectedOAuth2Token ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminTrustOAuth2JwtGrantIssuer") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminIntrospectOAuth2Token") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers" + localVarPath := localBasePath + "/admin/oauth2/introspect" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.token == nil { + return localVarReturnValue, nil, reportError("token is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{"application/x-www-form-urlencoded"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1259,8 +427,10 @@ func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuerExecute(r ApiAdminTru if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.adminTrustOAuth2JwtGrantIssuerBody + if r.scope != nil { + localVarFormParams.Add("scope", parameterToString(*r.scope, "")) + } + localVarFormParams.Add("token", parameterToString(*r.token, "")) req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1283,7 +453,7 @@ func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuerExecute(r ApiAdminTru body: localVarBody, error: localVarHTTPResponse.Status, } - var v GenericError + var v ErrorOAuth2 err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1305,70 +475,102 @@ func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuerExecute(r ApiAdminTru return localVarReturnValue, localVarHTTPResponse, nil } -type ApiAdminUpdateJsonWebKeyRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string - kid string - jsonWebKey *JsonWebKey +type ApiAdminListTrustedOAuth2JwtGrantIssuersRequest struct { + ctx context.Context + ApiService *V0alpha2ApiService + maxItems *int64 + defaultItems *int64 + issuer *string + limit *int64 + offset *int64 +} + +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) MaxItems(maxItems int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + r.maxItems = &maxItems + return r +} + +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) DefaultItems(defaultItems int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + r.defaultItems = &defaultItems + return r } -func (r ApiAdminUpdateJsonWebKeyRequest) JsonWebKey(jsonWebKey JsonWebKey) ApiAdminUpdateJsonWebKeyRequest { - r.jsonWebKey = &jsonWebKey +// If optional \"issuer\" is supplied, only jwt-bearer grants with this issuer will be returned. +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Issuer(issuer string) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + r.issuer = &issuer return r } -func (r ApiAdminUpdateJsonWebKeyRequest) Execute() (*JsonWebKey, *http.Response, error) { - return r.ApiService.AdminUpdateJsonWebKeyExecute(r) +// The maximum amount of policies returned, upper bound is 500 policies +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Limit(limit int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + r.limit = &limit + return r } -/* -AdminUpdateJsonWebKey Update a JSON Web Key +// The offset from where to start looking. +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Offset(offset int64) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + r.offset = &offset + return r +} + +func (r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) Execute() ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) { + return r.ApiService.AdminListTrustedOAuth2JwtGrantIssuersExecute(r) +} -Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. +/* +AdminListTrustedOAuth2JwtGrantIssuers List Trusted OAuth2 JWT Bearer Grant Type Issuers -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. +Use this endpoint to list all trusted JWT Bearer Grant Type Issuers. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @param kid The JSON Web Key ID (kid) - @return ApiAdminUpdateJsonWebKeyRequest + @return ApiAdminListTrustedOAuth2JwtGrantIssuersRequest */ -func (a *V0alpha2ApiService) AdminUpdateJsonWebKey(ctx context.Context, set string, kid string) ApiAdminUpdateJsonWebKeyRequest { - return ApiAdminUpdateJsonWebKeyRequest{ +func (a *V0alpha2ApiService) AdminListTrustedOAuth2JwtGrantIssuers(ctx context.Context) ApiAdminListTrustedOAuth2JwtGrantIssuersRequest { + return ApiAdminListTrustedOAuth2JwtGrantIssuersRequest{ ApiService: a, ctx: ctx, - set: set, - kid: kid, } } // Execute executes the request // -// @return JsonWebKey -func (a *V0alpha2ApiService) AdminUpdateJsonWebKeyExecute(r ApiAdminUpdateJsonWebKeyRequest) (*JsonWebKey, *http.Response, error) { +// @return []TrustedOAuth2JwtGrantIssuer +func (a *V0alpha2ApiService) AdminListTrustedOAuth2JwtGrantIssuersExecute(r ApiAdminListTrustedOAuth2JwtGrantIssuersRequest) ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *JsonWebKey + localVarReturnValue []TrustedOAuth2JwtGrantIssuer ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminUpdateJsonWebKey") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminListTrustedOAuth2JwtGrantIssuers") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/admin/keys/{set}/{kid}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"kid"+"}", url.PathEscape(parameterToString(r.kid, "")), -1) + localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.maxItems != nil { + localVarQueryParams.Add("MaxItems", parameterToString(*r.maxItems, "")) + } + if r.defaultItems != nil { + localVarQueryParams.Add("DefaultItems", parameterToString(*r.defaultItems, "")) + } + if r.issuer != nil { + localVarQueryParams.Add("issuer", parameterToString(*r.issuer, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -1384,8 +586,6 @@ func (a *V0alpha2ApiService) AdminUpdateJsonWebKeyExecute(r ApiAdminUpdateJsonWe if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.jsonWebKey req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1408,7 +608,7 @@ func (a *V0alpha2ApiService) AdminUpdateJsonWebKeyExecute(r ApiAdminUpdateJsonWe body: localVarBody, error: localVarHTTPResponse.Status, } - var v ErrorOAuth2 + var v GenericError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1430,59 +630,55 @@ func (a *V0alpha2ApiService) AdminUpdateJsonWebKeyExecute(r ApiAdminUpdateJsonWe return localVarReturnValue, localVarHTTPResponse, nil } -type ApiAdminUpdateJsonWebKeySetRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService - set string - jsonWebKeySet *JsonWebKeySet +type ApiAdminTrustOAuth2JwtGrantIssuerRequest struct { + ctx context.Context + ApiService *V0alpha2ApiService + adminTrustOAuth2JwtGrantIssuerBody *AdminTrustOAuth2JwtGrantIssuerBody } -func (r ApiAdminUpdateJsonWebKeySetRequest) JsonWebKeySet(jsonWebKeySet JsonWebKeySet) ApiAdminUpdateJsonWebKeySetRequest { - r.jsonWebKeySet = &jsonWebKeySet +func (r ApiAdminTrustOAuth2JwtGrantIssuerRequest) AdminTrustOAuth2JwtGrantIssuerBody(adminTrustOAuth2JwtGrantIssuerBody AdminTrustOAuth2JwtGrantIssuerBody) ApiAdminTrustOAuth2JwtGrantIssuerRequest { + r.adminTrustOAuth2JwtGrantIssuerBody = &adminTrustOAuth2JwtGrantIssuerBody return r } -func (r ApiAdminUpdateJsonWebKeySetRequest) Execute() (*JsonWebKeySet, *http.Response, error) { - return r.ApiService.AdminUpdateJsonWebKeySetExecute(r) +func (r ApiAdminTrustOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { + return r.ApiService.AdminTrustOAuth2JwtGrantIssuerExecute(r) } /* -AdminUpdateJsonWebKeySet Update a JSON Web Key Set - -Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. +AdminTrustOAuth2JwtGrantIssuer Trust an OAuth2 JWT Bearer Grant Type Issuer -A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. +Use this endpoint to establish a trust relationship for a JWT issuer +to perform JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication +and Authorization Grants [RFC7523](https://datatracker.ietf.org/doc/html/rfc7523). @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param set The JSON Web Key Set - @return ApiAdminUpdateJsonWebKeySetRequest + @return ApiAdminTrustOAuth2JwtGrantIssuerRequest */ -func (a *V0alpha2ApiService) AdminUpdateJsonWebKeySet(ctx context.Context, set string) ApiAdminUpdateJsonWebKeySetRequest { - return ApiAdminUpdateJsonWebKeySetRequest{ +func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuer(ctx context.Context) ApiAdminTrustOAuth2JwtGrantIssuerRequest { + return ApiAdminTrustOAuth2JwtGrantIssuerRequest{ ApiService: a, ctx: ctx, - set: set, } } // Execute executes the request // -// @return JsonWebKeySet -func (a *V0alpha2ApiService) AdminUpdateJsonWebKeySetExecute(r ApiAdminUpdateJsonWebKeySetRequest) (*JsonWebKeySet, *http.Response, error) { +// @return TrustedOAuth2JwtGrantIssuer +func (a *V0alpha2ApiService) AdminTrustOAuth2JwtGrantIssuerExecute(r ApiAdminTrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodPut + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *JsonWebKeySet + localVarReturnValue *TrustedOAuth2JwtGrantIssuer ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminUpdateJsonWebKeySet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.AdminTrustOAuth2JwtGrantIssuer") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/admin/keys/{set}" - localVarPath = strings.Replace(localVarPath, "{"+"set"+"}", url.PathEscape(parameterToString(r.set, "")), -1) + localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1506,7 +702,7 @@ func (a *V0alpha2ApiService) AdminUpdateJsonWebKeySetExecute(r ApiAdminUpdateJso localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.jsonWebKeySet + localVarPostBody = r.adminTrustOAuth2JwtGrantIssuerBody req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, err @@ -1529,7 +725,7 @@ func (a *V0alpha2ApiService) AdminUpdateJsonWebKeySetExecute(r ApiAdminUpdateJso body: localVarBody, error: localVarHTTPResponse.Status, } - var v ErrorOAuth2 + var v GenericError err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.error = err.Error() @@ -1660,115 +856,6 @@ func (a *V0alpha2ApiService) DeleteOidcDynamicClientExecute(r ApiDeleteOidcDynam return localVarHTTPResponse, nil } -type ApiDiscoverJsonWebKeysRequest struct { - ctx context.Context - ApiService *V0alpha2ApiService -} - -func (r ApiDiscoverJsonWebKeysRequest) Execute() (*JsonWebKeySet, *http.Response, error) { - return r.ApiService.DiscoverJsonWebKeysExecute(r) -} - -/* -DiscoverJsonWebKeys Discover JSON Web Keys - -This endpoint returns JSON Web Keys required to verifying OpenID Connect ID Tokens and, -if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like -[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiDiscoverJsonWebKeysRequest -*/ -func (a *V0alpha2ApiService) DiscoverJsonWebKeys(ctx context.Context) ApiDiscoverJsonWebKeysRequest { - return ApiDiscoverJsonWebKeysRequest{ - ApiService: a, - ctx: ctx, - } -} - -// Execute executes the request -// -// @return JsonWebKeySet -func (a *V0alpha2ApiService) DiscoverJsonWebKeysExecute(r ApiDiscoverJsonWebKeysRequest) (*JsonWebKeySet, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *JsonWebKeySet - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "V0alpha2ApiService.DiscoverJsonWebKeys") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/.well-known/jwks.json" - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - var v ErrorOAuth2 - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - type ApiDiscoverOidcConfigurationRequest struct { ctx context.Context ApiService *V0alpha2ApiService diff --git a/internal/httpclient/api_wellknown.go b/internal/httpclient/api_wellknown.go new file mode 100644 index 00000000000..2ba904fa4ef --- /dev/null +++ b/internal/httpclient/api_wellknown.go @@ -0,0 +1,132 @@ +/* +Ory Hydra API + +Documentation for all of Ory Hydra's APIs. + +API version: +Contact: hi@ory.sh +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + +// WellknownApiService WellknownApi service +type WellknownApiService service + +type ApiDiscoverJsonWebKeysRequest struct { + ctx context.Context + ApiService *WellknownApiService +} + +func (r ApiDiscoverJsonWebKeysRequest) Execute() (*JsonWebKeySet, *http.Response, error) { + return r.ApiService.DiscoverJsonWebKeysExecute(r) +} + +/* +DiscoverJsonWebKeys Discover Well-Known JSON Web Keys + +This endpoint returns JSON Web Keys required to verifying OpenID Connect ID Tokens and, +if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like +[node-jwks-rsa](https://github.com/auth0/node-jwks-rsa) among others. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDiscoverJsonWebKeysRequest +*/ +func (a *WellknownApiService) DiscoverJsonWebKeys(ctx context.Context) ApiDiscoverJsonWebKeysRequest { + return ApiDiscoverJsonWebKeysRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return JsonWebKeySet +func (a *WellknownApiService) DiscoverJsonWebKeysExecute(r ApiDiscoverJsonWebKeysRequest) (*JsonWebKeySet, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JsonWebKeySet + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WellknownApiService.DiscoverJsonWebKeys") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/.well-known/jwks.json" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v ErrorOAuth2 + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/internal/httpclient/client.go b/internal/httpclient/client.go index 13285b70da7..2aea075c664 100644 --- a/internal/httpclient/client.go +++ b/internal/httpclient/client.go @@ -50,6 +50,8 @@ type APIClient struct { // API Services + JwkApi *JwkApiService + MetadataApi *MetadataApiService OAuth2Api *OAuth2ApiService @@ -57,6 +59,8 @@ type APIClient struct { OidcApi *OidcApiService V0alpha2Api *V0alpha2ApiService + + WellknownApi *WellknownApiService } type service struct { @@ -75,10 +79,12 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services + c.JwkApi = (*JwkApiService)(&c.common) c.MetadataApi = (*MetadataApiService)(&c.common) c.OAuth2Api = (*OAuth2ApiService)(&c.common) c.OidcApi = (*OidcApiService)(&c.common) c.V0alpha2Api = (*V0alpha2ApiService)(&c.common) + c.WellknownApi = (*WellknownApiService)(&c.common) return c } diff --git a/internal/httpclient/docs/AdminCreateJsonWebKeySetBody.md b/internal/httpclient/docs/AdminCreateJsonWebKeySetBody.md deleted file mode 100644 index 886f1cd3334..00000000000 --- a/internal/httpclient/docs/AdminCreateJsonWebKeySetBody.md +++ /dev/null @@ -1,90 +0,0 @@ -# AdminCreateJsonWebKeySetBody - -## Properties - -| Name | Type | Description | Notes | -| ------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- | -| **Alg** | **string** | The algorithm to be used for creating the key. Supports \"RS256\", \"ES256\", \"ES512\", \"HS512\", and \"HS256\" | -| **Kid** | **string** | The kid of the key to be created | -| **Use** | **string** | The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Valid values are \"enc\" and \"sig\". | - -## Methods - -### NewAdminCreateJsonWebKeySetBody - -`func NewAdminCreateJsonWebKeySetBody(alg string, kid string, use string, ) *AdminCreateJsonWebKeySetBody` - -NewAdminCreateJsonWebKeySetBody instantiates a new AdminCreateJsonWebKeySetBody -object This constructor will assign default values to properties that have it -defined, and makes sure properties required by API are set, but the set of -arguments will change when the set of required properties is changed - -### NewAdminCreateJsonWebKeySetBodyWithDefaults - -`func NewAdminCreateJsonWebKeySetBodyWithDefaults() *AdminCreateJsonWebKeySetBody` - -NewAdminCreateJsonWebKeySetBodyWithDefaults instantiates a new -AdminCreateJsonWebKeySetBody object This constructor will only assign default -values to properties that have it defined, but it doesn't guarantee that -properties required by API are set - -### GetAlg - -`func (o *AdminCreateJsonWebKeySetBody) GetAlg() string` - -GetAlg returns the Alg field if non-nil, zero value otherwise. - -### GetAlgOk - -`func (o *AdminCreateJsonWebKeySetBody) GetAlgOk() (*string, bool)` - -GetAlgOk returns a tuple with the Alg field if it's non-nil, zero value -otherwise and a boolean to check if the value has been set. - -### SetAlg - -`func (o *AdminCreateJsonWebKeySetBody) SetAlg(v string)` - -SetAlg sets Alg field to given value. - -### GetKid - -`func (o *AdminCreateJsonWebKeySetBody) GetKid() string` - -GetKid returns the Kid field if non-nil, zero value otherwise. - -### GetKidOk - -`func (o *AdminCreateJsonWebKeySetBody) GetKidOk() (*string, bool)` - -GetKidOk returns a tuple with the Kid field if it's non-nil, zero value -otherwise and a boolean to check if the value has been set. - -### SetKid - -`func (o *AdminCreateJsonWebKeySetBody) SetKid(v string)` - -SetKid sets Kid field to given value. - -### GetUse - -`func (o *AdminCreateJsonWebKeySetBody) GetUse() string` - -GetUse returns the Use field if non-nil, zero value otherwise. - -### GetUseOk - -`func (o *AdminCreateJsonWebKeySetBody) GetUseOk() (*string, bool)` - -GetUseOk returns a tuple with the Use field if it's non-nil, zero value -otherwise and a boolean to check if the value has been set. - -### SetUse - -`func (o *AdminCreateJsonWebKeySetBody) SetUse(v string)` - -SetUse sets Use field to given value. - -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to README]](../README.md) diff --git a/internal/httpclient/docs/CreateJsonWebKeySet.md b/internal/httpclient/docs/CreateJsonWebKeySet.md new file mode 100644 index 00000000000..41b610c237b --- /dev/null +++ b/internal/httpclient/docs/CreateJsonWebKeySet.md @@ -0,0 +1,89 @@ +# CreateJsonWebKeySet + +## Properties + +| Name | Type | Description | Notes | +| ------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| **Alg** | **string** | JSON Web Key Algorithm The algorithm to be used for creating the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`. | +| **Kid** | **string** | JSON Web Key ID The Key ID of the key to be created. | +| **Use** | **string** | JSON Web Key Use The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Valid values are \"enc\" and \"sig\". | + +## Methods + +### NewCreateJsonWebKeySet + +`func NewCreateJsonWebKeySet(alg string, kid string, use string, ) *CreateJsonWebKeySet` + +NewCreateJsonWebKeySet instantiates a new CreateJsonWebKeySet object This +constructor will assign default values to properties that have it defined, and +makes sure properties required by API are set, but the set of arguments will +change when the set of required properties is changed + +### NewCreateJsonWebKeySetWithDefaults + +`func NewCreateJsonWebKeySetWithDefaults() *CreateJsonWebKeySet` + +NewCreateJsonWebKeySetWithDefaults instantiates a new CreateJsonWebKeySet object +This constructor will only assign default values to properties that have it +defined, but it doesn't guarantee that properties required by API are set + +### GetAlg + +`func (o *CreateJsonWebKeySet) GetAlg() string` + +GetAlg returns the Alg field if non-nil, zero value otherwise. + +### GetAlgOk + +`func (o *CreateJsonWebKeySet) GetAlgOk() (*string, bool)` + +GetAlgOk returns a tuple with the Alg field if it's non-nil, zero value +otherwise and a boolean to check if the value has been set. + +### SetAlg + +`func (o *CreateJsonWebKeySet) SetAlg(v string)` + +SetAlg sets Alg field to given value. + +### GetKid + +`func (o *CreateJsonWebKeySet) GetKid() string` + +GetKid returns the Kid field if non-nil, zero value otherwise. + +### GetKidOk + +`func (o *CreateJsonWebKeySet) GetKidOk() (*string, bool)` + +GetKidOk returns a tuple with the Kid field if it's non-nil, zero value +otherwise and a boolean to check if the value has been set. + +### SetKid + +`func (o *CreateJsonWebKeySet) SetKid(v string)` + +SetKid sets Kid field to given value. + +### GetUse + +`func (o *CreateJsonWebKeySet) GetUse() string` + +GetUse returns the Use field if non-nil, zero value otherwise. + +### GetUseOk + +`func (o *CreateJsonWebKeySet) GetUseOk() (*string, bool)` + +GetUseOk returns a tuple with the Use field if it's non-nil, zero value +otherwise and a boolean to check if the value has been set. + +### SetUse + +`func (o *CreateJsonWebKeySet) SetUse(v string)` + +SetUse sets Use field to given value. + +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to README]](../README.md) diff --git a/internal/httpclient/docs/JsonWebKeySet.md b/internal/httpclient/docs/JsonWebKeySet.md index 8ac5999d474..5d1de2a787a 100644 --- a/internal/httpclient/docs/JsonWebKeySet.md +++ b/internal/httpclient/docs/JsonWebKeySet.md @@ -2,9 +2,9 @@ ## Properties -| Name | Type | Description | Notes | -| -------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -| **Keys** | Pointer to [**[]JsonWebKey**](JsonWebKey.md) | The value of the \"keys\" parameter is an array of JSON Web Key (JWK) values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. | [optional] | +| Name | Type | Description | Notes | +| -------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| **Keys** | Pointer to [**[]JsonWebKey**](JsonWebKey.md) | List of JSON Web Keys The value of the \"keys\" parameter is an array of JSON Web Key (JWK) values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. | [optional] | ## Methods diff --git a/internal/httpclient/docs/JwkApi.md b/internal/httpclient/docs/JwkApi.md new file mode 100644 index 00000000000..a530a7b322f --- /dev/null +++ b/internal/httpclient/docs/JwkApi.md @@ -0,0 +1,488 @@ +# \JwkApi + +All URIs are relative to _http://localhost_ + +| Method | HTTP request | Description | +| -------------------------------------------------------- | ---------------------------------- | --------------------------- | +| [**CreateJsonWebKeySet**](JwkApi.md#CreateJsonWebKeySet) | **Post** /admin/keys/{set} | Create JSON Web Key | +| [**DeleteJsonWebKey**](JwkApi.md#DeleteJsonWebKey) | **Delete** /admin/keys/{set}/{kid} | Delete JSON Web Key | +| [**DeleteJsonWebKeySet**](JwkApi.md#DeleteJsonWebKeySet) | **Delete** /admin/keys/{set} | Delete JSON Web Key Set | +| [**GetJsonWebKey**](JwkApi.md#GetJsonWebKey) | **Get** /admin/keys/{set}/{kid} | Get JSON Web Key | +| [**GetJsonWebKeySet**](JwkApi.md#GetJsonWebKeySet) | **Get** /admin/keys/{set} | Retrieve a JSON Web Key Set | +| [**SetJsonWebKey**](JwkApi.md#SetJsonWebKey) | **Put** /admin/keys/{set}/{kid} | Set JSON Web Key | +| [**SetJsonWebKeySet**](JwkApi.md#SetJsonWebKeySet) | **Put** /admin/keys/{set} | Update a JSON Web Key Set | + +## CreateJsonWebKeySet + +> JsonWebKeySet CreateJsonWebKeySet(ctx, +> set).CreateJsonWebKeySet(createJsonWebKeySet).Execute() + +Create JSON Web Key + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | The JSON Web Key Set ID + createJsonWebKeySet := *openapiclient.NewCreateJsonWebKeySet("Alg_example", "Kid_example", "Use_example") // CreateJsonWebKeySet | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.CreateJsonWebKeySet(context.Background(), set).CreateJsonWebKeySet(createJsonWebKeySet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.CreateJsonWebKeySet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CreateJsonWebKeySet`: JsonWebKeySet + fmt.Fprintf(os.Stdout, "Response from `JwkApi.CreateJsonWebKeySet`: %v\n", resp) +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | The JSON Web Key Set ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCreateJsonWebKeySetRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +**createJsonWebKeySet** | [**CreateJsonWebKeySet**](CreateJsonWebKeySet.md) | | + +### Return type + +[**JsonWebKeySet**](JsonWebKeySet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## DeleteJsonWebKey + +> DeleteJsonWebKey(ctx, set, kid).Execute() + +Delete JSON Web Key + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | The JSON Web Key Set + kid := "kid_example" // string | The JSON Web Key ID (kid) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.DeleteJsonWebKey(context.Background(), set, kid).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.DeleteJsonWebKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | The JSON Web Key Set | +| **kid** | **string** | The JSON Web Key ID (kid) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteJsonWebKeyRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +### Return type + +(empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## DeleteJsonWebKeySet + +> DeleteJsonWebKeySet(ctx, set).Execute() + +Delete JSON Web Key Set + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | The JSON Web Key Set + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.DeleteJsonWebKeySet(context.Background(), set).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.DeleteJsonWebKeySet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | The JSON Web Key Set | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteJsonWebKeySetRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +### Return type + +(empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## GetJsonWebKey + +> JsonWebKeySet GetJsonWebKey(ctx, set, kid).Execute() + +Get JSON Web Key + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | JSON Web Key Set ID + kid := "kid_example" // string | JSON Web Key ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.GetJsonWebKey(context.Background(), set, kid).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.GetJsonWebKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetJsonWebKey`: JsonWebKeySet + fmt.Fprintf(os.Stdout, "Response from `JwkApi.GetJsonWebKey`: %v\n", resp) +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | JSON Web Key Set ID | +| **kid** | **string** | JSON Web Key ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetJsonWebKeyRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +### Return type + +[**JsonWebKeySet**](JsonWebKeySet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## GetJsonWebKeySet + +> JsonWebKeySet GetJsonWebKeySet(ctx, set).Execute() + +Retrieve a JSON Web Key Set + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | JSON Web Key Set ID + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.GetJsonWebKeySet(context.Background(), set).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.GetJsonWebKeySet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetJsonWebKeySet`: JsonWebKeySet + fmt.Fprintf(os.Stdout, "Response from `JwkApi.GetJsonWebKeySet`: %v\n", resp) +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | JSON Web Key Set ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetJsonWebKeySetRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +### Return type + +[**JsonWebKeySet**](JsonWebKeySet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## SetJsonWebKey + +> JsonWebKey SetJsonWebKey(ctx, set, kid).JsonWebKey(jsonWebKey).Execute() + +Set JSON Web Key + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | The JSON Web Key Set ID + kid := "kid_example" // string | JSON Web Key ID + jsonWebKey := *openapiclient.NewJsonWebKey("RS256", "1603dfe0af8f4596", "RSA", "sig") // JsonWebKey | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.SetJsonWebKey(context.Background(), set, kid).JsonWebKey(jsonWebKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.SetJsonWebKey``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SetJsonWebKey`: JsonWebKey + fmt.Fprintf(os.Stdout, "Response from `JwkApi.SetJsonWebKey`: %v\n", resp) +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | The JSON Web Key Set ID | +| **kid** | **string** | JSON Web Key ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetJsonWebKeyRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +**jsonWebKey** | [**JsonWebKey**](JsonWebKey.md) | | + +### Return type + +[**JsonWebKey**](JsonWebKey.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + +## SetJsonWebKeySet + +> JsonWebKeySet SetJsonWebKeySet(ctx, +> set).JsonWebKeySet(jsonWebKeySet).Execute() + +Update a JSON Web Key Set + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + set := "set_example" // string | The JSON Web Key Set ID + jsonWebKeySet := *openapiclient.NewJsonWebKeySet() // JsonWebKeySet | (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.JwkApi.SetJsonWebKeySet(context.Background(), set).JsonWebKeySet(jsonWebKeySet).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `JwkApi.SetJsonWebKeySet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SetJsonWebKeySet`: JsonWebKeySet + fmt.Fprintf(os.Stdout, "Response from `JwkApi.SetJsonWebKeySet`: %v\n", resp) +} +``` + +### Path Parameters + +| Name | Type | Description | Notes | +| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | +| **set** | **string** | The JSON Web Key Set ID | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetJsonWebKeySetRequest +struct via the builder pattern + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +**jsonWebKeySet** | [**JsonWebKeySet**](JsonWebKeySet.md) | | + +### Return type + +[**JsonWebKeySet**](JsonWebKeySet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/internal/httpclient/docs/OAuth2ConsentSession.md b/internal/httpclient/docs/OAuth2ConsentSession.md index 7a01fe70908..c6f0824cb67 100644 --- a/internal/httpclient/docs/OAuth2ConsentSession.md +++ b/internal/httpclient/docs/OAuth2ConsentSession.md @@ -2,16 +2,16 @@ ## Properties -| Name | Type | Description | Notes | -| ---------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | -| **ConsentRequest** | Pointer to [**OAuth2ConsentRequest**](OAuth2ConsentRequest.md) | | [optional] | -| **ExpiresAt** | Pointer to [**OAuth2ConsentSessionExpiresAt**](OAuth2ConsentSessionExpiresAt.md) | | [optional] | -| **GrantAccessTokenAudience** | Pointer to **[]string** | | [optional] | -| **GrantScope** | Pointer to **[]string** | | [optional] | -| **HandledAt** | Pointer to **time.Time** | | [optional] | -| **Remember** | Pointer to **bool** | Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. | [optional] | -| **RememberFor** | Pointer to **int64** | RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. | [optional] | -| **Session** | Pointer to [**AcceptOAuth2ConsentRequestSession**](AcceptOAuth2ConsentRequestSession.md) | | [optional] | +| Name | Type | Description | Notes | +| ---------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | +| **ConsentRequest** | Pointer to [**OAuth2ConsentRequest**](OAuth2ConsentRequest.md) | | [optional] | +| **ExpiresAt** | Pointer to [**OAuth2ConsentSessionExpiresAt**](OAuth2ConsentSessionExpiresAt.md) | | [optional] | +| **GrantAccessTokenAudience** | Pointer to **[]string** | | [optional] | +| **GrantScope** | Pointer to **[]string** | | [optional] | +| **HandledAt** | Pointer to **time.Time** | | [optional] | +| **Remember** | Pointer to **bool** | Remember Consent Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. | [optional] | +| **RememberFor** | Pointer to **int64** | Remember Consent For RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. | [optional] | +| **Session** | Pointer to [**AcceptOAuth2ConsentRequestSession**](AcceptOAuth2ConsentRequestSession.md) | | [optional] | ## Methods diff --git a/internal/httpclient/docs/V0alpha2Api.md b/internal/httpclient/docs/V0alpha2Api.md index 34ea7707868..d66c370d517 100644 --- a/internal/httpclient/docs/V0alpha2Api.md +++ b/internal/httpclient/docs/V0alpha2Api.md @@ -4,21 +4,13 @@ All URIs are relative to _http://localhost_ | Method | HTTP request | Description | | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -| [**AdminCreateJsonWebKeySet**](V0alpha2Api.md#AdminCreateJsonWebKeySet) | **Post** /admin/keys/{set} | Generate a New JSON Web Key | -| [**AdminDeleteJsonWebKey**](V0alpha2Api.md#AdminDeleteJsonWebKey) | **Delete** /admin/keys/{set}/{kid} | Delete a JSON Web Key | -| [**AdminDeleteJsonWebKeySet**](V0alpha2Api.md#AdminDeleteJsonWebKeySet) | **Delete** /admin/keys/{set} | Delete a JSON Web Key Set | | [**AdminDeleteOAuth2Token**](V0alpha2Api.md#AdminDeleteOAuth2Token) | **Delete** /admin/oauth2/tokens | Delete OAuth2 Access Tokens from a Client | | [**AdminDeleteTrustedOAuth2JwtGrantIssuer**](V0alpha2Api.md#AdminDeleteTrustedOAuth2JwtGrantIssuer) | **Delete** /admin/trust/grants/jwt-bearer/issuers/{id} | Delete a Trusted OAuth2 JWT Bearer Grant Type Issuer | -| [**AdminGetJsonWebKey**](V0alpha2Api.md#AdminGetJsonWebKey) | **Get** /admin/keys/{set}/{kid} | Fetch a JSON Web Key | -| [**AdminGetJsonWebKeySet**](V0alpha2Api.md#AdminGetJsonWebKeySet) | **Get** /admin/keys/{set} | Retrieve a JSON Web Key Set | | [**AdminGetTrustedOAuth2JwtGrantIssuer**](V0alpha2Api.md#AdminGetTrustedOAuth2JwtGrantIssuer) | **Get** /admin/trust/grants/jwt-bearer/issuers/{id} | Get a Trusted OAuth2 JWT Bearer Grant Type Issuer | | [**AdminIntrospectOAuth2Token**](V0alpha2Api.md#AdminIntrospectOAuth2Token) | **Post** /admin/oauth2/introspect | Introspect OAuth2 Access or Refresh Tokens | | [**AdminListTrustedOAuth2JwtGrantIssuers**](V0alpha2Api.md#AdminListTrustedOAuth2JwtGrantIssuers) | **Get** /admin/trust/grants/jwt-bearer/issuers | List Trusted OAuth2 JWT Bearer Grant Type Issuers | | [**AdminTrustOAuth2JwtGrantIssuer**](V0alpha2Api.md#AdminTrustOAuth2JwtGrantIssuer) | **Post** /admin/trust/grants/jwt-bearer/issuers | Trust an OAuth2 JWT Bearer Grant Type Issuer | -| [**AdminUpdateJsonWebKey**](V0alpha2Api.md#AdminUpdateJsonWebKey) | **Put** /admin/keys/{set}/{kid} | Update a JSON Web Key | -| [**AdminUpdateJsonWebKeySet**](V0alpha2Api.md#AdminUpdateJsonWebKeySet) | **Put** /admin/keys/{set} | Update a JSON Web Key Set | | [**DeleteOidcDynamicClient**](V0alpha2Api.md#DeleteOidcDynamicClient) | **Delete** /oauth2/register/{id} | Delete OAuth 2.0 Client using the OpenID Dynamic Client Registration Management Protocol | -| [**DiscoverJsonWebKeys**](V0alpha2Api.md#DiscoverJsonWebKeys) | **Get** /.well-known/jwks.json | Discover JSON Web Keys | | [**DiscoverOidcConfiguration**](V0alpha2Api.md#DiscoverOidcConfiguration) | **Get** /.well-known/openid-configuration | OpenID Connect Discovery | | [**GetOidcUserInfo**](V0alpha2Api.md#GetOidcUserInfo) | **Get** /userinfo | OpenID Connect Userinfo | | [**PerformOAuth2AuthorizationFlow**](V0alpha2Api.md#PerformOAuth2AuthorizationFlow) | **Get** /oauth2/auth | The OAuth 2.0 Authorize Endpoint | @@ -26,207 +18,6 @@ All URIs are relative to _http://localhost_ | [**PerformOidcFrontOrBackChannelLogout**](V0alpha2Api.md#PerformOidcFrontOrBackChannelLogout) | **Get** /oauth2/sessions/logout | OpenID Connect Front- or Back-channel Enabled Logout | | [**RevokeOAuth2Token**](V0alpha2Api.md#RevokeOAuth2Token) | **Post** /oauth2/revoke | Revoke an OAuth2 Access or Refresh Token | -## AdminCreateJsonWebKeySet - -> JsonWebKeySet AdminCreateJsonWebKeySet(ctx, -> set).AdminCreateJsonWebKeySetBody(adminCreateJsonWebKeySetBody).Execute() - -Generate a New JSON Web Key - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - adminCreateJsonWebKeySetBody := *openapiclient.NewAdminCreateJsonWebKeySetBody("Alg_example", "Kid_example", "Use_example") // AdminCreateJsonWebKeySetBody | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminCreateJsonWebKeySet(context.Background(), set).AdminCreateJsonWebKeySetBody(adminCreateJsonWebKeySetBody).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminCreateJsonWebKeySet``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AdminCreateJsonWebKeySet`: JsonWebKeySet - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.AdminCreateJsonWebKeySet`: %v\n", resp) -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminCreateJsonWebKeySetRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -**adminCreateJsonWebKeySetBody** | -[**AdminCreateJsonWebKeySetBody**](AdminCreateJsonWebKeySetBody.md) | | - -### Return type - -[**JsonWebKeySet**](JsonWebKeySet.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## AdminDeleteJsonWebKey - -> AdminDeleteJsonWebKey(ctx, set, kid).Execute() - -Delete a JSON Web Key - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - kid := "kid_example" // string | The JSON Web Key ID (kid) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminDeleteJsonWebKey(context.Background(), set, kid).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminDeleteJsonWebKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | -| **kid** | **string** | The JSON Web Key ID (kid) | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminDeleteJsonWebKeyRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -### Return type - -(empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## AdminDeleteJsonWebKeySet - -> AdminDeleteJsonWebKeySet(ctx, set).Execute() - -Delete a JSON Web Key Set - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminDeleteJsonWebKeySet(context.Background(), set).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminDeleteJsonWebKeySet``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminDeleteJsonWebKeySetRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -### Return type - -(empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## AdminDeleteOAuth2Token > AdminDeleteOAuth2Token(ctx).ClientId(clientId).Execute() @@ -351,140 +142,6 @@ No authorization required [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## AdminGetJsonWebKey - -> JsonWebKeySet AdminGetJsonWebKey(ctx, set, kid).Execute() - -Fetch a JSON Web Key - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - kid := "kid_example" // string | The JSON Web Key ID (kid) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminGetJsonWebKey(context.Background(), set, kid).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminGetJsonWebKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AdminGetJsonWebKey`: JsonWebKeySet - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.AdminGetJsonWebKey`: %v\n", resp) -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | -| **kid** | **string** | The JSON Web Key ID (kid) | - -### Other Parameters - -Other parameters are passed through a pointer to a apiAdminGetJsonWebKeyRequest -struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -### Return type - -[**JsonWebKeySet**](JsonWebKeySet.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## AdminGetJsonWebKeySet - -> JsonWebKeySet AdminGetJsonWebKeySet(ctx, set).Execute() - -Retrieve a JSON Web Key Set - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminGetJsonWebKeySet(context.Background(), set).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminGetJsonWebKeySet``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AdminGetJsonWebKeySet`: JsonWebKeySet - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.AdminGetJsonWebKeySet`: %v\n", resp) -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminGetJsonWebKeySetRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -### Return type - -[**JsonWebKeySet**](JsonWebKeySet.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## AdminGetTrustedOAuth2JwtGrantIssuer > TrustedOAuth2JwtGrantIssuer AdminGetTrustedOAuth2JwtGrantIssuer(ctx, @@ -752,148 +409,6 @@ No authorization required [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## AdminUpdateJsonWebKey - -> JsonWebKey AdminUpdateJsonWebKey(ctx, set, -> kid).JsonWebKey(jsonWebKey).Execute() - -Update a JSON Web Key - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - kid := "kid_example" // string | The JSON Web Key ID (kid) - jsonWebKey := *openapiclient.NewJsonWebKey("RS256", "1603dfe0af8f4596", "RSA", "sig") // JsonWebKey | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminUpdateJsonWebKey(context.Background(), set, kid).JsonWebKey(jsonWebKey).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminUpdateJsonWebKey``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AdminUpdateJsonWebKey`: JsonWebKey - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.AdminUpdateJsonWebKey`: %v\n", resp) -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | -| **kid** | **string** | The JSON Web Key ID (kid) | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminUpdateJsonWebKeyRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -**jsonWebKey** | [**JsonWebKey**](JsonWebKey.md) | | - -### Return type - -[**JsonWebKey**](JsonWebKey.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - -## AdminUpdateJsonWebKeySet - -> JsonWebKeySet AdminUpdateJsonWebKeySet(ctx, -> set).JsonWebKeySet(jsonWebKeySet).Execute() - -Update a JSON Web Key Set - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - set := "set_example" // string | The JSON Web Key Set - jsonWebKeySet := *openapiclient.NewJsonWebKeySet() // JsonWebKeySet | (optional) - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.AdminUpdateJsonWebKeySet(context.Background(), set).JsonWebKeySet(jsonWebKeySet).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.AdminUpdateJsonWebKeySet``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `AdminUpdateJsonWebKeySet`: JsonWebKeySet - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.AdminUpdateJsonWebKeySet`: %v\n", resp) -} -``` - -### Path Parameters - -| Name | Type | Description | Notes | -| ------- | ------------------- | --------------------------------------------------------------------------- | ----- | -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. | -| **set** | **string** | The JSON Web Key Set | - -### Other Parameters - -Other parameters are passed through a pointer to a -apiAdminUpdateJsonWebKeySetRequest struct via the builder pattern - -| Name | Type | Description | Notes | -| ---- | ---- | ----------- | ----- | - -**jsonWebKeySet** | [**JsonWebKeySet**](JsonWebKeySet.md) | | - -### Return type - -[**JsonWebKeySet**](JsonWebKeySet.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## DeleteOidcDynamicClient > DeleteOidcDynamicClient(ctx, id).Execute() @@ -959,65 +474,6 @@ apiDeleteOidcDynamicClientRequest struct via the builder pattern [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -## DiscoverJsonWebKeys - -> JsonWebKeySet DiscoverJsonWebKeys(ctx).Execute() - -Discover JSON Web Keys - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.V0alpha2Api.DiscoverJsonWebKeys(context.Background()).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `V0alpha2Api.DiscoverJsonWebKeys``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `DiscoverJsonWebKeys`: JsonWebKeySet - fmt.Fprintf(os.Stdout, "Response from `V0alpha2Api.DiscoverJsonWebKeys`: %v\n", resp) -} -``` - -### Path Parameters - -This endpoint does not need any parameter. - -### Other Parameters - -Other parameters are passed through a pointer to a apiDiscoverJsonWebKeysRequest -struct via the builder pattern - -### Return type - -[**JsonWebKeySet**](JsonWebKeySet.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - ## DiscoverOidcConfiguration > OidcConfiguration DiscoverOidcConfiguration(ctx).Execute() diff --git a/internal/httpclient/docs/WellknownApi.md b/internal/httpclient/docs/WellknownApi.md new file mode 100644 index 00000000000..524f52d5f20 --- /dev/null +++ b/internal/httpclient/docs/WellknownApi.md @@ -0,0 +1,66 @@ +# \WellknownApi + +All URIs are relative to _http://localhost_ + +| Method | HTTP request | Description | +| -------------------------------------------------------------- | ------------------------------ | --------------------------------- | +| [**DiscoverJsonWebKeys**](WellknownApi.md#DiscoverJsonWebKeys) | **Get** /.well-known/jwks.json | Discover Well-Known JSON Web Keys | + +## DiscoverJsonWebKeys + +> JsonWebKeySet DiscoverJsonWebKeys(ctx).Execute() + +Discover Well-Known JSON Web Keys + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.WellknownApi.DiscoverJsonWebKeys(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WellknownApi.DiscoverJsonWebKeys``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `DiscoverJsonWebKeys`: JsonWebKeySet + fmt.Fprintf(os.Stdout, "Response from `WellknownApi.DiscoverJsonWebKeys`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiDiscoverJsonWebKeysRequest +struct via the builder pattern + +### Return type + +[**JsonWebKeySet**](JsonWebKeySet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/internal/httpclient/model_admin_create_json_web_key_set_body.go b/internal/httpclient/model_admin_create_json_web_key_set_body.go deleted file mode 100644 index 06f0f0138b9..00000000000 --- a/internal/httpclient/model_admin_create_json_web_key_set_body.go +++ /dev/null @@ -1,168 +0,0 @@ -/* -Ory Hydra API - -Documentation for all of Ory Hydra's APIs. - -API version: -Contact: hi@ory.sh -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" -) - -// AdminCreateJsonWebKeySetBody struct for AdminCreateJsonWebKeySetBody -type AdminCreateJsonWebKeySetBody struct { - // The algorithm to be used for creating the key. Supports \"RS256\", \"ES256\", \"ES512\", \"HS512\", and \"HS256\" - Alg string `json:"alg"` - // The kid of the key to be created - Kid string `json:"kid"` - // The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Valid values are \"enc\" and \"sig\". - Use string `json:"use"` -} - -// NewAdminCreateJsonWebKeySetBody instantiates a new AdminCreateJsonWebKeySetBody object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewAdminCreateJsonWebKeySetBody(alg string, kid string, use string) *AdminCreateJsonWebKeySetBody { - this := AdminCreateJsonWebKeySetBody{} - this.Alg = alg - this.Kid = kid - this.Use = use - return &this -} - -// NewAdminCreateJsonWebKeySetBodyWithDefaults instantiates a new AdminCreateJsonWebKeySetBody object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewAdminCreateJsonWebKeySetBodyWithDefaults() *AdminCreateJsonWebKeySetBody { - this := AdminCreateJsonWebKeySetBody{} - return &this -} - -// GetAlg returns the Alg field value -func (o *AdminCreateJsonWebKeySetBody) GetAlg() string { - if o == nil { - var ret string - return ret - } - - return o.Alg -} - -// GetAlgOk returns a tuple with the Alg field value -// and a boolean to check if the value has been set. -func (o *AdminCreateJsonWebKeySetBody) GetAlgOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Alg, true -} - -// SetAlg sets field value -func (o *AdminCreateJsonWebKeySetBody) SetAlg(v string) { - o.Alg = v -} - -// GetKid returns the Kid field value -func (o *AdminCreateJsonWebKeySetBody) GetKid() string { - if o == nil { - var ret string - return ret - } - - return o.Kid -} - -// GetKidOk returns a tuple with the Kid field value -// and a boolean to check if the value has been set. -func (o *AdminCreateJsonWebKeySetBody) GetKidOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Kid, true -} - -// SetKid sets field value -func (o *AdminCreateJsonWebKeySetBody) SetKid(v string) { - o.Kid = v -} - -// GetUse returns the Use field value -func (o *AdminCreateJsonWebKeySetBody) GetUse() string { - if o == nil { - var ret string - return ret - } - - return o.Use -} - -// GetUseOk returns a tuple with the Use field value -// and a boolean to check if the value has been set. -func (o *AdminCreateJsonWebKeySetBody) GetUseOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Use, true -} - -// SetUse sets field value -func (o *AdminCreateJsonWebKeySetBody) SetUse(v string) { - o.Use = v -} - -func (o AdminCreateJsonWebKeySetBody) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["alg"] = o.Alg - } - if true { - toSerialize["kid"] = o.Kid - } - if true { - toSerialize["use"] = o.Use - } - return json.Marshal(toSerialize) -} - -type NullableAdminCreateJsonWebKeySetBody struct { - value *AdminCreateJsonWebKeySetBody - isSet bool -} - -func (v NullableAdminCreateJsonWebKeySetBody) Get() *AdminCreateJsonWebKeySetBody { - return v.value -} - -func (v *NullableAdminCreateJsonWebKeySetBody) Set(val *AdminCreateJsonWebKeySetBody) { - v.value = val - v.isSet = true -} - -func (v NullableAdminCreateJsonWebKeySetBody) IsSet() bool { - return v.isSet -} - -func (v *NullableAdminCreateJsonWebKeySetBody) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAdminCreateJsonWebKeySetBody(val *AdminCreateJsonWebKeySetBody) *NullableAdminCreateJsonWebKeySetBody { - return &NullableAdminCreateJsonWebKeySetBody{value: val, isSet: true} -} - -func (v NullableAdminCreateJsonWebKeySetBody) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAdminCreateJsonWebKeySetBody) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/internal/httpclient/model_create_json_web_key_set.go b/internal/httpclient/model_create_json_web_key_set.go new file mode 100644 index 00000000000..3c0f429b21b --- /dev/null +++ b/internal/httpclient/model_create_json_web_key_set.go @@ -0,0 +1,168 @@ +/* +Ory Hydra API + +Documentation for all of Ory Hydra's APIs. + +API version: +Contact: hi@ory.sh +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// CreateJsonWebKeySet Create JSON Web Key Set Request Body +type CreateJsonWebKeySet struct { + // JSON Web Key Algorithm The algorithm to be used for creating the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`. + Alg string `json:"alg"` + // JSON Web Key ID The Key ID of the key to be created. + Kid string `json:"kid"` + // JSON Web Key Use The \"use\" (public key use) parameter identifies the intended use of the public key. The \"use\" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Valid values are \"enc\" and \"sig\". + Use string `json:"use"` +} + +// NewCreateJsonWebKeySet instantiates a new CreateJsonWebKeySet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateJsonWebKeySet(alg string, kid string, use string) *CreateJsonWebKeySet { + this := CreateJsonWebKeySet{} + this.Alg = alg + this.Kid = kid + this.Use = use + return &this +} + +// NewCreateJsonWebKeySetWithDefaults instantiates a new CreateJsonWebKeySet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateJsonWebKeySetWithDefaults() *CreateJsonWebKeySet { + this := CreateJsonWebKeySet{} + return &this +} + +// GetAlg returns the Alg field value +func (o *CreateJsonWebKeySet) GetAlg() string { + if o == nil { + var ret string + return ret + } + + return o.Alg +} + +// GetAlgOk returns a tuple with the Alg field value +// and a boolean to check if the value has been set. +func (o *CreateJsonWebKeySet) GetAlgOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Alg, true +} + +// SetAlg sets field value +func (o *CreateJsonWebKeySet) SetAlg(v string) { + o.Alg = v +} + +// GetKid returns the Kid field value +func (o *CreateJsonWebKeySet) GetKid() string { + if o == nil { + var ret string + return ret + } + + return o.Kid +} + +// GetKidOk returns a tuple with the Kid field value +// and a boolean to check if the value has been set. +func (o *CreateJsonWebKeySet) GetKidOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Kid, true +} + +// SetKid sets field value +func (o *CreateJsonWebKeySet) SetKid(v string) { + o.Kid = v +} + +// GetUse returns the Use field value +func (o *CreateJsonWebKeySet) GetUse() string { + if o == nil { + var ret string + return ret + } + + return o.Use +} + +// GetUseOk returns a tuple with the Use field value +// and a boolean to check if the value has been set. +func (o *CreateJsonWebKeySet) GetUseOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Use, true +} + +// SetUse sets field value +func (o *CreateJsonWebKeySet) SetUse(v string) { + o.Use = v +} + +func (o CreateJsonWebKeySet) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["alg"] = o.Alg + } + if true { + toSerialize["kid"] = o.Kid + } + if true { + toSerialize["use"] = o.Use + } + return json.Marshal(toSerialize) +} + +type NullableCreateJsonWebKeySet struct { + value *CreateJsonWebKeySet + isSet bool +} + +func (v NullableCreateJsonWebKeySet) Get() *CreateJsonWebKeySet { + return v.value +} + +func (v *NullableCreateJsonWebKeySet) Set(val *CreateJsonWebKeySet) { + v.value = val + v.isSet = true +} + +func (v NullableCreateJsonWebKeySet) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateJsonWebKeySet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateJsonWebKeySet(val *CreateJsonWebKeySet) *NullableCreateJsonWebKeySet { + return &NullableCreateJsonWebKeySet{value: val, isSet: true} +} + +func (v NullableCreateJsonWebKeySet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateJsonWebKeySet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/internal/httpclient/model_json_web_key_set.go b/internal/httpclient/model_json_web_key_set.go index 084c2ac9f8f..6d328f6615d 100644 --- a/internal/httpclient/model_json_web_key_set.go +++ b/internal/httpclient/model_json_web_key_set.go @@ -15,9 +15,9 @@ import ( "encoding/json" ) -// JsonWebKeySet It is important that this model object is named JSONWebKeySet for \"swagger generate spec\" to generate only on definition of a JSONWebKeySet. Since one with the same name is previously defined as client.Client.JSONWebKeys and this one is last, this one will be effectively written in the swagger spec. +// JsonWebKeySet JSON Web Key Set type JsonWebKeySet struct { - // The value of the \"keys\" parameter is an array of JSON Web Key (JWK) values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. + // List of JSON Web Keys The value of the \"keys\" parameter is an array of JSON Web Key (JWK) values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. Keys []JsonWebKey `json:"keys,omitempty"` } diff --git a/internal/httpclient/model_o_auth2_consent_session.go b/internal/httpclient/model_o_auth2_consent_session.go index f75fc52187b..10d5e797cc5 100644 --- a/internal/httpclient/model_o_auth2_consent_session.go +++ b/internal/httpclient/model_o_auth2_consent_session.go @@ -23,9 +23,9 @@ type OAuth2ConsentSession struct { GrantAccessTokenAudience []string `json:"grant_access_token_audience,omitempty"` GrantScope []string `json:"grant_scope,omitempty"` HandledAt *time.Time `json:"handled_at,omitempty"` - // Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. + // Remember Consent Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same client asks the same user for the same, or a subset of, scope. Remember *bool `json:"remember,omitempty"` - // RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. + // Remember Consent For RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the authorization will be remembered indefinitely. RememberFor *int64 `json:"remember_for,omitempty"` Session *AcceptOAuth2ConsentRequestSession `json:"session,omitempty"` } diff --git a/jwk/handler.go b/jwk/handler.go index 2998d03264a..10b25e5d122 100644 --- a/jwk/handler.go +++ b/jwk/handler.go @@ -50,14 +50,12 @@ type Handler struct { r InternalRegistry } -// It is important that this model object is named JSONWebKeySet for -// "swagger generate spec" to generate only on definition of a -// JSONWebKeySet. Since one with the same name is previously defined as -// client.Client.JSONWebKeys and this one is last, this one will be -// effectively written in the swagger spec. +// JSON Web Key Set // // swagger:model jsonWebKeySet type jsonWebKeySet struct { + // List of JSON Web Keys + // // The value of the "keys" parameter is an array of JSON Web Key (JWK) // values. By default, the order of the JWK values within the array does // not imply an order of preference among them, although applications @@ -74,21 +72,21 @@ func (h *Handler) SetRoutes(admin *httprouterx.RouterAdmin, public *httprouterx. public.Handler("OPTIONS", WellKnownKeysPath, corsMiddleware(http.HandlerFunc(h.handleOptions))) public.Handler("GET", WellKnownKeysPath, corsMiddleware(http.HandlerFunc(h.discoverJsonWebKeys))) - admin.GET(KeyHandlerPath+"/:set/:key", h.adminGetJsonWebKey) - admin.GET(KeyHandlerPath+"/:set", h.adminGetJsonWebKeySet) + admin.GET(KeyHandlerPath+"/:set/:key", h.getJsonWebKey) + admin.GET(KeyHandlerPath+"/:set", h.getJsonWebKeySet) - admin.POST(KeyHandlerPath+"/:set", h.Create) + admin.POST(KeyHandlerPath+"/:set", h.createJsonWebKeySet) admin.PUT(KeyHandlerPath+"/:set/:key", h.adminUpdateJsonWebKey) - admin.PUT(KeyHandlerPath+"/:set", h.adminUpdateJsonWebKeySet) + admin.PUT(KeyHandlerPath+"/:set", h.setJsonWebKeySet) - admin.DELETE(KeyHandlerPath+"/:set/:key", h.adminDeleteJsonWebKey) + admin.DELETE(KeyHandlerPath+"/:set/:key", h.deleteJsonWebKey) admin.DELETE(KeyHandlerPath+"/:set", h.adminDeleteJsonWebKeySet) } -// swagger:route GET /.well-known/jwks.json v0alpha2 discoverJsonWebKeys +// swagger:route GET /.well-known/jwks.json wellknown discoverJsonWebKeys // -// # Discover JSON Web Keys +// # Discover Well-Known JSON Web Keys // // This endpoint returns JSON Web Keys required to verifying OpenID Connect ID Tokens and, // if enabled, OAuth 2.0 JWT Access Tokens. This endpoint can be used with client libraries like @@ -130,25 +128,28 @@ func (h *Handler) discoverJsonWebKeys(w http.ResponseWriter, r *http.Request) { h.r.Writer().Write(w, r, &jwks) } -// swagger:parameters adminGetJsonWebKey -type adminGetJsonWebKey struct { - // The JSON Web Key Set +// Get JSON Web Key Request +// +// swagger:parameters getJsonWebKey +type getJsonWebKey struct { + // JSON Web Key Set ID + // // in: path // required: true Set string `json:"set"` - // The JSON Web Key ID (kid) + // JSON Web Key ID // // in: path // required: true KID string `json:"kid"` } -// swagger:route GET /admin/keys/{set}/{kid} v0alpha2 adminGetJsonWebKey +// swagger:route GET /admin/keys/{set}/{kid} jwk getJsonWebKey // -// # Fetch a JSON Web Key +// # Get JSON Web Key // -// This endpoint returns a singular JSON Web Key. It is identified by the set and the specific key ID (kid). +// This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid). // // Consumes: // - application/json @@ -161,7 +162,7 @@ type adminGetJsonWebKey struct { // Responses: // 200: jsonWebKeySet // default: errorOAuth2 -func (h *Handler) adminGetJsonWebKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (h *Handler) getJsonWebKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { var setName = ps.ByName("set") var keyName = ps.ByName("key") @@ -175,15 +176,18 @@ func (h *Handler) adminGetJsonWebKey(w http.ResponseWriter, r *http.Request, ps h.r.Writer().Write(w, r, keys) } -// swagger:parameters adminGetJsonWebKeySet -type adminGetJsonWebKeySet struct { - // The JSON Web Key Set +// Get JSON Web Key Set Parameters +// +// swagger:parameters getJsonWebKeySet +type getJsonWebKeySet struct { + // JSON Web Key Set ID + // // in: path // required: true Set string `json:"set"` } -// swagger:route GET /admin/keys/{set} v0alpha2 adminGetJsonWebKeySet +// swagger:route GET /admin/keys/{set} jwk getJsonWebKeySet // // # Retrieve a JSON Web Key Set // @@ -202,7 +206,7 @@ type adminGetJsonWebKeySet struct { // Responses: // 200: jsonWebKeySet // default: errorOAuth2 -func (h *Handler) adminGetJsonWebKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (h *Handler) getJsonWebKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { var setName = ps.ByName("set") keys, err := h.r.KeyManager().GetKeySet(r.Context(), setName) @@ -215,25 +219,34 @@ func (h *Handler) adminGetJsonWebKeySet(w http.ResponseWriter, r *http.Request, h.r.Writer().Write(w, r, keys) } -// swagger:parameters adminCreateJsonWebKeySet +// Create JSON Web Key Set Request +// +// swagger:parameters createJsonWebKeySet type adminCreateJsonWebKeySet struct { - // The JSON Web Key Set + // The JSON Web Key Set ID + // // in: path // required: true Set string `json:"set"` // in: body // required: true - Body adminCreateJsonWebKeySetBody + Body createJsonWebKeySetBody } -// swagger:model adminCreateJsonWebKeySetBody -type adminCreateJsonWebKeySetBody struct { - // The algorithm to be used for creating the key. Supports "RS256", "ES256", "ES512", "HS512", and "HS256" +// Create JSON Web Key Set Request Body +// +// swagger:model createJsonWebKeySet +type createJsonWebKeySetBody struct { + // JSON Web Key Algorithm + // + // The algorithm to be used for creating the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`. // // required: true Algorithm string `json:"alg"` + // JSON Web Key Use + // // The "use" (public key use) parameter identifies the intended use of // the public key. The "use" parameter is employed to indicate whether // a public key is used for encrypting data or verifying the signature @@ -241,15 +254,17 @@ type adminCreateJsonWebKeySetBody struct { // required: true Use string `json:"use"` - // The kid of the key to be created + // JSON Web Key ID + // + // The Key ID of the key to be created. // // required: true KeyID string `json:"kid"` } -// swagger:route POST /admin/keys/{set} v0alpha2 adminCreateJsonWebKeySet +// swagger:route POST /admin/keys/{set} jwk createJsonWebKeySet // -// # Generate a New JSON Web Key +// # Create JSON Web Key // // This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created. // @@ -266,8 +281,8 @@ type adminCreateJsonWebKeySetBody struct { // Responses: // 201: jsonWebKeySet // default: errorOAuth2 -func (h *Handler) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { - var keyRequest adminCreateJsonWebKeySetBody +func (h *Handler) createJsonWebKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + var keyRequest createJsonWebKeySetBody var set = ps.ByName("set") if err := json.NewDecoder(r.Body).Decode(&keyRequest); err != nil { @@ -282,9 +297,12 @@ func (h *Handler) Create(w http.ResponseWriter, r *http.Request, ps httprouter.P } } -// swagger:parameters adminUpdateJsonWebKeySet -type adminUpdateJsonWebKeySet struct { - // The JSON Web Key Set +// Set JSON Web Key Set Request +// +// swagger:parameters setJsonWebKeySet +type setJsonWebKeySet struct { + // The JSON Web Key Set ID + // // in: path // required: true Set string `json:"set"` @@ -293,7 +311,7 @@ type adminUpdateJsonWebKeySet struct { Body jsonWebKeySet } -// swagger:route PUT /admin/keys/{set} v0alpha2 adminUpdateJsonWebKeySet +// swagger:route PUT /admin/keys/{set} jwk setJsonWebKeySet // // # Update a JSON Web Key Set // @@ -312,7 +330,7 @@ type adminUpdateJsonWebKeySet struct { // Responses: // 200: jsonWebKeySet // default: errorOAuth2 -func (h *Handler) adminUpdateJsonWebKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (h *Handler) setJsonWebKeySet(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { var keySet jose.JSONWebKeySet var set = ps.ByName("set") @@ -329,14 +347,17 @@ func (h *Handler) adminUpdateJsonWebKeySet(w http.ResponseWriter, r *http.Reques h.r.Writer().Write(w, r, &keySet) } -// swagger:parameters adminUpdateJsonWebKey -type adminUpdateJsonWebKey struct { - // The JSON Web Key Set +// Set JSON Web Key Request +// +// swagger:parameters setJsonWebKey +type setJsonWebKey struct { + // The JSON Web Key Set ID + // // in: path // required: true Set string `json:"set"` - // The JSON Web Key ID (kid) + // JSON Web Key ID // // in: path // required: true @@ -346,9 +367,9 @@ type adminUpdateJsonWebKey struct { Body x.JSONWebKey } -// swagger:route PUT /admin/keys/{set}/{kid} v0alpha2 adminUpdateJsonWebKey +// swagger:route PUT /admin/keys/{set}/{kid} jwk setJsonWebKey // -// # Update a JSON Web Key +// # Set JSON Web Key // // Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own. // @@ -382,17 +403,19 @@ func (h *Handler) adminUpdateJsonWebKey(w http.ResponseWriter, r *http.Request, h.r.Writer().Write(w, r, key) } -// swagger:parameters adminDeleteJsonWebKeySet -type adminDeleteJsonWebKeySet struct { +// Delete JSON Web Key Set Parameters +// +// swagger:parameters deleteJsonWebKeySet +type deleteJsonWebKeySet struct { // The JSON Web Key Set // in: path // required: true Set string `json:"set"` } -// swagger:route DELETE /admin/keys/{set} v0alpha2 adminDeleteJsonWebKeySet +// swagger:route DELETE /admin/keys/{set} jwk deleteJsonWebKeySet // -// # Delete a JSON Web Key Set +// # Delete JSON Web Key Set // // Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set. // @@ -420,8 +443,10 @@ func (h *Handler) adminDeleteJsonWebKeySet(w http.ResponseWriter, r *http.Reques w.WriteHeader(http.StatusNoContent) } -// swagger:parameters adminDeleteJsonWebKey -type adminDeleteJsonWebKey struct { +// Delete JSON Web Key Parameters +// +// swagger:parameters deleteJsonWebKey +type deleteJsonWebKey struct { // The JSON Web Key Set // in: path // required: true @@ -434,13 +459,16 @@ type adminDeleteJsonWebKey struct { KID string `json:"kid"` } -// swagger:route DELETE /admin/keys/{set}/{kid} v0alpha2 adminDeleteJsonWebKey +// swagger:route DELETE /admin/keys/{set}/{kid} jwk deleteJsonWebKey // -// # Delete a JSON Web Key +// # Delete JSON Web Key // // Use this endpoint to delete a single JSON Web Key. // -// A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well. +// A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A +// JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses +// this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), +// and allows storing user-defined keys as well. // // Consumes: // - application/json @@ -453,7 +481,7 @@ type adminDeleteJsonWebKey struct { // Responses: // 204: emptyResponse // default: errorOAuth2 -func (h *Handler) adminDeleteJsonWebKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { +func (h *Handler) deleteJsonWebKey(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { var setName = ps.ByName("set") var keyName = ps.ByName("key") diff --git a/jwk/sdk_test.go b/jwk/sdk_test.go index b456b0436cc..aaf059bbf7a 100644 --- a/jwk/sdk_test.go +++ b/jwk/sdk_test.go @@ -60,7 +60,7 @@ func TestJWKSDK(t *testing.T) { t.Run("JSON Web Key", func(t *testing.T) { t.Run("CreateJwkSetKey", func(t *testing.T) { // Create a key called set-foo - resultKeys, _, err := sdk.V0alpha2Api.AdminCreateJsonWebKeySet(context.Background(), "set-foo").AdminCreateJsonWebKeySetBody(hydra.AdminCreateJsonWebKeySetBody{ + resultKeys, _, err := sdk.JwkApi.CreateJsonWebKeySet(context.Background(), "set-foo").CreateJsonWebKeySet(hydra.CreateJsonWebKeySet{ Alg: "RS256", Kid: "key-bar", Use: "sig", @@ -74,7 +74,7 @@ func TestJWKSDK(t *testing.T) { var resultKeys *hydra.JsonWebKeySet t.Run("GetJwkSetKey after create", func(t *testing.T) { - result, _, err := sdk.V0alpha2Api.AdminGetJsonWebKey(ctx, "set-foo", expectedKid).Execute() + result, _, err := sdk.JwkApi.GetJsonWebKey(ctx, "set-foo", expectedKid).Execute() require.NoError(t, err) require.Len(t, result.Keys, 1) require.Equal(t, expectedKid, result.Keys[0].Kid) @@ -90,19 +90,19 @@ func TestJWKSDK(t *testing.T) { require.Len(t, resultKeys.Keys, 1) resultKeys.Keys[0].Alg = "ES256" - resultKey, _, err := sdk.V0alpha2Api.AdminUpdateJsonWebKey(ctx, "set-foo", expectedKid).JsonWebKey(resultKeys.Keys[0]).Execute() + resultKey, _, err := sdk.JwkApi.SetJsonWebKey(ctx, "set-foo", expectedKid).JsonWebKey(resultKeys.Keys[0]).Execute() require.NoError(t, err) assert.Equal(t, expectedKid, resultKey.Kid) assert.Equal(t, "ES256", resultKey.Alg) }) t.Run("DeleteJwkSetKey after delete", func(t *testing.T) { - _, err := sdk.V0alpha2Api.AdminDeleteJsonWebKey(ctx, "set-foo", expectedKid).Execute() + _, err := sdk.JwkApi.DeleteJsonWebKey(ctx, "set-foo", expectedKid).Execute() require.NoError(t, err) }) t.Run("GetJwkSetKey after delete", func(t *testing.T) { - _, res, err := sdk.V0alpha2Api.AdminGetJsonWebKey(ctx, "set-foo", expectedKid).Execute() + _, res, err := sdk.JwkApi.GetJsonWebKey(ctx, "set-foo", expectedKid).Execute() require.Error(t, err) assert.Equal(t, http.StatusNotFound, res.StatusCode) }) @@ -111,7 +111,7 @@ func TestJWKSDK(t *testing.T) { t.Run("JWK Set", func(t *testing.T) { t.Run("CreateJwkSetKey", func(t *testing.T) { - resultKeys, _, err := sdk.V0alpha2Api.AdminCreateJsonWebKeySet(ctx, "set-foo2").AdminCreateJsonWebKeySetBody(hydra.AdminCreateJsonWebKeySetBody{ + resultKeys, _, err := sdk.JwkApi.CreateJsonWebKeySet(ctx, "set-foo2").CreateJsonWebKeySet(hydra.CreateJsonWebKeySet{ Alg: "RS256", Kid: "key-bar", }).Execute() @@ -121,7 +121,7 @@ func TestJWKSDK(t *testing.T) { assert.Equal(t, "RS256", resultKeys.Keys[0].Alg) }) - resultKeys, _, err := sdk.V0alpha2Api.AdminGetJsonWebKeySet(ctx, "set-foo2").Execute() + resultKeys, _, err := sdk.JwkApi.GetJsonWebKeySet(ctx, "set-foo2").Execute() t.Run("GetJwkSet after create", func(t *testing.T) { require.NoError(t, err) if conf.HSMEnabled() { @@ -142,7 +142,7 @@ func TestJWKSDK(t *testing.T) { require.Len(t, resultKeys.Keys, 1) resultKeys.Keys[0].Alg = "ES256" - result, _, err := sdk.V0alpha2Api.AdminUpdateJsonWebKeySet(ctx, "set-foo2").JsonWebKeySet(*resultKeys).Execute() + result, _, err := sdk.JwkApi.SetJsonWebKeySet(ctx, "set-foo2").JsonWebKeySet(*resultKeys).Execute() require.NoError(t, err) require.Len(t, result.Keys, 1) assert.Equal(t, expectedKid, result.Keys[0].Kid) @@ -150,18 +150,18 @@ func TestJWKSDK(t *testing.T) { }) t.Run("DeleteJwkSet", func(t *testing.T) { - _, err := sdk.V0alpha2Api.AdminDeleteJsonWebKeySet(ctx, "set-foo2").Execute() + _, err := sdk.JwkApi.DeleteJsonWebKeySet(ctx, "set-foo2").Execute() require.NoError(t, err) }) t.Run("GetJwkSet after delete", func(t *testing.T) { - _, res, err := sdk.V0alpha2Api.AdminGetJsonWebKeySet(ctx, "set-foo2").Execute() + _, res, err := sdk.JwkApi.GetJsonWebKeySet(ctx, "set-foo2").Execute() require.Error(t, err) assert.Equal(t, http.StatusNotFound, res.StatusCode) }) t.Run("GetJwkSetKey after delete", func(t *testing.T) { - _, res, err := sdk.V0alpha2Api.AdminGetJsonWebKey(ctx, "set-foo2", expectedKid).Execute() + _, res, err := sdk.JwkApi.GetJsonWebKey(ctx, "set-foo2", expectedKid).Execute() require.Error(t, err) assert.Equal(t, http.StatusNotFound, res.StatusCode) }) diff --git a/oauth2/trust/handler_test.go b/oauth2/trust/handler_test.go index 73976ea4106..d42e91d94c4 100644 --- a/oauth2/trust/handler_test.go +++ b/oauth2/trust/handler_test.go @@ -197,7 +197,7 @@ func (s *HandlerTestSuite) TestGrantPublicCanBeFetched() { _, _, err := s.hydraClient.V0alpha2Api.AdminTrustOAuth2JwtGrantIssuer(context.Background()).AdminTrustOAuth2JwtGrantIssuerBody(createRequestParams).Execute() s.Require().NoError(err, "no error expected on grant creation") - getResult, _, err := s.hydraClient.V0alpha2Api.AdminGetJsonWebKey(context.Background(), createRequestParams.Issuer, createRequestParams.Jwk.Kid).Execute() + getResult, _, err := s.hydraClient.JwkApi.GetJsonWebKey(context.Background(), createRequestParams.Issuer, createRequestParams.Jwk.Kid).Execute() s.Require().NoError(err, "no error expected on fetching public key") s.Equal(createRequestParams.Jwk.Kid, getResult.Keys[0].Kid) diff --git a/spec/api.json b/spec/api.json index f2cafb25f35..b136f95d08a 100644 --- a/spec/api.json +++ b/spec/api.json @@ -239,28 +239,6 @@ "title": "HandledLoginRequest is the request payload used to accept a login request.", "type": "object" }, - "adminCreateJsonWebKeySetBody": { - "properties": { - "alg": { - "description": "The algorithm to be used for creating the key. Supports \"RS256\", \"ES256\", \"ES512\", \"HS512\", and \"HS256\"", - "type": "string" - }, - "kid": { - "description": "The kid of the key to be created", - "type": "string" - }, - "use": { - "description": "The \"use\" (public key use) parameter identifies the intended use of\nthe public key. The \"use\" parameter is employed to indicate whether\na public key is used for encrypting data or verifying the signature\non data. Valid values are \"enc\" and \"sig\".", - "type": "string" - } - }, - "required": [ - "alg", - "use", - "kid" - ], - "type": "object" - }, "adminTrustOAuth2JwtGrantIssuerBody": { "properties": { "allow_any_subject": { @@ -305,6 +283,29 @@ ], "type": "object" }, + "createJsonWebKeySet": { + "description": "Create JSON Web Key Set Request Body", + "properties": { + "alg": { + "description": "JSON Web Key Algorithm\n\nThe algorithm to be used for creating the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`.", + "type": "string" + }, + "kid": { + "description": "JSON Web Key ID\n\nThe Key ID of the key to be created.", + "type": "string" + }, + "use": { + "description": "JSON Web Key Use\n\nThe \"use\" (public key use) parameter identifies the intended use of\nthe public key. The \"use\" parameter is employed to indicate whether\na public key is used for encrypting data or verifying the signature\non data. Valid values are \"enc\" and \"sig\".", + "type": "string" + } + }, + "required": [ + "alg", + "use", + "kid" + ], + "type": "object" + }, "errorOAuth2": { "description": "Error", "properties": { @@ -596,10 +597,10 @@ "type": "object" }, "jsonWebKeySet": { - "description": "It is important that this model object is named JSONWebKeySet for\n\"swagger generate spec\" to generate only on definition of a\nJSONWebKeySet. Since one with the same name is previously defined as\nclient.Client.JSONWebKeys and this one is last, this one will be\neffectively written in the swagger spec.", + "description": "JSON Web Key Set", "properties": { "keys": { - "description": "The value of the \"keys\" parameter is an array of JSON Web Key (JWK)\nvalues. By default, the order of the JWK values within the array does\nnot imply an order of preference among them, although applications\nof JWK Sets can choose to assign a meaning to the order for their\npurposes, if desired.", + "description": "List of JSON Web Keys\n\nThe value of the \"keys\" parameter is an array of JSON Web Key (JWK)\nvalues. By default, the order of the JWK values within the array does\nnot imply an order of preference among them, although applications\nof JWK Sets can choose to assign a meaning to the order for their\npurposes, if desired.", "items": { "$ref": "#/components/schemas/jsonWebKey" }, @@ -990,11 +991,11 @@ "$ref": "#/components/schemas/nullTime" }, "remember": { - "description": "Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same\nclient asks the same user for the same, or a subset of, scope.", + "description": "Remember Consent\n\nRemember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same\nclient asks the same user for the same, or a subset of, scope.", "type": "boolean" }, "remember_for": { - "description": "RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the\nauthorization will be remembered indefinitely.", + "description": "Remember Consent For\n\nRememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the\nauthorization will be remembered indefinitely.", "format": "int64", "type": "integer" }, @@ -1709,9 +1710,9 @@ "description": "errorOAuth2" } }, - "summary": "Discover JSON Web Keys", + "summary": "Discover Well-Known JSON Web Keys", "tags": [ - "v0alpha2" + "wellknown" ] } }, @@ -2070,7 +2071,7 @@ "/admin/keys/{set}": { "delete": { "description": "Use this endpoint to delete a complete JSON Web Key Set and all the keys in that set.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminDeleteJsonWebKeySet", + "operationId": "deleteJsonWebKeySet", "parameters": [ { "description": "The JSON Web Key Set", @@ -2097,17 +2098,17 @@ "description": "errorOAuth2" } }, - "summary": "Delete a JSON Web Key Set", + "summary": "Delete JSON Web Key Set", "tags": [ - "v0alpha2" + "jwk" ] }, "get": { "description": "This endpoint can be used to retrieve JWK Sets stored in ORY Hydra.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminGetJsonWebKeySet", + "operationId": "getJsonWebKeySet", "parameters": [ { - "description": "The JSON Web Key Set", + "description": "JSON Web Key Set ID", "in": "path", "name": "set", "required": true, @@ -2140,15 +2141,15 @@ }, "summary": "Retrieve a JSON Web Key Set", "tags": [ - "v0alpha2" + "jwk" ] }, "post": { "description": "This endpoint is capable of generating JSON Web Key Sets for you. There a different strategies available, such as symmetric cryptographic keys (HS256, HS512) and asymetric cryptographic keys (RS256, ECDSA). If the specified JSON Web Key Set does not exist, it will be created.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminCreateJsonWebKeySet", + "operationId": "createJsonWebKeySet", "parameters": [ { - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "in": "path", "name": "set", "required": true, @@ -2161,7 +2162,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/adminCreateJsonWebKeySetBody" + "$ref": "#/components/schemas/createJsonWebKeySet" } } }, @@ -2190,17 +2191,17 @@ "description": "errorOAuth2" } }, - "summary": "Generate a New JSON Web Key", + "summary": "Create JSON Web Key", "tags": [ - "v0alpha2" + "jwk" ] }, "put": { "description": "Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminUpdateJsonWebKeySet", + "operationId": "setJsonWebKeySet", "parameters": [ { - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "in": "path", "name": "set", "required": true, @@ -2243,14 +2244,14 @@ }, "summary": "Update a JSON Web Key Set", "tags": [ - "v0alpha2" + "jwk" ] } }, "/admin/keys/{set}/{kid}": { "delete": { - "description": "Use this endpoint to delete a single JSON Web Key.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminDeleteJsonWebKey", + "description": "Use this endpoint to delete a single JSON Web Key.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A\nJWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses\nthis functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens),\nand allows storing user-defined keys as well.", + "operationId": "deleteJsonWebKey", "parameters": [ { "description": "The JSON Web Key Set", @@ -2286,17 +2287,17 @@ "description": "errorOAuth2" } }, - "summary": "Delete a JSON Web Key", + "summary": "Delete JSON Web Key", "tags": [ - "v0alpha2" + "jwk" ] }, "get": { - "description": "This endpoint returns a singular JSON Web Key. It is identified by the set and the specific key ID (kid).", - "operationId": "adminGetJsonWebKey", + "description": "This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).", + "operationId": "getJsonWebKey", "parameters": [ { - "description": "The JSON Web Key Set", + "description": "JSON Web Key Set ID", "in": "path", "name": "set", "required": true, @@ -2305,7 +2306,7 @@ } }, { - "description": "The JSON Web Key ID (kid)", + "description": "JSON Web Key ID", "in": "path", "name": "kid", "required": true, @@ -2336,17 +2337,17 @@ "description": "errorOAuth2" } }, - "summary": "Fetch a JSON Web Key", + "summary": "Get JSON Web Key", "tags": [ - "v0alpha2" + "jwk" ] }, "put": { "description": "Use this method if you do not want to let Hydra generate the JWKs for you, but instead save your own.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", - "operationId": "adminUpdateJsonWebKey", + "operationId": "setJsonWebKey", "parameters": [ { - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "in": "path", "name": "set", "required": true, @@ -2355,7 +2356,7 @@ } }, { - "description": "The JSON Web Key ID (kid)", + "description": "JSON Web Key ID", "in": "path", "name": "kid", "required": true, @@ -2396,9 +2397,9 @@ "description": "errorOAuth2" } }, - "summary": "Update a JSON Web Key", + "summary": "Set JSON Web Key", "tags": [ - "v0alpha2" + "jwk" ] } }, diff --git a/spec/swagger.json b/spec/swagger.json index fea0cc6d66d..27469f36499 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -32,9 +32,9 @@ "https" ], "tags": [ - "v0alpha2" + "wellknown" ], - "summary": "Discover JSON Web Keys", + "summary": "Discover Well-Known JSON Web Keys", "operationId": "discoverJsonWebKeys", "responses": { "200": { @@ -428,14 +428,14 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], "summary": "Retrieve a JSON Web Key Set", - "operationId": "adminGetJsonWebKeySet", + "operationId": "getJsonWebKeySet", "parameters": [ { "type": "string", - "description": "The JSON Web Key Set", + "description": "JSON Web Key Set ID", "name": "set", "in": "path", "required": true @@ -469,14 +469,14 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], "summary": "Update a JSON Web Key Set", - "operationId": "adminUpdateJsonWebKeySet", + "operationId": "setJsonWebKeySet", "parameters": [ { "type": "string", - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "name": "set", "in": "path", "required": true @@ -517,14 +517,14 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], - "summary": "Generate a New JSON Web Key", - "operationId": "adminCreateJsonWebKeySet", + "summary": "Create JSON Web Key", + "operationId": "createJsonWebKeySet", "parameters": [ { "type": "string", - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "name": "set", "in": "path", "required": true @@ -534,7 +534,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/adminCreateJsonWebKeySetBody" + "$ref": "#/definitions/createJsonWebKeySet" } } ], @@ -566,10 +566,10 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], - "summary": "Delete a JSON Web Key Set", - "operationId": "adminDeleteJsonWebKeySet", + "summary": "Delete JSON Web Key Set", + "operationId": "deleteJsonWebKeySet", "parameters": [ { "type": "string", @@ -594,7 +594,7 @@ }, "/admin/keys/{set}/{kid}": { "get": { - "description": "This endpoint returns a singular JSON Web Key. It is identified by the set and the specific key ID (kid).", + "description": "This endpoint returns a singular JSON Web Key contained in a set. It is identified by the set and the specific key ID (kid).", "consumes": [ "application/json" ], @@ -606,21 +606,21 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], - "summary": "Fetch a JSON Web Key", - "operationId": "adminGetJsonWebKey", + "summary": "Get JSON Web Key", + "operationId": "getJsonWebKey", "parameters": [ { "type": "string", - "description": "The JSON Web Key Set", + "description": "JSON Web Key Set ID", "name": "set", "in": "path", "required": true }, { "type": "string", - "description": "The JSON Web Key ID (kid)", + "description": "JSON Web Key ID", "name": "kid", "in": "path", "required": true @@ -654,21 +654,21 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], - "summary": "Update a JSON Web Key", - "operationId": "adminUpdateJsonWebKey", + "summary": "Set JSON Web Key", + "operationId": "setJsonWebKey", "parameters": [ { "type": "string", - "description": "The JSON Web Key Set", + "description": "The JSON Web Key Set ID", "name": "set", "in": "path", "required": true }, { "type": "string", - "description": "The JSON Web Key ID (kid)", + "description": "JSON Web Key ID", "name": "kid", "in": "path", "required": true @@ -697,7 +697,7 @@ } }, "delete": { - "description": "Use this endpoint to delete a single JSON Web Key.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A JWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses this functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens), and allows storing user-defined keys as well.", + "description": "Use this endpoint to delete a single JSON Web Key.\n\nA JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. A\nJWK Set is a JSON data structure that represents a set of JWKs. A JSON Web Key is identified by its set and key id. ORY Hydra uses\nthis functionality to store cryptographic keys used for TLS and JSON Web Tokens (such as OpenID Connect ID tokens),\nand allows storing user-defined keys as well.", "consumes": [ "application/json" ], @@ -709,10 +709,10 @@ "https" ], "tags": [ - "v0alpha2" + "jwk" ], - "summary": "Delete a JSON Web Key", - "operationId": "adminDeleteJsonWebKey", + "summary": "Delete JSON Web Key", + "operationId": "deleteJsonWebKey", "parameters": [ { "type": "string", @@ -2235,28 +2235,6 @@ } } }, - "adminCreateJsonWebKeySetBody": { - "type": "object", - "required": [ - "alg", - "use", - "kid" - ], - "properties": { - "alg": { - "description": "The algorithm to be used for creating the key. Supports \"RS256\", \"ES256\", \"ES512\", \"HS512\", and \"HS256\"", - "type": "string" - }, - "kid": { - "description": "The kid of the key to be created", - "type": "string" - }, - "use": { - "description": "The \"use\" (public key use) parameter identifies the intended use of\nthe public key. The \"use\" parameter is employed to indicate whether\na public key is used for encrypting data or verifying the signature\non data. Valid values are \"enc\" and \"sig\".", - "type": "string" - } - } - }, "adminTrustOAuth2JwtGrantIssuerBody": { "type": "object", "required": [ @@ -2301,6 +2279,29 @@ } } }, + "createJsonWebKeySet": { + "description": "Create JSON Web Key Set Request Body", + "type": "object", + "required": [ + "alg", + "use", + "kid" + ], + "properties": { + "alg": { + "description": "JSON Web Key Algorithm\n\nThe algorithm to be used for creating the key. Supports `RS256`, `ES256`, `ES512`, `HS512`, and `HS256`.", + "type": "string" + }, + "kid": { + "description": "JSON Web Key ID\n\nThe Key ID of the key to be created.", + "type": "string" + }, + "use": { + "description": "JSON Web Key Use\n\nThe \"use\" (public key use) parameter identifies the intended use of\nthe public key. The \"use\" parameter is employed to indicate whether\na public key is used for encrypting data or verifying the signature\non data. Valid values are \"enc\" and \"sig\".", + "type": "string" + } + } + }, "errorOAuth2": { "description": "Error", "type": "object", @@ -2594,11 +2595,11 @@ } }, "jsonWebKeySet": { - "description": "It is important that this model object is named JSONWebKeySet for\n\"swagger generate spec\" to generate only on definition of a\nJSONWebKeySet. Since one with the same name is previously defined as\nclient.Client.JSONWebKeys and this one is last, this one will be\neffectively written in the swagger spec.", + "description": "JSON Web Key Set", "type": "object", "properties": { "keys": { - "description": "The value of the \"keys\" parameter is an array of JSON Web Key (JWK)\nvalues. By default, the order of the JWK values within the array does\nnot imply an order of preference among them, although applications\nof JWK Sets can choose to assign a meaning to the order for their\npurposes, if desired.", + "description": "List of JSON Web Keys\n\nThe value of the \"keys\" parameter is an array of JSON Web Key (JWK)\nvalues. By default, the order of the JWK values within the array does\nnot imply an order of preference among them, although applications\nof JWK Sets can choose to assign a meaning to the order for their\npurposes, if desired.", "type": "array", "items": { "$ref": "#/definitions/jsonWebKey" @@ -2956,11 +2957,11 @@ "$ref": "#/definitions/nullTime" }, "remember": { - "description": "Remember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same\nclient asks the same user for the same, or a subset of, scope.", + "description": "Remember Consent\n\nRemember, if set to true, tells ORY Hydra to remember this consent authorization and reuse it if the same\nclient asks the same user for the same, or a subset of, scope.", "type": "boolean" }, "remember_for": { - "description": "RememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the\nauthorization will be remembered indefinitely.", + "description": "Remember Consent For\n\nRememberFor sets how long the consent authorization should be remembered for in seconds. If set to `0`, the\nauthorization will be remembered indefinitely.", "type": "integer", "format": "int64" },