mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-10-18 23:45:08 +00:00
ad0f7a5305
Upgrade to Go 1.20.5, Hydra v2 SDK, rules-go v0.44.2 (with proper resolves), protobuf v25.3 and mass upgrade of Go dependencies.
4142 lines
152 KiB
Go
4142 lines
152 KiB
Go
/*
|
|
Ory Hydra API
|
|
|
|
Documentation for all of Ory Hydra's APIs.
|
|
|
|
API version: v2.2.0
|
|
Contact: hi@ory.sh
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package client
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
|
|
type OAuth2API interface {
|
|
|
|
/*
|
|
AcceptOAuth2ConsentRequest Accept OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
This endpoint tells Ory that the subject has authorized the OAuth 2.0 client to access resources on his/her behalf.
|
|
The consent provider includes additional information, such as session data for access and ID tokens, and if the
|
|
consent request should be used as basis for future requests.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2ConsentRequestRequest
|
|
*/
|
|
AcceptOAuth2ConsentRequest(ctx context.Context) OAuth2APIAcceptOAuth2ConsentRequestRequest
|
|
|
|
// AcceptOAuth2ConsentRequestExecute executes the request
|
|
// @return OAuth2RedirectTo
|
|
AcceptOAuth2ConsentRequestExecute(r OAuth2APIAcceptOAuth2ConsentRequestRequest) (*OAuth2RedirectTo, *http.Response, error)
|
|
|
|
/*
|
|
AcceptOAuth2LoginRequest Accept OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
This endpoint tells Ory that the subject has successfully authenticated and includes additional information such as
|
|
the subject's ID and if Ory should remember the subject's subject agent for future authentication attempts by setting
|
|
a cookie.
|
|
|
|
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2LoginRequestRequest
|
|
*/
|
|
AcceptOAuth2LoginRequest(ctx context.Context) OAuth2APIAcceptOAuth2LoginRequestRequest
|
|
|
|
// AcceptOAuth2LoginRequestExecute executes the request
|
|
// @return OAuth2RedirectTo
|
|
AcceptOAuth2LoginRequestExecute(r OAuth2APIAcceptOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error)
|
|
|
|
/*
|
|
AcceptOAuth2LogoutRequest Accept OAuth 2.0 Session Logout Request
|
|
|
|
When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to confirm that logout request.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2LogoutRequestRequest
|
|
*/
|
|
AcceptOAuth2LogoutRequest(ctx context.Context) OAuth2APIAcceptOAuth2LogoutRequestRequest
|
|
|
|
// AcceptOAuth2LogoutRequestExecute executes the request
|
|
// @return OAuth2RedirectTo
|
|
AcceptOAuth2LogoutRequestExecute(r OAuth2APIAcceptOAuth2LogoutRequestRequest) (*OAuth2RedirectTo, *http.Response, error)
|
|
|
|
/*
|
|
CreateOAuth2Client Create OAuth 2.0 Client
|
|
|
|
Create a new OAuth 2.0 client. If you pass `client_secret` the secret is used, otherwise a random secret
|
|
is generated. The secret is echoed in the response. It is not possible to retrieve it later on.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APICreateOAuth2ClientRequest
|
|
*/
|
|
CreateOAuth2Client(ctx context.Context) OAuth2APICreateOAuth2ClientRequest
|
|
|
|
// CreateOAuth2ClientExecute executes the request
|
|
// @return OAuth2Client
|
|
CreateOAuth2ClientExecute(r OAuth2APICreateOAuth2ClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
DeleteOAuth2Client Delete OAuth 2.0 Client
|
|
|
|
Delete an existing OAuth 2.0 Client by its ID.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
Make sure that this endpoint is well protected and only callable by first-party components.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIDeleteOAuth2ClientRequest
|
|
*/
|
|
DeleteOAuth2Client(ctx context.Context, id string) OAuth2APIDeleteOAuth2ClientRequest
|
|
|
|
// DeleteOAuth2ClientExecute executes the request
|
|
DeleteOAuth2ClientExecute(r OAuth2APIDeleteOAuth2ClientRequest) (*http.Response, error)
|
|
|
|
/*
|
|
DeleteOAuth2Token Delete OAuth 2.0 Access Tokens from specific OAuth 2.0 Client
|
|
|
|
This endpoint deletes OAuth2 access tokens issued to an OAuth 2.0 Client from the database.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIDeleteOAuth2TokenRequest
|
|
*/
|
|
DeleteOAuth2Token(ctx context.Context) OAuth2APIDeleteOAuth2TokenRequest
|
|
|
|
// DeleteOAuth2TokenExecute executes the request
|
|
DeleteOAuth2TokenExecute(r OAuth2APIDeleteOAuth2TokenRequest) (*http.Response, error)
|
|
|
|
/*
|
|
DeleteTrustedOAuth2JwtGrantIssuer Delete 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 OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
DeleteTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest
|
|
|
|
// DeleteTrustedOAuth2JwtGrantIssuerExecute executes the request
|
|
DeleteTrustedOAuth2JwtGrantIssuerExecute(r OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest) (*http.Response, error)
|
|
|
|
/*
|
|
GetOAuth2Client Get an OAuth 2.0 Client
|
|
|
|
Get an OAuth 2.0 client by its ID. This endpoint never returns the client secret.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIGetOAuth2ClientRequest
|
|
*/
|
|
GetOAuth2Client(ctx context.Context, id string) OAuth2APIGetOAuth2ClientRequest
|
|
|
|
// GetOAuth2ClientExecute executes the request
|
|
// @return OAuth2Client
|
|
GetOAuth2ClientExecute(r OAuth2APIGetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
GetOAuth2ConsentRequest Get OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2ConsentRequestRequest
|
|
*/
|
|
GetOAuth2ConsentRequest(ctx context.Context) OAuth2APIGetOAuth2ConsentRequestRequest
|
|
|
|
// GetOAuth2ConsentRequestExecute executes the request
|
|
// @return OAuth2ConsentRequest
|
|
GetOAuth2ConsentRequestExecute(r OAuth2APIGetOAuth2ConsentRequestRequest) (*OAuth2ConsentRequest, *http.Response, error)
|
|
|
|
/*
|
|
GetOAuth2LoginRequest Get OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
Per default, the login provider is Ory itself. You may use a different login provider which needs to be a web-app
|
|
you write and host, and it must be able to authenticate ("show the subject a login screen")
|
|
a subject (in OAuth2 the proper name for subject is "resource owner").
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2LoginRequestRequest
|
|
*/
|
|
GetOAuth2LoginRequest(ctx context.Context) OAuth2APIGetOAuth2LoginRequestRequest
|
|
|
|
// GetOAuth2LoginRequestExecute executes the request
|
|
// @return OAuth2LoginRequest
|
|
GetOAuth2LoginRequestExecute(r OAuth2APIGetOAuth2LoginRequestRequest) (*OAuth2LoginRequest, *http.Response, error)
|
|
|
|
/*
|
|
GetOAuth2LogoutRequest Get OAuth 2.0 Session Logout Request
|
|
|
|
Use this endpoint to fetch an Ory OAuth 2.0 logout request.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2LogoutRequestRequest
|
|
*/
|
|
GetOAuth2LogoutRequest(ctx context.Context) OAuth2APIGetOAuth2LogoutRequestRequest
|
|
|
|
// GetOAuth2LogoutRequestExecute executes the request
|
|
// @return OAuth2LogoutRequest
|
|
GetOAuth2LogoutRequestExecute(r OAuth2APIGetOAuth2LogoutRequestRequest) (*OAuth2LogoutRequest, *http.Response, error)
|
|
|
|
/*
|
|
GetTrustedOAuth2JwtGrantIssuer Get 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 OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
GetTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest
|
|
|
|
// GetTrustedOAuth2JwtGrantIssuerExecute executes the request
|
|
// @return TrustedOAuth2JwtGrantIssuer
|
|
GetTrustedOAuth2JwtGrantIssuerExecute(r OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error)
|
|
|
|
/*
|
|
IntrospectOAuth2Token Introspect OAuth2 Access and 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 `session.access_token` during the consent flow.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIIntrospectOAuth2TokenRequest
|
|
*/
|
|
IntrospectOAuth2Token(ctx context.Context) OAuth2APIIntrospectOAuth2TokenRequest
|
|
|
|
// IntrospectOAuth2TokenExecute executes the request
|
|
// @return IntrospectedOAuth2Token
|
|
IntrospectOAuth2TokenExecute(r OAuth2APIIntrospectOAuth2TokenRequest) (*IntrospectedOAuth2Token, *http.Response, error)
|
|
|
|
/*
|
|
ListOAuth2Clients List OAuth 2.0 Clients
|
|
|
|
This endpoint lists all clients in the database, and never returns client secrets.
|
|
As a default it lists the first 100 clients.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIListOAuth2ClientsRequest
|
|
*/
|
|
ListOAuth2Clients(ctx context.Context) OAuth2APIListOAuth2ClientsRequest
|
|
|
|
// ListOAuth2ClientsExecute executes the request
|
|
// @return []OAuth2Client
|
|
ListOAuth2ClientsExecute(r OAuth2APIListOAuth2ClientsRequest) ([]OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
ListOAuth2ConsentSessions List OAuth 2.0 Consent Sessions of a Subject
|
|
|
|
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
|
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
|
empty JSON array with status code 200 OK.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIListOAuth2ConsentSessionsRequest
|
|
*/
|
|
ListOAuth2ConsentSessions(ctx context.Context) OAuth2APIListOAuth2ConsentSessionsRequest
|
|
|
|
// ListOAuth2ConsentSessionsExecute executes the request
|
|
// @return []OAuth2ConsentSession
|
|
ListOAuth2ConsentSessionsExecute(r OAuth2APIListOAuth2ConsentSessionsRequest) ([]OAuth2ConsentSession, *http.Response, error)
|
|
|
|
/*
|
|
ListTrustedOAuth2JwtGrantIssuers 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 OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest
|
|
*/
|
|
ListTrustedOAuth2JwtGrantIssuers(ctx context.Context) OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest
|
|
|
|
// ListTrustedOAuth2JwtGrantIssuersExecute executes the request
|
|
// @return []TrustedOAuth2JwtGrantIssuer
|
|
ListTrustedOAuth2JwtGrantIssuersExecute(r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error)
|
|
|
|
/*
|
|
OAuth2Authorize OAuth 2.0 Authorize Endpoint
|
|
|
|
Use open source libraries to perform OAuth 2.0 and OpenID Connect
|
|
available for any programming language. You can find a list of libraries at https://oauth.net/code/
|
|
|
|
The Ory SDK is not yet able to this endpoint properly.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIOAuth2AuthorizeRequest
|
|
*/
|
|
OAuth2Authorize(ctx context.Context) OAuth2APIOAuth2AuthorizeRequest
|
|
|
|
// OAuth2AuthorizeExecute executes the request
|
|
// @return ErrorOAuth2
|
|
OAuth2AuthorizeExecute(r OAuth2APIOAuth2AuthorizeRequest) (*ErrorOAuth2, *http.Response, error)
|
|
|
|
/*
|
|
Oauth2TokenExchange The OAuth 2.0 Token Endpoint
|
|
|
|
Use open source libraries to perform OAuth 2.0 and OpenID Connect
|
|
available for any programming language. You can find a list of libraries here https://oauth.net/code/
|
|
|
|
The Ory SDK is not yet able to this endpoint properly.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIOauth2TokenExchangeRequest
|
|
*/
|
|
Oauth2TokenExchange(ctx context.Context) OAuth2APIOauth2TokenExchangeRequest
|
|
|
|
// Oauth2TokenExchangeExecute executes the request
|
|
// @return OAuth2TokenExchange
|
|
Oauth2TokenExchangeExecute(r OAuth2APIOauth2TokenExchangeRequest) (*OAuth2TokenExchange, *http.Response, error)
|
|
|
|
/*
|
|
PatchOAuth2Client Patch OAuth 2.0 Client
|
|
|
|
Patch an existing OAuth 2.0 Client using JSON Patch. If you pass `client_secret`
|
|
the secret will be updated and returned via the API. This is the
|
|
only time you will be able to retrieve the client secret, so write it down and keep it safe.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIPatchOAuth2ClientRequest
|
|
*/
|
|
PatchOAuth2Client(ctx context.Context, id string) OAuth2APIPatchOAuth2ClientRequest
|
|
|
|
// PatchOAuth2ClientExecute executes the request
|
|
// @return OAuth2Client
|
|
PatchOAuth2ClientExecute(r OAuth2APIPatchOAuth2ClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
RejectOAuth2ConsentRequest Reject OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
This endpoint tells Ory that the subject has not authorized the OAuth 2.0 client to access resources on his/her behalf.
|
|
The consent provider must include a reason why the consent was not granted.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2ConsentRequestRequest
|
|
*/
|
|
RejectOAuth2ConsentRequest(ctx context.Context) OAuth2APIRejectOAuth2ConsentRequestRequest
|
|
|
|
// RejectOAuth2ConsentRequestExecute executes the request
|
|
// @return OAuth2RedirectTo
|
|
RejectOAuth2ConsentRequestExecute(r OAuth2APIRejectOAuth2ConsentRequestRequest) (*OAuth2RedirectTo, *http.Response, error)
|
|
|
|
/*
|
|
RejectOAuth2LoginRequest Reject OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
This endpoint tells Ory that the subject has not authenticated and includes a reason why the authentication
|
|
was denied.
|
|
|
|
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2LoginRequestRequest
|
|
*/
|
|
RejectOAuth2LoginRequest(ctx context.Context) OAuth2APIRejectOAuth2LoginRequestRequest
|
|
|
|
// RejectOAuth2LoginRequestExecute executes the request
|
|
// @return OAuth2RedirectTo
|
|
RejectOAuth2LoginRequestExecute(r OAuth2APIRejectOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error)
|
|
|
|
/*
|
|
RejectOAuth2LogoutRequest Reject OAuth 2.0 Session Logout Request
|
|
|
|
When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to deny that logout request.
|
|
No HTTP request body is required.
|
|
|
|
The response is empty as the logout provider has to chose what action to perform next.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2LogoutRequestRequest
|
|
*/
|
|
RejectOAuth2LogoutRequest(ctx context.Context) OAuth2APIRejectOAuth2LogoutRequestRequest
|
|
|
|
// RejectOAuth2LogoutRequestExecute executes the request
|
|
RejectOAuth2LogoutRequestExecute(r OAuth2APIRejectOAuth2LogoutRequestRequest) (*http.Response, error)
|
|
|
|
/*
|
|
RevokeOAuth2ConsentSessions Revoke OAuth 2.0 Consent Sessions of a Subject
|
|
|
|
This endpoint revokes a subject's granted consent sessions and invalidates all
|
|
associated OAuth 2.0 Access Tokens. You may also only revoke sessions for a specific OAuth 2.0 Client ID.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2ConsentSessionsRequest
|
|
*/
|
|
RevokeOAuth2ConsentSessions(ctx context.Context) OAuth2APIRevokeOAuth2ConsentSessionsRequest
|
|
|
|
// RevokeOAuth2ConsentSessionsExecute executes the request
|
|
RevokeOAuth2ConsentSessionsExecute(r OAuth2APIRevokeOAuth2ConsentSessionsRequest) (*http.Response, error)
|
|
|
|
/*
|
|
RevokeOAuth2LoginSessions Revokes OAuth 2.0 Login Sessions by either a Subject or a SessionID
|
|
|
|
This endpoint invalidates authentication sessions. After revoking the authentication session(s), the subject
|
|
has to re-authenticate at the Ory OAuth2 Provider. This endpoint does not invalidate any tokens.
|
|
|
|
If you send the subject in a query param, all authentication sessions that belong to that subject are revoked.
|
|
No OpenID Connect Front- or Back-channel logout is performed in this case.
|
|
|
|
Alternatively, you can send a SessionID via `sid` query param, in which case, only the session that is connected
|
|
to that SessionID is revoked. OpenID Connect Back-channel logout is performed in this case.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2LoginSessionsRequest
|
|
*/
|
|
RevokeOAuth2LoginSessions(ctx context.Context) OAuth2APIRevokeOAuth2LoginSessionsRequest
|
|
|
|
// RevokeOAuth2LoginSessionsExecute executes the request
|
|
RevokeOAuth2LoginSessionsExecute(r OAuth2APIRevokeOAuth2LoginSessionsRequest) (*http.Response, error)
|
|
|
|
/*
|
|
RevokeOAuth2Token Revoke OAuth 2.0 Access or Refresh Token
|
|
|
|
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access token can no
|
|
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh an access token.
|
|
Revoking a refresh token also invalidates the access token that was created with it. A token may only be revoked by
|
|
the client the token was generated for.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2TokenRequest
|
|
*/
|
|
RevokeOAuth2Token(ctx context.Context) OAuth2APIRevokeOAuth2TokenRequest
|
|
|
|
// RevokeOAuth2TokenExecute executes the request
|
|
RevokeOAuth2TokenExecute(r OAuth2APIRevokeOAuth2TokenRequest) (*http.Response, error)
|
|
|
|
/*
|
|
SetOAuth2Client Set OAuth 2.0 Client
|
|
|
|
Replaces an existing OAuth 2.0 Client with the payload you send. If you pass `client_secret` the secret is used,
|
|
otherwise the existing secret is used.
|
|
|
|
If set, the secret is echoed in the response. It is not possible to retrieve it later on.
|
|
|
|
OAuth 2.0 Clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id OAuth 2.0 Client ID
|
|
@return OAuth2APISetOAuth2ClientRequest
|
|
*/
|
|
SetOAuth2Client(ctx context.Context, id string) OAuth2APISetOAuth2ClientRequest
|
|
|
|
// SetOAuth2ClientExecute executes the request
|
|
// @return OAuth2Client
|
|
SetOAuth2ClientExecute(r OAuth2APISetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
SetOAuth2ClientLifespans Set OAuth2 Client Token Lifespans
|
|
|
|
Set lifespans of different token types issued for this OAuth 2.0 client. Does not modify other fields.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id OAuth 2.0 Client ID
|
|
@return OAuth2APISetOAuth2ClientLifespansRequest
|
|
*/
|
|
SetOAuth2ClientLifespans(ctx context.Context, id string) OAuth2APISetOAuth2ClientLifespansRequest
|
|
|
|
// SetOAuth2ClientLifespansExecute executes the request
|
|
// @return OAuth2Client
|
|
SetOAuth2ClientLifespansExecute(r OAuth2APISetOAuth2ClientLifespansRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
TrustOAuth2JwtGrantIssuer Trust OAuth2 JWT Bearer Grant Type Issuer
|
|
|
|
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().
|
|
@return OAuth2APITrustOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
TrustOAuth2JwtGrantIssuer(ctx context.Context) OAuth2APITrustOAuth2JwtGrantIssuerRequest
|
|
|
|
// TrustOAuth2JwtGrantIssuerExecute executes the request
|
|
// @return TrustedOAuth2JwtGrantIssuer
|
|
TrustOAuth2JwtGrantIssuerExecute(r OAuth2APITrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error)
|
|
}
|
|
|
|
// OAuth2APIService OAuth2API service
|
|
type OAuth2APIService service
|
|
|
|
type OAuth2APIAcceptOAuth2ConsentRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
consentChallenge *string
|
|
acceptOAuth2ConsentRequest *AcceptOAuth2ConsentRequest
|
|
}
|
|
|
|
// OAuth 2.0 Consent Request Challenge
|
|
func (r OAuth2APIAcceptOAuth2ConsentRequestRequest) ConsentChallenge(consentChallenge string) OAuth2APIAcceptOAuth2ConsentRequestRequest {
|
|
r.consentChallenge = &consentChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIAcceptOAuth2ConsentRequestRequest) AcceptOAuth2ConsentRequest(acceptOAuth2ConsentRequest AcceptOAuth2ConsentRequest) OAuth2APIAcceptOAuth2ConsentRequestRequest {
|
|
r.acceptOAuth2ConsentRequest = &acceptOAuth2ConsentRequest
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIAcceptOAuth2ConsentRequestRequest) Execute() (*OAuth2RedirectTo, *http.Response, error) {
|
|
return r.ApiService.AcceptOAuth2ConsentRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
AcceptOAuth2ConsentRequest Accept OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
This endpoint tells Ory that the subject has authorized the OAuth 2.0 client to access resources on his/her behalf.
|
|
The consent provider includes additional information, such as session data for access and ID tokens, and if the
|
|
consent request should be used as basis for future requests.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2ConsentRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) AcceptOAuth2ConsentRequest(ctx context.Context) OAuth2APIAcceptOAuth2ConsentRequestRequest {
|
|
return OAuth2APIAcceptOAuth2ConsentRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2RedirectTo
|
|
func (a *OAuth2APIService) AcceptOAuth2ConsentRequestExecute(r OAuth2APIAcceptOAuth2ConsentRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2RedirectTo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.AcceptOAuth2ConsentRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/consent/accept"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.consentChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("consentChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "consent_challenge", r.consentChallenge, "")
|
|
// 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.acceptOAuth2ConsentRequest
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIAcceptOAuth2LoginRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
loginChallenge *string
|
|
acceptOAuth2LoginRequest *AcceptOAuth2LoginRequest
|
|
}
|
|
|
|
// OAuth 2.0 Login Request Challenge
|
|
func (r OAuth2APIAcceptOAuth2LoginRequestRequest) LoginChallenge(loginChallenge string) OAuth2APIAcceptOAuth2LoginRequestRequest {
|
|
r.loginChallenge = &loginChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIAcceptOAuth2LoginRequestRequest) AcceptOAuth2LoginRequest(acceptOAuth2LoginRequest AcceptOAuth2LoginRequest) OAuth2APIAcceptOAuth2LoginRequestRequest {
|
|
r.acceptOAuth2LoginRequest = &acceptOAuth2LoginRequest
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIAcceptOAuth2LoginRequestRequest) Execute() (*OAuth2RedirectTo, *http.Response, error) {
|
|
return r.ApiService.AcceptOAuth2LoginRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
AcceptOAuth2LoginRequest Accept OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
This endpoint tells Ory that the subject has successfully authenticated and includes additional information such as
|
|
the subject's ID and if Ory should remember the subject's subject agent for future authentication attempts by setting
|
|
a cookie.
|
|
|
|
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2LoginRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) AcceptOAuth2LoginRequest(ctx context.Context) OAuth2APIAcceptOAuth2LoginRequestRequest {
|
|
return OAuth2APIAcceptOAuth2LoginRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2RedirectTo
|
|
func (a *OAuth2APIService) AcceptOAuth2LoginRequestExecute(r OAuth2APIAcceptOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2RedirectTo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.AcceptOAuth2LoginRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/login/accept"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.loginChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("loginChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "")
|
|
// 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.acceptOAuth2LoginRequest
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIAcceptOAuth2LogoutRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
logoutChallenge *string
|
|
}
|
|
|
|
// OAuth 2.0 Logout Request Challenge
|
|
func (r OAuth2APIAcceptOAuth2LogoutRequestRequest) LogoutChallenge(logoutChallenge string) OAuth2APIAcceptOAuth2LogoutRequestRequest {
|
|
r.logoutChallenge = &logoutChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIAcceptOAuth2LogoutRequestRequest) Execute() (*OAuth2RedirectTo, *http.Response, error) {
|
|
return r.ApiService.AcceptOAuth2LogoutRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
AcceptOAuth2LogoutRequest Accept OAuth 2.0 Session Logout Request
|
|
|
|
When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to confirm that logout request.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIAcceptOAuth2LogoutRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) AcceptOAuth2LogoutRequest(ctx context.Context) OAuth2APIAcceptOAuth2LogoutRequestRequest {
|
|
return OAuth2APIAcceptOAuth2LogoutRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2RedirectTo
|
|
func (a *OAuth2APIService) AcceptOAuth2LogoutRequestExecute(r OAuth2APIAcceptOAuth2LogoutRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2RedirectTo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.AcceptOAuth2LogoutRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/logout/accept"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.logoutChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("logoutChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "logout_challenge", r.logoutChallenge, "")
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APICreateOAuth2ClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
oAuth2Client *OAuth2Client
|
|
}
|
|
|
|
// OAuth 2.0 Client Request Body
|
|
func (r OAuth2APICreateOAuth2ClientRequest) OAuth2Client(oAuth2Client OAuth2Client) OAuth2APICreateOAuth2ClientRequest {
|
|
r.oAuth2Client = &oAuth2Client
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APICreateOAuth2ClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.CreateOAuth2ClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
CreateOAuth2Client Create OAuth 2.0 Client
|
|
|
|
Create a new OAuth 2.0 client. If you pass `client_secret` the secret is used, otherwise a random secret
|
|
is generated. The secret is echoed in the response. It is not possible to retrieve it later on.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APICreateOAuth2ClientRequest
|
|
*/
|
|
func (a *OAuth2APIService) CreateOAuth2Client(ctx context.Context) OAuth2APICreateOAuth2ClientRequest {
|
|
return OAuth2APICreateOAuth2ClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OAuth2APIService) CreateOAuth2ClientExecute(r OAuth2APICreateOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.CreateOAuth2Client")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.oAuth2Client == nil {
|
|
return localVarReturnValue, nil, reportError("oAuth2Client 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.oAuth2Client
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIDeleteOAuth2ClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
}
|
|
|
|
func (r OAuth2APIDeleteOAuth2ClientRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteOAuth2ClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteOAuth2Client Delete OAuth 2.0 Client
|
|
|
|
Delete an existing OAuth 2.0 Client by its ID.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
Make sure that this endpoint is well protected and only callable by first-party components.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIDeleteOAuth2ClientRequest
|
|
*/
|
|
func (a *OAuth2APIService) DeleteOAuth2Client(ctx context.Context, id string) OAuth2APIDeleteOAuth2ClientRequest {
|
|
return OAuth2APIDeleteOAuth2ClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) DeleteOAuth2ClientExecute(r OAuth2APIDeleteOAuth2ClientRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.DeleteOAuth2Client")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIDeleteOAuth2TokenRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
clientId *string
|
|
}
|
|
|
|
// OAuth 2.0 Client ID
|
|
func (r OAuth2APIDeleteOAuth2TokenRequest) ClientId(clientId string) OAuth2APIDeleteOAuth2TokenRequest {
|
|
r.clientId = &clientId
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIDeleteOAuth2TokenRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteOAuth2TokenExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteOAuth2Token Delete OAuth 2.0 Access Tokens from specific OAuth 2.0 Client
|
|
|
|
This endpoint deletes OAuth2 access tokens issued to an OAuth 2.0 Client from the database.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIDeleteOAuth2TokenRequest
|
|
*/
|
|
func (a *OAuth2APIService) DeleteOAuth2Token(ctx context.Context) OAuth2APIDeleteOAuth2TokenRequest {
|
|
return OAuth2APIDeleteOAuth2TokenRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) DeleteOAuth2TokenExecute(r OAuth2APIDeleteOAuth2TokenRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.DeleteOAuth2Token")
|
|
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")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "client_id", 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
}
|
|
|
|
func (r OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteTrustedOAuth2JwtGrantIssuerExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteTrustedOAuth2JwtGrantIssuer Delete 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 OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
func (a *OAuth2APIService) DeleteTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest {
|
|
return OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) DeleteTrustedOAuth2JwtGrantIssuerExecute(r OAuth2APIDeleteTrustedOAuth2JwtGrantIssuerRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.DeleteTrustedOAuth2JwtGrantIssuer")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/trust/grants/jwt-bearer/issuers/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIGetOAuth2ClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
}
|
|
|
|
func (r OAuth2APIGetOAuth2ClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.GetOAuth2ClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOAuth2Client Get an OAuth 2.0 Client
|
|
|
|
Get an OAuth 2.0 client by its ID. This endpoint never returns the client secret.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIGetOAuth2ClientRequest
|
|
*/
|
|
func (a *OAuth2APIService) GetOAuth2Client(ctx context.Context, id string) OAuth2APIGetOAuth2ClientRequest {
|
|
return OAuth2APIGetOAuth2ClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OAuth2APIService) GetOAuth2ClientExecute(r OAuth2APIGetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.GetOAuth2Client")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIGetOAuth2ConsentRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
consentChallenge *string
|
|
}
|
|
|
|
// OAuth 2.0 Consent Request Challenge
|
|
func (r OAuth2APIGetOAuth2ConsentRequestRequest) ConsentChallenge(consentChallenge string) OAuth2APIGetOAuth2ConsentRequestRequest {
|
|
r.consentChallenge = &consentChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIGetOAuth2ConsentRequestRequest) Execute() (*OAuth2ConsentRequest, *http.Response, error) {
|
|
return r.ApiService.GetOAuth2ConsentRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOAuth2ConsentRequest Get OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2ConsentRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) GetOAuth2ConsentRequest(ctx context.Context) OAuth2APIGetOAuth2ConsentRequestRequest {
|
|
return OAuth2APIGetOAuth2ConsentRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2ConsentRequest
|
|
func (a *OAuth2APIService) GetOAuth2ConsentRequestExecute(r OAuth2APIGetOAuth2ConsentRequestRequest) (*OAuth2ConsentRequest, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2ConsentRequest
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.GetOAuth2ConsentRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/consent"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.consentChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("consentChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "consent_challenge", r.consentChallenge, "")
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 410 {
|
|
var v OAuth2RedirectTo
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIGetOAuth2LoginRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
loginChallenge *string
|
|
}
|
|
|
|
// OAuth 2.0 Login Request Challenge
|
|
func (r OAuth2APIGetOAuth2LoginRequestRequest) LoginChallenge(loginChallenge string) OAuth2APIGetOAuth2LoginRequestRequest {
|
|
r.loginChallenge = &loginChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIGetOAuth2LoginRequestRequest) Execute() (*OAuth2LoginRequest, *http.Response, error) {
|
|
return r.ApiService.GetOAuth2LoginRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOAuth2LoginRequest Get OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
Per default, the login provider is Ory itself. You may use a different login provider which needs to be a web-app
|
|
you write and host, and it must be able to authenticate ("show the subject a login screen")
|
|
a subject (in OAuth2 the proper name for subject is "resource owner").
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2LoginRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) GetOAuth2LoginRequest(ctx context.Context) OAuth2APIGetOAuth2LoginRequestRequest {
|
|
return OAuth2APIGetOAuth2LoginRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2LoginRequest
|
|
func (a *OAuth2APIService) GetOAuth2LoginRequestExecute(r OAuth2APIGetOAuth2LoginRequestRequest) (*OAuth2LoginRequest, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2LoginRequest
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.GetOAuth2LoginRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/login"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.loginChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("loginChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "")
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 410 {
|
|
var v OAuth2RedirectTo
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIGetOAuth2LogoutRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
logoutChallenge *string
|
|
}
|
|
|
|
func (r OAuth2APIGetOAuth2LogoutRequestRequest) LogoutChallenge(logoutChallenge string) OAuth2APIGetOAuth2LogoutRequestRequest {
|
|
r.logoutChallenge = &logoutChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIGetOAuth2LogoutRequestRequest) Execute() (*OAuth2LogoutRequest, *http.Response, error) {
|
|
return r.ApiService.GetOAuth2LogoutRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOAuth2LogoutRequest Get OAuth 2.0 Session Logout Request
|
|
|
|
Use this endpoint to fetch an Ory OAuth 2.0 logout request.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIGetOAuth2LogoutRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) GetOAuth2LogoutRequest(ctx context.Context) OAuth2APIGetOAuth2LogoutRequestRequest {
|
|
return OAuth2APIGetOAuth2LogoutRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2LogoutRequest
|
|
func (a *OAuth2APIService) GetOAuth2LogoutRequestExecute(r OAuth2APIGetOAuth2LogoutRequestRequest) (*OAuth2LogoutRequest, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2LogoutRequest
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.GetOAuth2LogoutRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/logout"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.logoutChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("logoutChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "logout_challenge", r.logoutChallenge, "")
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 410 {
|
|
var v OAuth2RedirectTo
|
|
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr.error = err.Error()
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
}
|
|
|
|
func (r OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
return r.ApiService.GetTrustedOAuth2JwtGrantIssuerExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetTrustedOAuth2JwtGrantIssuer Get 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 OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
func (a *OAuth2APIService) GetTrustedOAuth2JwtGrantIssuer(ctx context.Context, id string) OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest {
|
|
return OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return TrustedOAuth2JwtGrantIssuer
|
|
func (a *OAuth2APIService) GetTrustedOAuth2JwtGrantIssuerExecute(r OAuth2APIGetTrustedOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TrustedOAuth2JwtGrantIssuer
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.GetTrustedOAuth2JwtGrantIssuer")
|
|
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(parameterValueToString(r.id, "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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIIntrospectOAuth2TokenRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
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 OAuth2APIIntrospectOAuth2TokenRequest) Token(token string) OAuth2APIIntrospectOAuth2TokenRequest {
|
|
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 OAuth2APIIntrospectOAuth2TokenRequest) Scope(scope string) OAuth2APIIntrospectOAuth2TokenRequest {
|
|
r.scope = &scope
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIIntrospectOAuth2TokenRequest) Execute() (*IntrospectedOAuth2Token, *http.Response, error) {
|
|
return r.ApiService.IntrospectOAuth2TokenExecute(r)
|
|
}
|
|
|
|
/*
|
|
IntrospectOAuth2Token Introspect OAuth2 Access and 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 `session.access_token` during the consent flow.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIIntrospectOAuth2TokenRequest
|
|
*/
|
|
func (a *OAuth2APIService) IntrospectOAuth2Token(ctx context.Context) OAuth2APIIntrospectOAuth2TokenRequest {
|
|
return OAuth2APIIntrospectOAuth2TokenRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return IntrospectedOAuth2Token
|
|
func (a *OAuth2APIService) IntrospectOAuth2TokenExecute(r OAuth2APIIntrospectOAuth2TokenRequest) (*IntrospectedOAuth2Token, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *IntrospectedOAuth2Token
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.IntrospectOAuth2Token")
|
|
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 {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "scope", r.scope, "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "token", 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIListOAuth2ClientsRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
pageSize *int64
|
|
pageToken *string
|
|
clientName *string
|
|
owner *string
|
|
}
|
|
|
|
// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
|
|
func (r OAuth2APIListOAuth2ClientsRequest) PageSize(pageSize int64) OAuth2APIListOAuth2ClientsRequest {
|
|
r.pageSize = &pageSize
|
|
return r
|
|
}
|
|
|
|
// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
|
|
func (r OAuth2APIListOAuth2ClientsRequest) PageToken(pageToken string) OAuth2APIListOAuth2ClientsRequest {
|
|
r.pageToken = &pageToken
|
|
return r
|
|
}
|
|
|
|
// The name of the clients to filter by.
|
|
func (r OAuth2APIListOAuth2ClientsRequest) ClientName(clientName string) OAuth2APIListOAuth2ClientsRequest {
|
|
r.clientName = &clientName
|
|
return r
|
|
}
|
|
|
|
// The owner of the clients to filter by.
|
|
func (r OAuth2APIListOAuth2ClientsRequest) Owner(owner string) OAuth2APIListOAuth2ClientsRequest {
|
|
r.owner = &owner
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIListOAuth2ClientsRequest) Execute() ([]OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.ListOAuth2ClientsExecute(r)
|
|
}
|
|
|
|
/*
|
|
ListOAuth2Clients List OAuth 2.0 Clients
|
|
|
|
This endpoint lists all clients in the database, and never returns client secrets.
|
|
As a default it lists the first 100 clients.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIListOAuth2ClientsRequest
|
|
*/
|
|
func (a *OAuth2APIService) ListOAuth2Clients(ctx context.Context) OAuth2APIListOAuth2ClientsRequest {
|
|
return OAuth2APIListOAuth2ClientsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return []OAuth2Client
|
|
func (a *OAuth2APIService) ListOAuth2ClientsExecute(r OAuth2APIListOAuth2ClientsRequest) ([]OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.ListOAuth2Clients")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.pageSize != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "")
|
|
} else {
|
|
var defaultValue int64 = 250
|
|
r.pageSize = &defaultValue
|
|
}
|
|
if r.pageToken != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "")
|
|
} else {
|
|
var defaultValue string = "1"
|
|
r.pageToken = &defaultValue
|
|
}
|
|
if r.clientName != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "client_name", r.clientName, "")
|
|
}
|
|
if r.owner != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "owner", r.owner, "")
|
|
}
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIListOAuth2ConsentSessionsRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
subject *string
|
|
pageSize *int64
|
|
pageToken *string
|
|
loginSessionId *string
|
|
}
|
|
|
|
// The subject to list the consent sessions for.
|
|
func (r OAuth2APIListOAuth2ConsentSessionsRequest) Subject(subject string) OAuth2APIListOAuth2ConsentSessionsRequest {
|
|
r.subject = &subject
|
|
return r
|
|
}
|
|
|
|
// Items per Page This is the number of items per page to return. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
|
|
func (r OAuth2APIListOAuth2ConsentSessionsRequest) PageSize(pageSize int64) OAuth2APIListOAuth2ConsentSessionsRequest {
|
|
r.pageSize = &pageSize
|
|
return r
|
|
}
|
|
|
|
// Next Page Token The next page token. For details on pagination please head over to the [pagination documentation](https://www.ory.sh/docs/ecosystem/api-design#pagination).
|
|
func (r OAuth2APIListOAuth2ConsentSessionsRequest) PageToken(pageToken string) OAuth2APIListOAuth2ConsentSessionsRequest {
|
|
r.pageToken = &pageToken
|
|
return r
|
|
}
|
|
|
|
// The login session id to list the consent sessions for.
|
|
func (r OAuth2APIListOAuth2ConsentSessionsRequest) LoginSessionId(loginSessionId string) OAuth2APIListOAuth2ConsentSessionsRequest {
|
|
r.loginSessionId = &loginSessionId
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIListOAuth2ConsentSessionsRequest) Execute() ([]OAuth2ConsentSession, *http.Response, error) {
|
|
return r.ApiService.ListOAuth2ConsentSessionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
ListOAuth2ConsentSessions List OAuth 2.0 Consent Sessions of a Subject
|
|
|
|
This endpoint lists all subject's granted consent sessions, including client and granted scope.
|
|
If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an
|
|
empty JSON array with status code 200 OK.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIListOAuth2ConsentSessionsRequest
|
|
*/
|
|
func (a *OAuth2APIService) ListOAuth2ConsentSessions(ctx context.Context) OAuth2APIListOAuth2ConsentSessionsRequest {
|
|
return OAuth2APIListOAuth2ConsentSessionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return []OAuth2ConsentSession
|
|
func (a *OAuth2APIService) ListOAuth2ConsentSessionsExecute(r OAuth2APIListOAuth2ConsentSessionsRequest) ([]OAuth2ConsentSession, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []OAuth2ConsentSession
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.ListOAuth2ConsentSessions")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/sessions/consent"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.subject == nil {
|
|
return localVarReturnValue, nil, reportError("subject is required and must be specified")
|
|
}
|
|
|
|
if r.pageSize != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "page_size", r.pageSize, "")
|
|
} else {
|
|
var defaultValue int64 = 250
|
|
r.pageSize = &defaultValue
|
|
}
|
|
if r.pageToken != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "page_token", r.pageToken, "")
|
|
} else {
|
|
var defaultValue string = "1"
|
|
r.pageToken = &defaultValue
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "subject", r.subject, "")
|
|
if r.loginSessionId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "login_session_id", r.loginSessionId, "")
|
|
}
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
maxItems *int64
|
|
defaultItems *int64
|
|
issuer *string
|
|
}
|
|
|
|
func (r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) MaxItems(maxItems int64) OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest {
|
|
r.maxItems = &maxItems
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) DefaultItems(defaultItems int64) OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest {
|
|
r.defaultItems = &defaultItems
|
|
return r
|
|
}
|
|
|
|
// If optional \"issuer\" is supplied, only jwt-bearer grants with this issuer will be returned.
|
|
func (r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) Issuer(issuer string) OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest {
|
|
r.issuer = &issuer
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) Execute() ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
return r.ApiService.ListTrustedOAuth2JwtGrantIssuersExecute(r)
|
|
}
|
|
|
|
/*
|
|
ListTrustedOAuth2JwtGrantIssuers 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 OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest
|
|
*/
|
|
func (a *OAuth2APIService) ListTrustedOAuth2JwtGrantIssuers(ctx context.Context) OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest {
|
|
return OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return []TrustedOAuth2JwtGrantIssuer
|
|
func (a *OAuth2APIService) ListTrustedOAuth2JwtGrantIssuersExecute(r OAuth2APIListTrustedOAuth2JwtGrantIssuersRequest) ([]TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue []TrustedOAuth2JwtGrantIssuer
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.ListTrustedOAuth2JwtGrantIssuers")
|
|
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 {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "MaxItems", r.maxItems, "")
|
|
}
|
|
if r.defaultItems != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "DefaultItems", r.defaultItems, "")
|
|
}
|
|
if r.issuer != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "issuer", r.issuer, "")
|
|
}
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIOAuth2AuthorizeRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
}
|
|
|
|
func (r OAuth2APIOAuth2AuthorizeRequest) Execute() (*ErrorOAuth2, *http.Response, error) {
|
|
return r.ApiService.OAuth2AuthorizeExecute(r)
|
|
}
|
|
|
|
/*
|
|
OAuth2Authorize OAuth 2.0 Authorize Endpoint
|
|
|
|
Use open source libraries to perform OAuth 2.0 and OpenID Connect
|
|
available for any programming language. You can find a list of libraries at https://oauth.net/code/
|
|
|
|
The Ory SDK is not yet able to this endpoint properly.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIOAuth2AuthorizeRequest
|
|
*/
|
|
func (a *OAuth2APIService) OAuth2Authorize(ctx context.Context) OAuth2APIOAuth2AuthorizeRequest {
|
|
return OAuth2APIOAuth2AuthorizeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return ErrorOAuth2
|
|
func (a *OAuth2APIService) OAuth2AuthorizeExecute(r OAuth2APIOAuth2AuthorizeRequest) (*ErrorOAuth2, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *ErrorOAuth2
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.OAuth2Authorize")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/auth"
|
|
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIOauth2TokenExchangeRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
grantType *string
|
|
clientId *string
|
|
code *string
|
|
redirectUri *string
|
|
refreshToken *string
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) GrantType(grantType string) OAuth2APIOauth2TokenExchangeRequest {
|
|
r.grantType = &grantType
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) ClientId(clientId string) OAuth2APIOauth2TokenExchangeRequest {
|
|
r.clientId = &clientId
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) Code(code string) OAuth2APIOauth2TokenExchangeRequest {
|
|
r.code = &code
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) RedirectUri(redirectUri string) OAuth2APIOauth2TokenExchangeRequest {
|
|
r.redirectUri = &redirectUri
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) RefreshToken(refreshToken string) OAuth2APIOauth2TokenExchangeRequest {
|
|
r.refreshToken = &refreshToken
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIOauth2TokenExchangeRequest) Execute() (*OAuth2TokenExchange, *http.Response, error) {
|
|
return r.ApiService.Oauth2TokenExchangeExecute(r)
|
|
}
|
|
|
|
/*
|
|
Oauth2TokenExchange The OAuth 2.0 Token Endpoint
|
|
|
|
Use open source libraries to perform OAuth 2.0 and OpenID Connect
|
|
available for any programming language. You can find a list of libraries here https://oauth.net/code/
|
|
|
|
The Ory SDK is not yet able to this endpoint properly.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIOauth2TokenExchangeRequest
|
|
*/
|
|
func (a *OAuth2APIService) Oauth2TokenExchange(ctx context.Context) OAuth2APIOauth2TokenExchangeRequest {
|
|
return OAuth2APIOauth2TokenExchangeRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2TokenExchange
|
|
func (a *OAuth2APIService) Oauth2TokenExchangeExecute(r OAuth2APIOauth2TokenExchangeRequest) (*OAuth2TokenExchange, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2TokenExchange
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.Oauth2TokenExchange")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/token"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.grantType == nil {
|
|
return localVarReturnValue, nil, reportError("grantType 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.clientId != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "client_id", r.clientId, "")
|
|
}
|
|
if r.code != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "code", r.code, "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "grant_type", r.grantType, "")
|
|
if r.redirectUri != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "redirect_uri", r.redirectUri, "")
|
|
}
|
|
if r.refreshToken != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "refresh_token", r.refreshToken, "")
|
|
}
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIPatchOAuth2ClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
jsonPatch *[]JsonPatch
|
|
}
|
|
|
|
// OAuth 2.0 Client JSON Patch Body
|
|
func (r OAuth2APIPatchOAuth2ClientRequest) JsonPatch(jsonPatch []JsonPatch) OAuth2APIPatchOAuth2ClientRequest {
|
|
r.jsonPatch = &jsonPatch
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIPatchOAuth2ClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.PatchOAuth2ClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
PatchOAuth2Client Patch OAuth 2.0 Client
|
|
|
|
Patch an existing OAuth 2.0 Client using JSON Patch. If you pass `client_secret`
|
|
the secret will be updated and returned via the API. This is the
|
|
only time you will be able to retrieve the client secret, so write it down and keep it safe.
|
|
|
|
OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id The id of the OAuth 2.0 Client.
|
|
@return OAuth2APIPatchOAuth2ClientRequest
|
|
*/
|
|
func (a *OAuth2APIService) PatchOAuth2Client(ctx context.Context, id string) OAuth2APIPatchOAuth2ClientRequest {
|
|
return OAuth2APIPatchOAuth2ClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OAuth2APIService) PatchOAuth2ClientExecute(r OAuth2APIPatchOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPatch
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.PatchOAuth2Client")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.jsonPatch == nil {
|
|
return localVarReturnValue, nil, reportError("jsonPatch 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.jsonPatch
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 404 {
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIRejectOAuth2ConsentRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
consentChallenge *string
|
|
rejectOAuth2Request *RejectOAuth2Request
|
|
}
|
|
|
|
// OAuth 2.0 Consent Request Challenge
|
|
func (r OAuth2APIRejectOAuth2ConsentRequestRequest) ConsentChallenge(consentChallenge string) OAuth2APIRejectOAuth2ConsentRequestRequest {
|
|
r.consentChallenge = &consentChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2ConsentRequestRequest) RejectOAuth2Request(rejectOAuth2Request RejectOAuth2Request) OAuth2APIRejectOAuth2ConsentRequestRequest {
|
|
r.rejectOAuth2Request = &rejectOAuth2Request
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2ConsentRequestRequest) Execute() (*OAuth2RedirectTo, *http.Response, error) {
|
|
return r.ApiService.RejectOAuth2ConsentRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
RejectOAuth2ConsentRequest Reject OAuth 2.0 Consent Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if
|
|
the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.
|
|
|
|
The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent
|
|
provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted
|
|
or rejected the request.
|
|
|
|
This endpoint tells Ory that the subject has not authorized the OAuth 2.0 client to access resources on his/her behalf.
|
|
The consent provider must include a reason why the consent was not granted.
|
|
|
|
The response contains a redirect URL which the consent provider should redirect the user-agent to.
|
|
|
|
The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please
|
|
head over to the OAuth 2.0 documentation.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2ConsentRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) RejectOAuth2ConsentRequest(ctx context.Context) OAuth2APIRejectOAuth2ConsentRequestRequest {
|
|
return OAuth2APIRejectOAuth2ConsentRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2RedirectTo
|
|
func (a *OAuth2APIService) RejectOAuth2ConsentRequestExecute(r OAuth2APIRejectOAuth2ConsentRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2RedirectTo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RejectOAuth2ConsentRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/consent/reject"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.consentChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("consentChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "consent_challenge", r.consentChallenge, "")
|
|
// 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.rejectOAuth2Request
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIRejectOAuth2LoginRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
loginChallenge *string
|
|
rejectOAuth2Request *RejectOAuth2Request
|
|
}
|
|
|
|
// OAuth 2.0 Login Request Challenge
|
|
func (r OAuth2APIRejectOAuth2LoginRequestRequest) LoginChallenge(loginChallenge string) OAuth2APIRejectOAuth2LoginRequestRequest {
|
|
r.loginChallenge = &loginChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2LoginRequestRequest) RejectOAuth2Request(rejectOAuth2Request RejectOAuth2Request) OAuth2APIRejectOAuth2LoginRequestRequest {
|
|
r.rejectOAuth2Request = &rejectOAuth2Request
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2LoginRequestRequest) Execute() (*OAuth2RedirectTo, *http.Response, error) {
|
|
return r.ApiService.RejectOAuth2LoginRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
RejectOAuth2LoginRequest Reject OAuth 2.0 Login Request
|
|
|
|
When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider
|
|
to authenticate the subject and then tell the Ory OAuth2 Service about it.
|
|
|
|
The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login
|
|
provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
|
|
|
|
This endpoint tells Ory that the subject has not authenticated and includes a reason why the authentication
|
|
was denied.
|
|
|
|
The response contains a redirect URL which the login provider should redirect the user-agent to.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2LoginRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) RejectOAuth2LoginRequest(ctx context.Context) OAuth2APIRejectOAuth2LoginRequestRequest {
|
|
return OAuth2APIRejectOAuth2LoginRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2RedirectTo
|
|
func (a *OAuth2APIService) RejectOAuth2LoginRequestExecute(r OAuth2APIRejectOAuth2LoginRequestRequest) (*OAuth2RedirectTo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2RedirectTo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RejectOAuth2LoginRequest")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/login/reject"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.loginChallenge == nil {
|
|
return localVarReturnValue, nil, reportError("loginChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "login_challenge", r.loginChallenge, "")
|
|
// 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.rejectOAuth2Request
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APIRejectOAuth2LogoutRequestRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
logoutChallenge *string
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2LogoutRequestRequest) LogoutChallenge(logoutChallenge string) OAuth2APIRejectOAuth2LogoutRequestRequest {
|
|
r.logoutChallenge = &logoutChallenge
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRejectOAuth2LogoutRequestRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RejectOAuth2LogoutRequestExecute(r)
|
|
}
|
|
|
|
/*
|
|
RejectOAuth2LogoutRequest Reject OAuth 2.0 Session Logout Request
|
|
|
|
When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to deny that logout request.
|
|
No HTTP request body is required.
|
|
|
|
The response is empty as the logout provider has to chose what action to perform next.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRejectOAuth2LogoutRequestRequest
|
|
*/
|
|
func (a *OAuth2APIService) RejectOAuth2LogoutRequest(ctx context.Context) OAuth2APIRejectOAuth2LogoutRequestRequest {
|
|
return OAuth2APIRejectOAuth2LogoutRequestRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) RejectOAuth2LogoutRequestExecute(r OAuth2APIRejectOAuth2LogoutRequestRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RejectOAuth2LogoutRequest")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/requests/logout/reject"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.logoutChallenge == nil {
|
|
return nil, reportError("logoutChallenge is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "logout_challenge", r.logoutChallenge, "")
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIRevokeOAuth2ConsentSessionsRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
subject *string
|
|
client *string
|
|
all *bool
|
|
}
|
|
|
|
// OAuth 2.0 Consent Subject The subject whose consent sessions should be deleted.
|
|
func (r OAuth2APIRevokeOAuth2ConsentSessionsRequest) Subject(subject string) OAuth2APIRevokeOAuth2ConsentSessionsRequest {
|
|
r.subject = &subject
|
|
return r
|
|
}
|
|
|
|
// OAuth 2.0 Client ID If set, deletes only those consent sessions that have been granted to the specified OAuth 2.0 Client ID.
|
|
func (r OAuth2APIRevokeOAuth2ConsentSessionsRequest) Client(client string) OAuth2APIRevokeOAuth2ConsentSessionsRequest {
|
|
r.client = &client
|
|
return r
|
|
}
|
|
|
|
// Revoke All Consent Sessions If set to `true` deletes all consent sessions by the Subject that have been granted.
|
|
func (r OAuth2APIRevokeOAuth2ConsentSessionsRequest) All(all bool) OAuth2APIRevokeOAuth2ConsentSessionsRequest {
|
|
r.all = &all
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2ConsentSessionsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RevokeOAuth2ConsentSessionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RevokeOAuth2ConsentSessions Revoke OAuth 2.0 Consent Sessions of a Subject
|
|
|
|
This endpoint revokes a subject's granted consent sessions and invalidates all
|
|
associated OAuth 2.0 Access Tokens. You may also only revoke sessions for a specific OAuth 2.0 Client ID.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2ConsentSessionsRequest
|
|
*/
|
|
func (a *OAuth2APIService) RevokeOAuth2ConsentSessions(ctx context.Context) OAuth2APIRevokeOAuth2ConsentSessionsRequest {
|
|
return OAuth2APIRevokeOAuth2ConsentSessionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) RevokeOAuth2ConsentSessionsExecute(r OAuth2APIRevokeOAuth2ConsentSessionsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RevokeOAuth2ConsentSessions")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/sessions/consent"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.subject == nil {
|
|
return nil, reportError("subject is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "subject", r.subject, "")
|
|
if r.client != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "client", r.client, "")
|
|
}
|
|
if r.all != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "all", r.all, "")
|
|
}
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIRevokeOAuth2LoginSessionsRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
subject *string
|
|
sid *string
|
|
}
|
|
|
|
// OAuth 2.0 Subject The subject to revoke authentication sessions for.
|
|
func (r OAuth2APIRevokeOAuth2LoginSessionsRequest) Subject(subject string) OAuth2APIRevokeOAuth2LoginSessionsRequest {
|
|
r.subject = &subject
|
|
return r
|
|
}
|
|
|
|
// OAuth 2.0 Subject The subject to revoke authentication sessions for.
|
|
func (r OAuth2APIRevokeOAuth2LoginSessionsRequest) Sid(sid string) OAuth2APIRevokeOAuth2LoginSessionsRequest {
|
|
r.sid = &sid
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2LoginSessionsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RevokeOAuth2LoginSessionsExecute(r)
|
|
}
|
|
|
|
/*
|
|
RevokeOAuth2LoginSessions Revokes OAuth 2.0 Login Sessions by either a Subject or a SessionID
|
|
|
|
This endpoint invalidates authentication sessions. After revoking the authentication session(s), the subject
|
|
has to re-authenticate at the Ory OAuth2 Provider. This endpoint does not invalidate any tokens.
|
|
|
|
If you send the subject in a query param, all authentication sessions that belong to that subject are revoked.
|
|
No OpenID Connect Front- or Back-channel logout is performed in this case.
|
|
|
|
Alternatively, you can send a SessionID via `sid` query param, in which case, only the session that is connected
|
|
to that SessionID is revoked. OpenID Connect Back-channel logout is performed in this case.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2LoginSessionsRequest
|
|
*/
|
|
func (a *OAuth2APIService) RevokeOAuth2LoginSessions(ctx context.Context) OAuth2APIRevokeOAuth2LoginSessionsRequest {
|
|
return OAuth2APIRevokeOAuth2LoginSessionsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) RevokeOAuth2LoginSessionsExecute(r OAuth2APIRevokeOAuth2LoginSessionsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RevokeOAuth2LoginSessions")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/oauth2/auth/sessions/login"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.subject != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "subject", r.subject, "")
|
|
}
|
|
if r.sid != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sid", r.sid, "")
|
|
}
|
|
// 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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APIRevokeOAuth2TokenRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
token *string
|
|
clientId *string
|
|
clientSecret *string
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2TokenRequest) Token(token string) OAuth2APIRevokeOAuth2TokenRequest {
|
|
r.token = &token
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2TokenRequest) ClientId(clientId string) OAuth2APIRevokeOAuth2TokenRequest {
|
|
r.clientId = &clientId
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2TokenRequest) ClientSecret(clientSecret string) OAuth2APIRevokeOAuth2TokenRequest {
|
|
r.clientSecret = &clientSecret
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APIRevokeOAuth2TokenRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RevokeOAuth2TokenExecute(r)
|
|
}
|
|
|
|
/*
|
|
RevokeOAuth2Token Revoke OAuth 2.0 Access or Refresh Token
|
|
|
|
Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access token can no
|
|
longer be used to make access requests, and a revoked refresh token can no longer be used to refresh an access token.
|
|
Revoking a refresh token also invalidates the access token that was created with it. A token may only be revoked by
|
|
the client the token was generated for.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OAuth2APIRevokeOAuth2TokenRequest
|
|
*/
|
|
func (a *OAuth2APIService) RevokeOAuth2Token(ctx context.Context) OAuth2APIRevokeOAuth2TokenRequest {
|
|
return OAuth2APIRevokeOAuth2TokenRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OAuth2APIService) RevokeOAuth2TokenExecute(r OAuth2APIRevokeOAuth2TokenRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.RevokeOAuth2Token")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/revoke"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.token == nil {
|
|
return 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.clientId != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "client_id", r.clientId, "")
|
|
}
|
|
if r.clientSecret != nil {
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "client_secret", r.clientSecret, "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarFormParams, "token", r.token, "")
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OAuth2APISetOAuth2ClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
oAuth2Client *OAuth2Client
|
|
}
|
|
|
|
// OAuth 2.0 Client Request Body
|
|
func (r OAuth2APISetOAuth2ClientRequest) OAuth2Client(oAuth2Client OAuth2Client) OAuth2APISetOAuth2ClientRequest {
|
|
r.oAuth2Client = &oAuth2Client
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APISetOAuth2ClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.SetOAuth2ClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
SetOAuth2Client Set OAuth 2.0 Client
|
|
|
|
Replaces an existing OAuth 2.0 Client with the payload you send. If you pass `client_secret` the secret is used,
|
|
otherwise the existing secret is used.
|
|
|
|
If set, the secret is echoed in the response. It is not possible to retrieve it later on.
|
|
|
|
OAuth 2.0 Clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are
|
|
generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id OAuth 2.0 Client ID
|
|
@return OAuth2APISetOAuth2ClientRequest
|
|
*/
|
|
func (a *OAuth2APIService) SetOAuth2Client(ctx context.Context, id string) OAuth2APISetOAuth2ClientRequest {
|
|
return OAuth2APISetOAuth2ClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OAuth2APIService) SetOAuth2ClientExecute(r OAuth2APISetOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.SetOAuth2Client")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients/{id}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.oAuth2Client == nil {
|
|
return localVarReturnValue, nil, reportError("oAuth2Client 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.oAuth2Client
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 400 {
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 404 {
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
newErr.model = v
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APISetOAuth2ClientLifespansRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
id string
|
|
oAuth2ClientTokenLifespans *OAuth2ClientTokenLifespans
|
|
}
|
|
|
|
func (r OAuth2APISetOAuth2ClientLifespansRequest) OAuth2ClientTokenLifespans(oAuth2ClientTokenLifespans OAuth2ClientTokenLifespans) OAuth2APISetOAuth2ClientLifespansRequest {
|
|
r.oAuth2ClientTokenLifespans = &oAuth2ClientTokenLifespans
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APISetOAuth2ClientLifespansRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.SetOAuth2ClientLifespansExecute(r)
|
|
}
|
|
|
|
/*
|
|
SetOAuth2ClientLifespans Set OAuth2 Client Token Lifespans
|
|
|
|
Set lifespans of different token types issued for this OAuth 2.0 client. Does not modify other fields.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param id OAuth 2.0 Client ID
|
|
@return OAuth2APISetOAuth2ClientLifespansRequest
|
|
*/
|
|
func (a *OAuth2APIService) SetOAuth2ClientLifespans(ctx context.Context, id string) OAuth2APISetOAuth2ClientLifespansRequest {
|
|
return OAuth2APISetOAuth2ClientLifespansRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OAuth2APIService) SetOAuth2ClientLifespansExecute(r OAuth2APISetOAuth2ClientLifespansRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.SetOAuth2ClientLifespans")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/admin/clients/{id}/lifespans"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -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.oAuth2ClientTokenLifespans
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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 OAuth2APITrustOAuth2JwtGrantIssuerRequest struct {
|
|
ctx context.Context
|
|
ApiService OAuth2API
|
|
trustOAuth2JwtGrantIssuer *TrustOAuth2JwtGrantIssuer
|
|
}
|
|
|
|
func (r OAuth2APITrustOAuth2JwtGrantIssuerRequest) TrustOAuth2JwtGrantIssuer(trustOAuth2JwtGrantIssuer TrustOAuth2JwtGrantIssuer) OAuth2APITrustOAuth2JwtGrantIssuerRequest {
|
|
r.trustOAuth2JwtGrantIssuer = &trustOAuth2JwtGrantIssuer
|
|
return r
|
|
}
|
|
|
|
func (r OAuth2APITrustOAuth2JwtGrantIssuerRequest) Execute() (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
return r.ApiService.TrustOAuth2JwtGrantIssuerExecute(r)
|
|
}
|
|
|
|
/*
|
|
TrustOAuth2JwtGrantIssuer Trust OAuth2 JWT Bearer Grant Type Issuer
|
|
|
|
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().
|
|
@return OAuth2APITrustOAuth2JwtGrantIssuerRequest
|
|
*/
|
|
func (a *OAuth2APIService) TrustOAuth2JwtGrantIssuer(ctx context.Context) OAuth2APITrustOAuth2JwtGrantIssuerRequest {
|
|
return OAuth2APITrustOAuth2JwtGrantIssuerRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return TrustedOAuth2JwtGrantIssuer
|
|
func (a *OAuth2APIService) TrustOAuth2JwtGrantIssuerExecute(r OAuth2APITrustOAuth2JwtGrantIssuerRequest) (*TrustedOAuth2JwtGrantIssuer, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *TrustedOAuth2JwtGrantIssuer
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OAuth2APIService.TrustOAuth2JwtGrantIssuer")
|
|
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{}
|
|
|
|
// 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.trustOAuth2JwtGrantIssuer
|
|
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 := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.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.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
|
|
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
|
|
}
|