#[non_exhaustive]
pub struct Config { pub client_id: Option<String>, pub client_secret: Option<String>, pub realm: Option<String>, pub app_name: Option<String>, pub scope_separator: Option<String>, pub scopes: Option<Vec<String>>, pub additional_query_string_params: Option<HashMap<String, String>>, pub use_basic_authentication_with_access_code_grant: Option<bool>, pub use_pkce_with_authorization_code_grant: Option<bool>, }
Expand description

Object used to alter Swagger UI oauth settings.

Examples

let config = oauth::Config::new()
    .client_id("client-id")
    .use_pkce_with_authorization_code_grant(true);

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§client_id: Option<String>

oauth client_id the Swagger UI is using for auth flow.

§client_secret: Option<String>

oauth client_secret the Swagger UI is using for auth flow.

§realm: Option<String>

oauth realm the Swagger UI is using for auth flow. realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.

§app_name: Option<String>

oauth app_name the Swagger UI is using for auth flow. application name, displayed in authorization popup.

§scope_separator: Option<String>

oauth scope_separator the Swagger UI is using for auth flow. scope separator for passing scopes, encoded before calling, default value is a space (encoded value %20).

§scopes: Option<Vec<String>>

oauth scopes the Swagger UI is using for auth flow. Vec<String> of initially selected oauth scopes, default is empty.

§additional_query_string_params: Option<HashMap<String, String>>

oauth additional_query_string_params the Swagger UI is using for auth flow. HashMap<String, String> of additional query parameters added to authorizationUrl and tokenUrl

§use_basic_authentication_with_access_code_grant: Option<bool>

oauth use_basic_authentication_with_access_code_grant the Swagger UI is using for auth flow. Only activated for the accessCode flow. During the authorization_code request to the tokenUrl, pass the Client Password using the HTTP Basic Authentication scheme (Authorization header with Basic base64encode(client_id + client_secret)). The default is false

§use_pkce_with_authorization_code_grant: Option<bool>

oauth use_pkce_with_authorization_code_grant the Swagger UI is using for auth flow. Only applies to authorizatonCode flows. Proof Key for Code Exchange brings enhanced security for OAuth public clients. The default is false

Implementations§

Create a new Config for oauth auth flow.

Examples
let config = oauth::Config::new();

Add client_id into Config.

Method takes one argument which exposes the client_id to the user.

Examples
let config = oauth::Config::new()
    .client_id("client-id");

Add client_secret into Config.

Method takes one argument which exposes the client_secret to the user. 🚨 Never use this parameter in your production environment. It exposes crucial security information. This feature is intended for dev/test environments only. 🚨

Examples
let config = oauth::Config::new()
    .client_secret("client-secret");

Add realm into Config.

Method takes one argument which exposes the realm to the user. realm query parameter (for oauth1) added to authorizationUrl and tokenUrl.

Examples
let config = oauth::Config::new()
    .realm("realm");

Add app_name into Config.

Method takes one argument which exposes the app_name to the user. application name, displayed in authorization popup.

Examples
let config = oauth::Config::new()
    .app_name("app-name");

Add scope_separator into Config.

Method takes one argument which exposes the scope_separator to the user. scope separator for passing scopes, encoded before calling, default value is a space (encoded value %20).

Examples
let config = oauth::Config::new()
    .scope_separator(",");

Add scopes into Config.

Method takes one argument which exposes the scopes to the user. Vec<String> of initially selected oauth scopes, default is empty.

Examples
let config = oauth::Config::new()
    .scopes(vec![String::from("openid")]);

Add additional_query_string_params into Config.

Method takes one argument which exposes the additional_query_string_params to the user. HashMap<String, String> of additional query parameters added to authorizationUrl and tokenUrl

Examples
let config = oauth::Config::new()
    .additional_query_string_params(HashMap::from([(String::from("a"), String::from("1"))]));

Add use_basic_authentication_with_access_code_grant into Config.

Method takes one argument which exposes the use_basic_authentication_with_access_code_grant to the user. Only activated for the accessCode flow. During the authorization_code request to the tokenUrl, pass the Client Password using the HTTP Basic Authentication scheme (Authorization header with Basic base64encode(client_id + client_secret)). The default is false

Examples
let config = oauth::Config::new()
    .use_basic_authentication_with_access_code_grant(true);

Add use_pkce_with_authorization_code_grant into Config.

Method takes one argument which exposes the use_pkce_with_authorization_code_grant to the user. Only applies to authorizatonCode flows. Proof Key for Code Exchange brings enhanced security for OAuth public clients. The default is false

Examples
let config = oauth::Config::new()
    .use_pkce_with_authorization_code_grant(true);

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts self into a collection.
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more