/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Aws { namespace Http { class HttpClient; class HttpClientFactory; } // namespace Http namespace Utils { template< typename R, typename E> class Outcome; namespace Threading { class Executor; } // namespace Threading } // namespace Utils namespace Auth { class AWSCredentials; class AWSCredentialsProvider; } // namespace Auth namespace Client { class RetryStrategy; } // namespace Client namespace SSOOIDC { namespace Model { class CreateTokenRequest; class RegisterClientRequest; class StartDeviceAuthorizationRequest; typedef Aws::Utils::Outcome CreateTokenOutcome; typedef Aws::Utils::Outcome RegisterClientOutcome; typedef Aws::Utils::Outcome StartDeviceAuthorizationOutcome; typedef std::future CreateTokenOutcomeCallable; typedef std::future RegisterClientOutcomeCallable; typedef std::future StartDeviceAuthorizationOutcomeCallable; } // namespace Model class SSOOIDCClient; typedef std::function&) > CreateTokenResponseReceivedHandler; typedef std::function&) > RegisterClientResponseReceivedHandler; typedef std::function&) > StartDeviceAuthorizationResponseReceivedHandler; /** *

AWS Single Sign-On (SSO) OpenID Connect (OIDC) is a web service that enables * a client (such as AWS CLI or a native application) to register with AWS SSO. The * service also enables the client to fetch the user’s access token upon successful * authentication and authorization with AWS SSO. This service conforms with the * OAuth 2.0 based implementation of the device authorization grant standard (https://tools.ietf.org/html/rfc8628).

*

For general information about AWS SSO, see What * is AWS Single Sign-On? in the AWS SSO User Guide.

This API * reference guide describes the AWS SSO OIDC operations that you can call * programatically and includes detailed information on data types and errors.

*

AWS provides SDKs that consist of libraries and sample code for * various programming languages and platforms such as Java, Ruby, .Net, iOS, and * Android. The SDKs provide a convenient way to create programmatic access to AWS * SSO and other AWS services. For more information about the AWS SDKs, including * how to download and install them, see Tools for Amazon Web Services.

* */ class AWS_SSOOIDC_API SSOOIDCClient : public Aws::Client::AWSJsonClient { public: typedef Aws::Client::AWSJsonClient BASECLASS; /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SSOOIDCClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SSOOIDCClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ SSOOIDCClient(const std::shared_ptr& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); virtual ~SSOOIDCClient(); /** *

Creates and returns an access token for the authorized client. The access * token issued will be used to fetch short-term credentials for the assigned roles * in the AWS account.

See Also:

AWS * API Reference

*/ virtual Model::CreateTokenOutcome CreateToken(const Model::CreateTokenRequest& request) const; /** *

Creates and returns an access token for the authorized client. The access * token issued will be used to fetch short-term credentials for the assigned roles * in the AWS account.

See Also:

AWS * API Reference

* * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::CreateTokenOutcomeCallable CreateTokenCallable(const Model::CreateTokenRequest& request) const; /** *

Creates and returns an access token for the authorized client. The access * token issued will be used to fetch short-term credentials for the assigned roles * in the AWS account.

See Also:

AWS * API Reference

* * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void CreateTokenAsync(const Model::CreateTokenRequest& request, const CreateTokenResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const; /** *

Registers a client with AWS SSO. This allows clients to initiate device * authorization. The output should be persisted for reuse through many * authentication requests.

See Also:

AWS * API Reference

*/ virtual Model::RegisterClientOutcome RegisterClient(const Model::RegisterClientRequest& request) const; /** *

Registers a client with AWS SSO. This allows clients to initiate device * authorization. The output should be persisted for reuse through many * authentication requests.

See Also:

AWS * API Reference

* * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::RegisterClientOutcomeCallable RegisterClientCallable(const Model::RegisterClientRequest& request) const; /** *

Registers a client with AWS SSO. This allows clients to initiate device * authorization. The output should be persisted for reuse through many * authentication requests.

See Also:

AWS * API Reference

* * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void RegisterClientAsync(const Model::RegisterClientRequest& request, const RegisterClientResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const; /** *

Initiates device authorization by requesting a pair of verification codes * from the authorization service.

See Also:

AWS * API Reference

*/ virtual Model::StartDeviceAuthorizationOutcome StartDeviceAuthorization(const Model::StartDeviceAuthorizationRequest& request) const; /** *

Initiates device authorization by requesting a pair of verification codes * from the authorization service.

See Also:

AWS * API Reference

* * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::StartDeviceAuthorizationOutcomeCallable StartDeviceAuthorizationCallable(const Model::StartDeviceAuthorizationRequest& request) const; /** *

Initiates device authorization by requesting a pair of verification codes * from the authorization service.

See Also:

AWS * API Reference

* * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void StartDeviceAuthorizationAsync(const Model::StartDeviceAuthorizationRequest& request, const StartDeviceAuthorizationResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const; void OverrideEndpoint(const Aws::String& endpoint); private: void init(const Aws::Client::ClientConfiguration& clientConfiguration); void CreateTokenAsyncHelper(const Model::CreateTokenRequest& request, const CreateTokenResponseReceivedHandler& handler, const std::shared_ptr& context) const; void RegisterClientAsyncHelper(const Model::RegisterClientRequest& request, const RegisterClientResponseReceivedHandler& handler, const std::shared_ptr& context) const; void StartDeviceAuthorizationAsyncHelper(const Model::StartDeviceAuthorizationRequest& request, const StartDeviceAuthorizationResponseReceivedHandler& handler, const std::shared_ptr& context) const; Aws::String m_uri; Aws::String m_configScheme; std::shared_ptr m_executor; }; } // namespace SSOOIDC } // namespace Aws