Skip to main content

ory_client/models/
o_auth2_client.rs

1/*
2 * Ory APIs
3 *
4 * # Introduction Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.  ## SDKs This document describes the APIs available in the Ory Network. The APIs are available as SDKs for the following languages:  | Language       | Download SDK                                                     | Documentation                                                                        | | -------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | Dart           | [pub.dev](https://pub.dev/packages/ory_client)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/dart/README.md)       | | .NET           | [nuget.org](https://www.nuget.org/packages/Ory.Client/)          | [README](https://github.com/ory/sdk/blob/master/clients/client/dotnet/README.md)     | | Elixir         | [hex.pm](https://hex.pm/packages/ory_client)                     | [README](https://github.com/ory/sdk/blob/master/clients/client/elixir/README.md)     | | Go             | [github.com](https://github.com/ory/client-go)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/go/README.md)         | | Java           | [maven.org](https://search.maven.org/artifact/sh.ory/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/java/README.md)       | | JavaScript     | [npmjs.com](https://www.npmjs.com/package/@ory/client)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript/README.md) | | JavaScript (With fetch) | [npmjs.com](https://www.npmjs.com/package/@ory/client-fetch)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript-fetch/README.md) |  | PHP            | [packagist.org](https://packagist.org/packages/ory/client)       | [README](https://github.com/ory/sdk/blob/master/clients/client/php/README.md)        | | Python         | [pypi.org](https://pypi.org/project/ory-client/)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/python/README.md)     | | Ruby           | [rubygems.org](https://rubygems.org/gems/ory-client)             | [README](https://github.com/ory/sdk/blob/master/clients/client/ruby/README.md)       | | Rust           | [crates.io](https://crates.io/crates/ory-client)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/rust/README.md)       | 
5 *
6 * The version of the OpenAPI document: v1.22.39
7 * Contact: support@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// OAuth2Client : 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.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OAuth2Client {
17    /// OAuth 2.0 Access Token Strategy  AccessTokenStrategy is the strategy used to generate access tokens. Valid options are `jwt` and `opaque`. `jwt` is a bad idea, see https://www.ory.com/docs/oauth2-oidc/jwt-access-token Setting the strategy here overrides the global setting in `strategies.access_token`.
18    #[serde(rename = "access_token_strategy", skip_serializing_if = "Option::is_none")]
19    pub access_token_strategy: Option<String>,
20    /// OAuth 2.0 Client Allowed CORS Origins  One or more URLs (scheme://host[:port]) which are allowed to make CORS requests to the /oauth/token endpoint. If this array is empty, the server's CORS origin configuration (`CORS_ALLOWED_ORIGINS`) will be used instead. If this array is set, the allowed origins are appended to the server's CORS origin configuration. Be aware that environment variable `CORS_ENABLED` MUST be set to `true` for this to work.
21    #[serde(rename = "allowed_cors_origins", skip_serializing_if = "Option::is_none")]
22    pub allowed_cors_origins: Option<Vec<String>>,
23    /// OAuth 2.0 Client Audience  An allow-list defining the audiences this client is allowed to request tokens for. An audience limits the applicability of an OAuth 2.0 Access Token to, for example, certain API endpoints. The value is a list of URLs. URLs MUST NOT contain whitespaces.
24    #[serde(rename = "audience", skip_serializing_if = "Option::is_none")]
25    pub audience: Option<Vec<String>>,
26    #[serde(rename = "authorization_code_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub authorization_code_grant_access_token_lifespan: Option<Option<String>>,
28    #[serde(rename = "authorization_code_grant_id_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
29    pub authorization_code_grant_id_token_lifespan: Option<Option<String>>,
30    #[serde(rename = "authorization_code_grant_refresh_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub authorization_code_grant_refresh_token_lifespan: Option<Option<String>>,
32    /// OpenID Connect Back-Channel Logout Session Required  Boolean value specifying whether the RP requires that a sid (session ID) Claim be included in the Logout Token to identify the RP session with the OP when the backchannel_logout_uri is used. If omitted, the default value is false.
33    #[serde(rename = "backchannel_logout_session_required", skip_serializing_if = "Option::is_none")]
34    pub backchannel_logout_session_required: Option<bool>,
35    /// OpenID Connect Back-Channel Logout URI  RP URL that will cause the RP to log itself out when sent a Logout Token by the OP.
36    #[serde(rename = "backchannel_logout_uri", skip_serializing_if = "Option::is_none")]
37    pub backchannel_logout_uri: Option<String>,
38    #[serde(rename = "client_credentials_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub client_credentials_grant_access_token_lifespan: Option<Option<String>>,
40    /// OAuth 2.0 Client ID  The ID is immutable. If no ID is provided, a UUID4 will be generated.
41    #[serde(rename = "client_id", skip_serializing_if = "Option::is_none")]
42    pub client_id: Option<String>,
43    /// OAuth 2.0 Client Name  The human-readable name of the client to be presented to the end-user during authorization.
44    #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")]
45    pub client_name: Option<String>,
46    /// OAuth 2.0 Client Secret  The secret will be included in the create request as cleartext, and then never again. The secret is kept in hashed format and is not recoverable once lost.
47    #[serde(rename = "client_secret", skip_serializing_if = "Option::is_none")]
48    pub client_secret: Option<String>,
49    /// OAuth 2.0 Client Secret Expires At  The field is currently not supported and its value is always 0.
50    #[serde(rename = "client_secret_expires_at", skip_serializing_if = "Option::is_none")]
51    pub client_secret_expires_at: Option<i64>,
52    /// OAuth 2.0 Client URI  ClientURI is a URL string of a web page providing information about the client. If present, the server SHOULD display this URL to the end-user in a clickable fashion.
53    #[serde(rename = "client_uri", skip_serializing_if = "Option::is_none")]
54    pub client_uri: Option<String>,
55    /// OAuth 2.0 Client Contact  An array of strings representing ways to contact people responsible for this client, typically email addresses.
56    #[serde(rename = "contacts", skip_serializing_if = "Option::is_none")]
57    pub contacts: Option<Vec<String>>,
58    /// OAuth 2.0 Client Creation Date  CreatedAt returns the timestamp of the client's creation.
59    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
60    pub created_at: Option<String>,
61    #[serde(rename = "device_authorization_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
62    pub device_authorization_grant_access_token_lifespan: Option<Option<String>>,
63    #[serde(rename = "device_authorization_grant_id_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
64    pub device_authorization_grant_id_token_lifespan: Option<Option<String>>,
65    #[serde(rename = "device_authorization_grant_refresh_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
66    pub device_authorization_grant_refresh_token_lifespan: Option<Option<String>>,
67    /// OpenID Connect Front-Channel Logout Session Required  Boolean value specifying whether the RP requires that iss (issuer) and sid (session ID) query parameters be included to identify the RP session with the OP when the frontchannel_logout_uri is used. If omitted, the default value is false.
68    #[serde(rename = "frontchannel_logout_session_required", skip_serializing_if = "Option::is_none")]
69    pub frontchannel_logout_session_required: Option<bool>,
70    /// OpenID Connect Front-Channel Logout URI  RP URL that will cause the RP to log itself out when rendered in an iframe by the OP. An iss (issuer) query parameter and a sid (session ID) query parameter MAY be included by the OP to enable the RP to validate the request and to determine which of the potentially multiple sessions is to be logged out; if either is included, both MUST be.
71    #[serde(rename = "frontchannel_logout_uri", skip_serializing_if = "Option::is_none")]
72    pub frontchannel_logout_uri: Option<String>,
73    /// OAuth 2.0 Client Grant Types  An array of OAuth 2.0 grant types the client is allowed to use. Can be one of:  Client Credentials Grant: `client_credentials` Authorization Code Grant: `authorization_code` OpenID Connect Implicit Grant (deprecated!): `implicit` Refresh Token Grant: `refresh_token` OAuth 2.0 Token Exchange: `urn:ietf:params:oauth:grant-type:jwt-bearer` OAuth 2.0 Device Code Grant: `urn:ietf:params:oauth:grant-type:device_code`
74    #[serde(rename = "grant_types", skip_serializing_if = "Option::is_none")]
75    pub grant_types: Option<Vec<String>>,
76    #[serde(rename = "implicit_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
77    pub implicit_grant_access_token_lifespan: Option<Option<String>>,
78    #[serde(rename = "implicit_grant_id_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
79    pub implicit_grant_id_token_lifespan: Option<Option<String>>,
80    #[serde(rename = "jwks", skip_serializing_if = "Option::is_none")]
81    pub jwks: Option<Box<models::JsonWebKeySet>>,
82    /// OAuth 2.0 Client JSON Web Key Set URL  URL for the Client's JSON Web Key Set [JWK] document. If the Client signs requests to the Server, it contains the signing key(s) the Server uses to validate signatures from the Client. The JWK Set MAY also contain the Client's encryption keys(s), which are used by the Server to encrypt responses to the Client. When both signing and encryption keys are made available, a use (Key Use) parameter value is REQUIRED for all keys in the referenced JWK Set to indicate each key's intended usage. Although some algorithms allow the same key to be used for both signatures and encryption, doing so is NOT RECOMMENDED, as it is less secure. The JWK x5c parameter MAY be used to provide X.509 representations of keys provided. When used, the bare key values MUST still be present and MUST match those in the certificate.
83    #[serde(rename = "jwks_uri", skip_serializing_if = "Option::is_none")]
84    pub jwks_uri: Option<String>,
85    #[serde(rename = "jwt_bearer_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
86    pub jwt_bearer_grant_access_token_lifespan: Option<Option<String>>,
87    /// OAuth 2.0 Client Logo URI  A URL string referencing the client's logo.
88    #[serde(rename = "logo_uri", skip_serializing_if = "Option::is_none")]
89    pub logo_uri: Option<String>,
90    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
91    pub metadata: Option<serde_json::Value>,
92    /// OAuth 2.0 Client Owner  Owner is a string identifying the owner of the OAuth 2.0 Client.
93    #[serde(rename = "owner", skip_serializing_if = "Option::is_none")]
94    pub owner: Option<String>,
95    /// OAuth 2.0 Client Policy URI  PolicyURI is a URL string that points to a human-readable privacy policy document that describes how the deployment organization collects, uses, retains, and discloses personal data.
96    #[serde(rename = "policy_uri", skip_serializing_if = "Option::is_none")]
97    pub policy_uri: Option<String>,
98    /// Allowed Post-Redirect Logout URIs  Array of URLs supplied by the RP to which it MAY request that the End-User's User Agent be redirected using the post_logout_redirect_uri parameter after a logout has been performed.
99    #[serde(rename = "post_logout_redirect_uris", skip_serializing_if = "Option::is_none")]
100    pub post_logout_redirect_uris: Option<Vec<String>>,
101    /// OAuth 2.0 Client Redirect URIs  RedirectURIs is an array of allowed redirect urls for the client.
102    #[serde(rename = "redirect_uris", skip_serializing_if = "Option::is_none")]
103    pub redirect_uris: Option<Vec<String>>,
104    #[serde(rename = "refresh_token_grant_access_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
105    pub refresh_token_grant_access_token_lifespan: Option<Option<String>>,
106    #[serde(rename = "refresh_token_grant_id_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
107    pub refresh_token_grant_id_token_lifespan: Option<Option<String>>,
108    #[serde(rename = "refresh_token_grant_refresh_token_lifespan", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
109    pub refresh_token_grant_refresh_token_lifespan: Option<Option<String>>,
110    /// OpenID Connect Dynamic Client Registration Access Token  RegistrationAccessToken can be used to update, get, or delete the OAuth2 Client. It is sent when creating a client using Dynamic Client Registration.
111    #[serde(rename = "registration_access_token", skip_serializing_if = "Option::is_none")]
112    pub registration_access_token: Option<String>,
113    /// OpenID Connect Dynamic Client Registration URL  RegistrationClientURI is the URL used to update, get, or delete the OAuth2 Client.
114    #[serde(rename = "registration_client_uri", skip_serializing_if = "Option::is_none")]
115    pub registration_client_uri: Option<String>,
116    /// OpenID Connect Request Object Signing Algorithm  JWS [JWS] alg algorithm [JWA] that MUST be used for signing Request Objects sent to the OP. All Request Objects from this Client MUST be rejected, if not signed with this algorithm.
117    #[serde(rename = "request_object_signing_alg", skip_serializing_if = "Option::is_none")]
118    pub request_object_signing_alg: Option<String>,
119    /// OpenID Connect Request URIs  Array of request_uri values that are pre-registered by the RP for use at the OP. Servers MAY cache the contents of the files referenced by these URIs and not retrieve them at the time they are used in a request. OPs can require that request_uri values used be pre-registered with the require_request_uri_registration discovery parameter.
120    #[serde(rename = "request_uris", skip_serializing_if = "Option::is_none")]
121    pub request_uris: Option<Vec<String>>,
122    /// OAuth 2.0 Client Response Types  An array of the OAuth 2.0 response type strings that the client can use at the authorization endpoint. Can be one of:  Needed for OpenID Connect Implicit Grant: Returns ID Token to redirect URI: `id_token` Returns Access token redirect URI: `token` Needed for Authorization Code Grant: `code`
123    #[serde(rename = "response_types", skip_serializing_if = "Option::is_none")]
124    pub response_types: Option<Vec<String>>,
125    /// OAuth 2.0 Client Scope  Scope is a string containing a space-separated list of scope values (as described in Section 3.3 of OAuth 2.0 [RFC6749]) that the client can use when requesting access tokens.
126    #[serde(rename = "scope", skip_serializing_if = "Option::is_none")]
127    pub scope: Option<String>,
128    /// OpenID Connect Sector Identifier URI  URL using the https scheme to be used in calculating Pseudonymous Identifiers by the OP. The URL references a file with a single JSON array of redirect_uri values.
129    #[serde(rename = "sector_identifier_uri", skip_serializing_if = "Option::is_none")]
130    pub sector_identifier_uri: Option<String>,
131    /// SkipConsent skips the consent screen for this client. This field can only be set from the admin API.
132    #[serde(rename = "skip_consent", skip_serializing_if = "Option::is_none")]
133    pub skip_consent: Option<bool>,
134    /// SkipLogoutConsent skips the logout consent screen for this client. This field can only be set from the admin API.
135    #[serde(rename = "skip_logout_consent", skip_serializing_if = "Option::is_none")]
136    pub skip_logout_consent: Option<bool>,
137    /// OpenID Connect Subject Type  The `subject_types_supported` Discovery parameter contains a list of the supported subject_type values for this server. Valid types include `pairwise` and `public`.
138    #[serde(rename = "subject_type", skip_serializing_if = "Option::is_none")]
139    pub subject_type: Option<String>,
140    /// OAuth 2.0 Token Endpoint Authentication Method  Requested Client Authentication method for the Token Endpoint. The options are:  `client_secret_basic`: (default) Send `client_id` and `client_secret` as `application/x-www-form-urlencoded` encoded in the HTTP Authorization header. `client_secret_post`: Send `client_id` and `client_secret` as `application/x-www-form-urlencoded` in the HTTP body. `private_key_jwt`: Use JSON Web Tokens to authenticate the client. `none`: Used for public clients (native apps, mobile apps) which can not have secrets.
141    #[serde(rename = "token_endpoint_auth_method", skip_serializing_if = "Option::is_none")]
142    pub token_endpoint_auth_method: Option<String>,
143    /// OAuth 2.0 Token Endpoint Signing Algorithm  Requested Client Authentication signing algorithm for the Token Endpoint.
144    #[serde(rename = "token_endpoint_auth_signing_alg", skip_serializing_if = "Option::is_none")]
145    pub token_endpoint_auth_signing_alg: Option<String>,
146    /// OAuth 2.0 Client Terms of Service URI  A URL string pointing to a human-readable terms of service document for the client that describes a contractual relationship between the end-user and the client that the end-user accepts when authorizing the client.
147    #[serde(rename = "tos_uri", skip_serializing_if = "Option::is_none")]
148    pub tos_uri: Option<String>,
149    /// OAuth 2.0 Client Last Update Date  UpdatedAt returns the timestamp of the last update.
150    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
151    pub updated_at: Option<String>,
152    /// OpenID Connect Request Userinfo Signed Response Algorithm  JWS alg algorithm [JWA] REQUIRED for signing UserInfo Responses. If this is specified, the response will be JWT [JWT] serialized, and signed using JWS. The default, if omitted, is for the UserInfo Response to return the Claims as a UTF-8 encoded JSON object using the application/json content-type.
153    #[serde(rename = "userinfo_signed_response_alg", skip_serializing_if = "Option::is_none")]
154    pub userinfo_signed_response_alg: Option<String>,
155}
156
157impl OAuth2Client {
158    /// 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.
159    pub fn new() -> OAuth2Client {
160        OAuth2Client {
161            access_token_strategy: None,
162            allowed_cors_origins: None,
163            audience: None,
164            authorization_code_grant_access_token_lifespan: None,
165            authorization_code_grant_id_token_lifespan: None,
166            authorization_code_grant_refresh_token_lifespan: None,
167            backchannel_logout_session_required: None,
168            backchannel_logout_uri: None,
169            client_credentials_grant_access_token_lifespan: None,
170            client_id: None,
171            client_name: None,
172            client_secret: None,
173            client_secret_expires_at: None,
174            client_uri: None,
175            contacts: None,
176            created_at: None,
177            device_authorization_grant_access_token_lifespan: None,
178            device_authorization_grant_id_token_lifespan: None,
179            device_authorization_grant_refresh_token_lifespan: None,
180            frontchannel_logout_session_required: None,
181            frontchannel_logout_uri: None,
182            grant_types: None,
183            implicit_grant_access_token_lifespan: None,
184            implicit_grant_id_token_lifespan: None,
185            jwks: None,
186            jwks_uri: None,
187            jwt_bearer_grant_access_token_lifespan: None,
188            logo_uri: None,
189            metadata: None,
190            owner: None,
191            policy_uri: None,
192            post_logout_redirect_uris: None,
193            redirect_uris: None,
194            refresh_token_grant_access_token_lifespan: None,
195            refresh_token_grant_id_token_lifespan: None,
196            refresh_token_grant_refresh_token_lifespan: None,
197            registration_access_token: None,
198            registration_client_uri: None,
199            request_object_signing_alg: None,
200            request_uris: None,
201            response_types: None,
202            scope: None,
203            sector_identifier_uri: None,
204            skip_consent: None,
205            skip_logout_consent: None,
206            subject_type: None,
207            token_endpoint_auth_method: None,
208            token_endpoint_auth_signing_alg: None,
209            tos_uri: None,
210            updated_at: None,
211            userinfo_signed_response_alg: None,
212        }
213    }
214}
215