mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-22 18:58:29 +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.
1161 lines
43 KiB
Go
1161 lines
43 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 OidcAPI interface {
|
|
|
|
/*
|
|
CreateOidcDynamicClient Register OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`createOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint
|
|
is disabled by default. It can be enabled by an administrator.
|
|
|
|
Please note that using this endpoint you are not able to choose the `client_secret` nor the `client_id` as those
|
|
values will be server generated when specifying `token_endpoint_auth_method` as `client_secret_basic` or
|
|
`client_secret_post`.
|
|
|
|
The `client_secret` will be returned in the response and you will not be able to retrieve it later on.
|
|
Write the secret down and keep it somewhere safe.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPICreateOidcDynamicClientRequest
|
|
*/
|
|
CreateOidcDynamicClient(ctx context.Context) OidcAPICreateOidcDynamicClientRequest
|
|
|
|
// CreateOidcDynamicClientExecute executes the request
|
|
// @return OAuth2Client
|
|
CreateOidcDynamicClientExecute(r OidcAPICreateOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
CreateVerifiableCredential Issues a Verifiable Credential
|
|
|
|
This endpoint creates a verifiable credential that attests that the user
|
|
authenticated with the provided access token owns a certain public/private key
|
|
pair.
|
|
|
|
More information can be found at
|
|
https://openid.net/specs/openid-connect-userinfo-vc-1_0.html.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPICreateVerifiableCredentialRequest
|
|
*/
|
|
CreateVerifiableCredential(ctx context.Context) OidcAPICreateVerifiableCredentialRequest
|
|
|
|
// CreateVerifiableCredentialExecute executes the request
|
|
// @return VerifiableCredentialResponse
|
|
CreateVerifiableCredentialExecute(r OidcAPICreateVerifiableCredentialRequest) (*VerifiableCredentialResponse, *http.Response, error)
|
|
|
|
/*
|
|
DeleteOidcDynamicClient Delete OAuth 2.0 Client using the OpenID Dynamic Client Registration Management Protocol
|
|
|
|
This endpoint behaves like the administrative counterpart (`deleteOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint
|
|
is disabled by default. It can be enabled by an administrator.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
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 OidcAPIDeleteOidcDynamicClientRequest
|
|
*/
|
|
DeleteOidcDynamicClient(ctx context.Context, id string) OidcAPIDeleteOidcDynamicClientRequest
|
|
|
|
// DeleteOidcDynamicClientExecute executes the request
|
|
DeleteOidcDynamicClientExecute(r OidcAPIDeleteOidcDynamicClientRequest) (*http.Response, error)
|
|
|
|
/*
|
|
DiscoverOidcConfiguration OpenID Connect Discovery
|
|
|
|
A mechanism for an OpenID Connect Relying Party to discover the End-User's OpenID Provider and obtain information needed to interact with it, including its OAuth 2.0 endpoint locations.
|
|
|
|
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang), and others.
|
|
For a full list of clients go here: https://openid.net/developers/certified/
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIDiscoverOidcConfigurationRequest
|
|
*/
|
|
DiscoverOidcConfiguration(ctx context.Context) OidcAPIDiscoverOidcConfigurationRequest
|
|
|
|
// DiscoverOidcConfigurationExecute executes the request
|
|
// @return OidcConfiguration
|
|
DiscoverOidcConfigurationExecute(r OidcAPIDiscoverOidcConfigurationRequest) (*OidcConfiguration, *http.Response, error)
|
|
|
|
/*
|
|
GetOidcDynamicClient Get OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`getOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
@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 OidcAPIGetOidcDynamicClientRequest
|
|
*/
|
|
GetOidcDynamicClient(ctx context.Context, id string) OidcAPIGetOidcDynamicClientRequest
|
|
|
|
// GetOidcDynamicClientExecute executes the request
|
|
// @return OAuth2Client
|
|
GetOidcDynamicClientExecute(r OidcAPIGetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error)
|
|
|
|
/*
|
|
GetOidcUserInfo OpenID Connect Userinfo
|
|
|
|
This endpoint returns the payload of the ID Token, including `session.id_token` values, of
|
|
the provided OAuth 2.0 Access Token's consent request.
|
|
|
|
In the case of authentication error, a WWW-Authenticate header might be set in the response
|
|
with more information about the error. See [the spec](https://datatracker.ietf.org/doc/html/rfc6750#section-3)
|
|
for more details about header format.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIGetOidcUserInfoRequest
|
|
*/
|
|
GetOidcUserInfo(ctx context.Context) OidcAPIGetOidcUserInfoRequest
|
|
|
|
// GetOidcUserInfoExecute executes the request
|
|
// @return OidcUserInfo
|
|
GetOidcUserInfoExecute(r OidcAPIGetOidcUserInfoRequest) (*OidcUserInfo, *http.Response, error)
|
|
|
|
/*
|
|
RevokeOidcSession OpenID Connect Front- and Back-channel Enabled Logout
|
|
|
|
This endpoint initiates and completes user logout at the Ory OAuth2 & OpenID provider and initiates OpenID Connect Front- / Back-channel logout:
|
|
|
|
https://openid.net/specs/openid-connect-frontchannel-1_0.html
|
|
https://openid.net/specs/openid-connect-backchannel-1_0.html
|
|
|
|
Back-channel logout is performed asynchronously and does not affect logout flow.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIRevokeOidcSessionRequest
|
|
*/
|
|
RevokeOidcSession(ctx context.Context) OidcAPIRevokeOidcSessionRequest
|
|
|
|
// RevokeOidcSessionExecute executes the request
|
|
RevokeOidcSessionExecute(r OidcAPIRevokeOidcSessionRequest) (*http.Response, error)
|
|
|
|
/*
|
|
SetOidcDynamicClient Set OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`setOAuth2Client`) but is capable of facing the
|
|
public internet directly to be used by third parties. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol.
|
|
|
|
This feature is disabled per default. It can be enabled by a system administrator.
|
|
|
|
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.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
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 OidcAPISetOidcDynamicClientRequest
|
|
*/
|
|
SetOidcDynamicClient(ctx context.Context, id string) OidcAPISetOidcDynamicClientRequest
|
|
|
|
// SetOidcDynamicClientExecute executes the request
|
|
// @return OAuth2Client
|
|
SetOidcDynamicClientExecute(r OidcAPISetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error)
|
|
}
|
|
|
|
// OidcAPIService OidcAPI service
|
|
type OidcAPIService service
|
|
|
|
type OidcAPICreateOidcDynamicClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
oAuth2Client *OAuth2Client
|
|
}
|
|
|
|
// Dynamic Client Registration Request Body
|
|
func (r OidcAPICreateOidcDynamicClientRequest) OAuth2Client(oAuth2Client OAuth2Client) OidcAPICreateOidcDynamicClientRequest {
|
|
r.oAuth2Client = &oAuth2Client
|
|
return r
|
|
}
|
|
|
|
func (r OidcAPICreateOidcDynamicClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.CreateOidcDynamicClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
CreateOidcDynamicClient Register OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`createOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint
|
|
is disabled by default. It can be enabled by an administrator.
|
|
|
|
Please note that using this endpoint you are not able to choose the `client_secret` nor the `client_id` as those
|
|
values will be server generated when specifying `token_endpoint_auth_method` as `client_secret_basic` or
|
|
`client_secret_post`.
|
|
|
|
The `client_secret` will be returned in the response and you will not be able to retrieve it later on.
|
|
Write the secret down and keep it somewhere safe.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPICreateOidcDynamicClientRequest
|
|
*/
|
|
func (a *OidcAPIService) CreateOidcDynamicClient(ctx context.Context) OidcAPICreateOidcDynamicClientRequest {
|
|
return OidcAPICreateOidcDynamicClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OidcAPIService) CreateOidcDynamicClientExecute(r OidcAPICreateOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.CreateOidcDynamicClient")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/register"
|
|
|
|
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 OidcAPICreateVerifiableCredentialRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
createVerifiableCredentialRequestBody *CreateVerifiableCredentialRequestBody
|
|
}
|
|
|
|
func (r OidcAPICreateVerifiableCredentialRequest) CreateVerifiableCredentialRequestBody(createVerifiableCredentialRequestBody CreateVerifiableCredentialRequestBody) OidcAPICreateVerifiableCredentialRequest {
|
|
r.createVerifiableCredentialRequestBody = &createVerifiableCredentialRequestBody
|
|
return r
|
|
}
|
|
|
|
func (r OidcAPICreateVerifiableCredentialRequest) Execute() (*VerifiableCredentialResponse, *http.Response, error) {
|
|
return r.ApiService.CreateVerifiableCredentialExecute(r)
|
|
}
|
|
|
|
/*
|
|
CreateVerifiableCredential Issues a Verifiable Credential
|
|
|
|
This endpoint creates a verifiable credential that attests that the user
|
|
authenticated with the provided access token owns a certain public/private key
|
|
pair.
|
|
|
|
More information can be found at
|
|
https://openid.net/specs/openid-connect-userinfo-vc-1_0.html.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPICreateVerifiableCredentialRequest
|
|
*/
|
|
func (a *OidcAPIService) CreateVerifiableCredential(ctx context.Context) OidcAPICreateVerifiableCredentialRequest {
|
|
return OidcAPICreateVerifiableCredentialRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return VerifiableCredentialResponse
|
|
func (a *OidcAPIService) CreateVerifiableCredentialExecute(r OidcAPICreateVerifiableCredentialRequest) (*VerifiableCredentialResponse, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *VerifiableCredentialResponse
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.CreateVerifiableCredential")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/credentials"
|
|
|
|
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.createVerifiableCredentialRequestBody
|
|
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 VerifiableCredentialPrimingResponse
|
|
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 OidcAPIDeleteOidcDynamicClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
id string
|
|
}
|
|
|
|
func (r OidcAPIDeleteOidcDynamicClientRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.DeleteOidcDynamicClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
DeleteOidcDynamicClient Delete OAuth 2.0 Client using the OpenID Dynamic Client Registration Management Protocol
|
|
|
|
This endpoint behaves like the administrative counterpart (`deleteOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol. This feature needs to be enabled in the configuration. This endpoint
|
|
is disabled by default. It can be enabled by an administrator.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
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 OidcAPIDeleteOidcDynamicClientRequest
|
|
*/
|
|
func (a *OidcAPIService) DeleteOidcDynamicClient(ctx context.Context, id string) OidcAPIDeleteOidcDynamicClientRequest {
|
|
return OidcAPIDeleteOidcDynamicClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OidcAPIService) DeleteOidcDynamicClientExecute(r OidcAPIDeleteOidcDynamicClientRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodDelete
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.DeleteOidcDynamicClient")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/register/{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 OidcAPIDiscoverOidcConfigurationRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
}
|
|
|
|
func (r OidcAPIDiscoverOidcConfigurationRequest) Execute() (*OidcConfiguration, *http.Response, error) {
|
|
return r.ApiService.DiscoverOidcConfigurationExecute(r)
|
|
}
|
|
|
|
/*
|
|
DiscoverOidcConfiguration OpenID Connect Discovery
|
|
|
|
A mechanism for an OpenID Connect Relying Party to discover the End-User's OpenID Provider and obtain information needed to interact with it, including its OAuth 2.0 endpoint locations.
|
|
|
|
Popular libraries for OpenID Connect clients include oidc-client-js (JavaScript), go-oidc (Golang), and others.
|
|
For a full list of clients go here: https://openid.net/developers/certified/
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIDiscoverOidcConfigurationRequest
|
|
*/
|
|
func (a *OidcAPIService) DiscoverOidcConfiguration(ctx context.Context) OidcAPIDiscoverOidcConfigurationRequest {
|
|
return OidcAPIDiscoverOidcConfigurationRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OidcConfiguration
|
|
func (a *OidcAPIService) DiscoverOidcConfigurationExecute(r OidcAPIDiscoverOidcConfigurationRequest) (*OidcConfiguration, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OidcConfiguration
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.DiscoverOidcConfiguration")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/.well-known/openid-configuration"
|
|
|
|
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 OidcAPIGetOidcDynamicClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
id string
|
|
}
|
|
|
|
func (r OidcAPIGetOidcDynamicClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.GetOidcDynamicClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOidcDynamicClient Get OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`getOAuth2Client`) but is capable of facing the
|
|
public internet directly and can be used in self-service. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
@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 OidcAPIGetOidcDynamicClientRequest
|
|
*/
|
|
func (a *OidcAPIService) GetOidcDynamicClient(ctx context.Context, id string) OidcAPIGetOidcDynamicClientRequest {
|
|
return OidcAPIGetOidcDynamicClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OidcAPIService) GetOidcDynamicClientExecute(r OidcAPIGetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.GetOidcDynamicClient")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/register/{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 OidcAPIGetOidcUserInfoRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
}
|
|
|
|
func (r OidcAPIGetOidcUserInfoRequest) Execute() (*OidcUserInfo, *http.Response, error) {
|
|
return r.ApiService.GetOidcUserInfoExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOidcUserInfo OpenID Connect Userinfo
|
|
|
|
This endpoint returns the payload of the ID Token, including `session.id_token` values, of
|
|
the provided OAuth 2.0 Access Token's consent request.
|
|
|
|
In the case of authentication error, a WWW-Authenticate header might be set in the response
|
|
with more information about the error. See [the spec](https://datatracker.ietf.org/doc/html/rfc6750#section-3)
|
|
for more details about header format.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIGetOidcUserInfoRequest
|
|
*/
|
|
func (a *OidcAPIService) GetOidcUserInfo(ctx context.Context) OidcAPIGetOidcUserInfoRequest {
|
|
return OidcAPIGetOidcUserInfoRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OidcUserInfo
|
|
func (a *OidcAPIService) GetOidcUserInfoExecute(r OidcAPIGetOidcUserInfoRequest) (*OidcUserInfo, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OidcUserInfo
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.GetOidcUserInfo")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/userinfo"
|
|
|
|
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 OidcAPIRevokeOidcSessionRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
}
|
|
|
|
func (r OidcAPIRevokeOidcSessionRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RevokeOidcSessionExecute(r)
|
|
}
|
|
|
|
/*
|
|
RevokeOidcSession OpenID Connect Front- and Back-channel Enabled Logout
|
|
|
|
This endpoint initiates and completes user logout at the Ory OAuth2 & OpenID provider and initiates OpenID Connect Front- / Back-channel logout:
|
|
|
|
https://openid.net/specs/openid-connect-frontchannel-1_0.html
|
|
https://openid.net/specs/openid-connect-backchannel-1_0.html
|
|
|
|
Back-channel logout is performed asynchronously and does not affect logout flow.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return OidcAPIRevokeOidcSessionRequest
|
|
*/
|
|
func (a *OidcAPIService) RevokeOidcSession(ctx context.Context) OidcAPIRevokeOidcSessionRequest {
|
|
return OidcAPIRevokeOidcSessionRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *OidcAPIService) RevokeOidcSessionExecute(r OidcAPIRevokeOidcSessionRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.RevokeOidcSession")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/sessions/logout"
|
|
|
|
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{}
|
|
|
|
// 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,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type OidcAPISetOidcDynamicClientRequest struct {
|
|
ctx context.Context
|
|
ApiService OidcAPI
|
|
id string
|
|
oAuth2Client *OAuth2Client
|
|
}
|
|
|
|
// OAuth 2.0 Client Request Body
|
|
func (r OidcAPISetOidcDynamicClientRequest) OAuth2Client(oAuth2Client OAuth2Client) OidcAPISetOidcDynamicClientRequest {
|
|
r.oAuth2Client = &oAuth2Client
|
|
return r
|
|
}
|
|
|
|
func (r OidcAPISetOidcDynamicClientRequest) Execute() (*OAuth2Client, *http.Response, error) {
|
|
return r.ApiService.SetOidcDynamicClientExecute(r)
|
|
}
|
|
|
|
/*
|
|
SetOidcDynamicClient Set OAuth2 Client using OpenID Dynamic Client Registration
|
|
|
|
This endpoint behaves like the administrative counterpart (`setOAuth2Client`) but is capable of facing the
|
|
public internet directly to be used by third parties. It implements the OpenID Connect
|
|
Dynamic Client Registration Protocol.
|
|
|
|
This feature is disabled per default. It can be enabled by a system administrator.
|
|
|
|
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.
|
|
|
|
To use this endpoint, you will need to present the client's authentication credentials. If the OAuth2 Client
|
|
uses the Token Endpoint Authentication Method `client_secret_post`, you need to present the client secret in the URL query.
|
|
If it uses `client_secret_basic`, present the Client ID and the Client Secret in the Authorization header.
|
|
|
|
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 OidcAPISetOidcDynamicClientRequest
|
|
*/
|
|
func (a *OidcAPIService) SetOidcDynamicClient(ctx context.Context, id string) OidcAPISetOidcDynamicClientRequest {
|
|
return OidcAPISetOidcDynamicClientRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
id: id,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return OAuth2Client
|
|
func (a *OidcAPIService) SetOidcDynamicClientExecute(r OidcAPISetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPut
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *OAuth2Client
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OidcAPIService.SetOidcDynamicClient")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/oauth2/register/{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 == 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
|
|
}
|