Struct aws_sdk_ssooidc::Client
source · pub struct Client { /* private fields */ }Expand description
Client for AWS SSO OIDC
Client for invoking operations on AWS SSO OIDC. Each operation on AWS SSO OIDC is a method on this
this struct. .send() MUST be invoked on the generated operations to dispatch the request to the service.
Constructing a Client
A Config is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env(), since this will resolve an SdkConfig which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env() instead, which returns a ConfigLoader that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_ssooidc::Client::new(&config);Occasionally, SDKs may have additional service-specific that can be set on the Config that
is absent from SdkConfig, or slightly different settings for a specific client may be desired.
The Config struct implements From<&SdkConfig>, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_ssooidc::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();See the aws-config docs and Config for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CreateToken operation has
a Client::create_token, function which returns a builder for that operation.
The fluent builder ultimately has a send() function that returns an async future that
returns a result, as illustrated below:
let result = client.create_token()
.client_id("example")
.send()
.await;The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize module for more
information.
Implementations§
source§impl Client
impl Client
sourcepub fn create_token(&self) -> CreateTokenFluentBuilder
pub fn create_token(&self) -> CreateTokenFluentBuilder
Constructs a fluent builder for the CreateToken operation.
- The fluent builder is configurable:
client_id(impl Into<String>)/set_client_id(Option<String>):The unique identifier string for each client. This value should come from the persisted result of the
RegisterClientAPI.client_secret(impl Into<String>)/set_client_secret(Option<String>):A secret string generated for the client. This value should come from the persisted result of the
RegisterClientAPI.grant_type(impl Into<String>)/set_grant_type(Option<String>):Supports grant types for the authorization code, refresh token, and device code request. For device code requests, specify the following value:
urn:ietf:params:oauth:grant-type:device_codeFor information about how to obtain the device code, see the
StartDeviceAuthorizationtopic.device_code(impl Into<String>)/set_device_code(Option<String>):Used only when calling this API for the device code grant type. This short-term code is used to identify this authentication attempt. This should come from an in-memory reference to the result of the
StartDeviceAuthorizationAPI.code(impl Into<String>)/set_code(Option<String>):The authorization code received from the authorization service. This parameter is required to perform an authorization grant request to get access to a token.
refresh_token(impl Into<String>)/set_refresh_token(Option<String>):Currently,
refreshTokenis not yet implemented and is not supported. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.The token used to obtain an access token in the event that the access token is invalid or expired.
scope(impl Into<String>)/set_scope(Option<Vec<String>>):The list of scopes that is defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token.
redirect_uri(impl Into<String>)/set_redirect_uri(Option<String>):The location of the application that will receive the authorization code. Users authorize the service to send the request to this location.
- On success, responds with
CreateTokenOutputwith field(s):access_token(Option<String>):An opaque token to access IAM Identity Center resources assigned to a user.
token_type(Option<String>):Used to notify the client that the returned token is an access token. The supported type is
BearerToken.expires_in(i32):Indicates the time in seconds when an access token will expire.
refresh_token(Option<String>):Currently,
refreshTokenis not yet implemented and is not supported. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.A token that, if present, can be used to refresh a previously issued access token that might have expired.
id_token(Option<String>):Currently,
idTokenis not yet implemented and is not supported. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.The identifier of the user that associated with the access token, if present.
- On failure, responds with
SdkError<CreateTokenError>
source§impl Client
impl Client
sourcepub fn register_client(&self) -> RegisterClientFluentBuilder
pub fn register_client(&self) -> RegisterClientFluentBuilder
Constructs a fluent builder for the RegisterClient operation.
- The fluent builder is configurable:
client_name(impl Into<String>)/set_client_name(Option<String>):The friendly name of the client.
client_type(impl Into<String>)/set_client_type(Option<String>):The type of client. The service supports only
publicas a client type. Anything other than public will be rejected by the service.scopes(impl Into<String>)/set_scopes(Option<Vec<String>>):The list of scopes that are defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token.
- On success, responds with
RegisterClientOutputwith field(s):client_id(Option<String>):The unique identifier string for each client. This client uses this identifier to get authenticated by the service in subsequent calls.
client_secret(Option<String>):A secret string generated for the client. The client will use this string to get authenticated by the service in subsequent calls.
client_id_issued_at(i64):Indicates the time at which the
clientIdandclientSecretwere issued.client_secret_expires_at(i64):Indicates the time at which the
clientIdandclientSecretwill become invalid.authorization_endpoint(Option<String>):The endpoint where the client can request authorization.
token_endpoint(Option<String>):The endpoint where the client can get an access token.
- On failure, responds with
SdkError<RegisterClientError>
source§impl Client
impl Client
Constructs a fluent builder for the StartDeviceAuthorization operation.
- The fluent builder is configurable:
client_id(impl Into<String>)/set_client_id(Option<String>):The unique identifier string for the client that is registered with IAM Identity Center. This value should come from the persisted result of the
RegisterClientAPI operation.client_secret(impl Into<String>)/set_client_secret(Option<String>):A secret string that is generated for the client. This value should come from the persisted result of the
RegisterClientAPI operation.start_url(impl Into<String>)/set_start_url(Option<String>):The URL for the AWS access portal. For more information, see Using the AWS access portal in the IAM Identity Center User Guide.
- On success, responds with
StartDeviceAuthorizationOutputwith field(s):device_code(Option<String>):The short-lived code that is used by the device when polling for a session token.
user_code(Option<String>):A one-time user verification code. This is needed to authorize an in-use device.
verification_uri(Option<String>):The URI of the verification page that takes the
userCodeto authorize the device.verification_uri_complete(Option<String>):An alternate URL that the client can use to automatically launch a browser. This process skips the manual step in which the user visits the verification page and enters their code.
expires_in(i32):Indicates the number of seconds in which the verification code will become invalid.
interval(i32):Indicates the number of seconds the client must wait between attempts when polling for a session.
- On failure, responds with
SdkError<StartDeviceAuthorizationError>
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
Panics
- This method will panic if the
sdk_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it.