// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Standard Library using System; // GameKit using AWS.GameKit.Runtime.Models; namespace AWS.GameKit.Runtime.Features.GameKitIdentity { /// /// Interface for the AWS GameKit Identity feature. /// public interface IIdentityProvider { /// /// Register a new player for email and password based sign in.

/// /// After calling this method, you must call ConfirmRegistration() to confirm the player's identity.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_MALFORMED_USERNAME: The provided UserName is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_MALFORMED_PASSWORD: The provided Password is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_METHOD_NOT_IMPLEMENTED: You attempted to register a guest, which is not yet supported. To fix, make sure the request's FUserRegistrationRequest::UserId field is empty.
/// - GAMEKIT_ERROR_REGISTER_USER_FAILED: The backend web request failed. Check the output logs to see what the error was. ///
/// Object containing the information about the user to register /// Delegate that is called once the function has finished executing public void Register(UserRegistration userRegistration, Action callback); /// /// Confirm registration of a new player that was registered through Register().

/// /// The confirmation code is sent to the player's email and can be re-sent by calling ResendConfirmationCode().

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_MALFORMED_USERNAME: The provided UserName is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_CONFIRM_REGISTRATION_FAILED: The backend web request failed. Check the output logs to see what the error was. ///
/// Object containing the required username and code to confirm the registration /// Delegate that is called once the function has finished executing public void ConfirmRegistration(ConfirmRegistrationRequest request, Action callback); /// /// Resend the registration confirmation code to the player's email.

/// /// This resends the confirmation code that was sent by calling Register() or ResendConfirmationCode().

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_MALFORMED_USERNAME: The provided UserName is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_RESEND_CONFIRMATION_CODE_FAILED: The backend web request failed. Check the output logs to see what the error was. ///
/// Object containing the username of the user requesting the resend /// Delegate that is called once the function has finished executing public void ResendConfirmationCode(ResendConfirmationCodeRequest request, Action callback); /// /// Send a password reset code to the player's email.

/// /// After calling this method, you must call ConfirmForgotPassword() to complete the password reset.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_MALFORMED_USERNAME: The provided UserName is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_FORGOT_PASSWORD_FAILED: The backend web request failed. Check the output logs to see what the error was. ///
/// Object containing the username of the user requesting a password reset /// Delegate that is called once the function has finished executing public void ForgotPassword(ForgotPasswordRequest request, Action callback); /// /// Set the player's new password.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_MALFORMED_USERNAME: The provided UserName is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_MALFORMED_PASSWORD: The provided Password is malformed. Check the output logs to see what the required format is.
/// - GAMEKIT_ERROR_CONFIRM_FORGOT_PASSWORD_FAILED: The backend web request failed. Check the output logs to see what the error was. ///
/// Object containing the username and required new password information /// Delegate that is called once the function has finished executing public void ConfirmForgotPassword(ConfirmForgotPasswordRequest request, Action callback); /// /// Retrieves a login/signup URL for the specified federated identity provider.

/// /// Players will be able to register and/or sign in when the URL opens in a web browser.

/// /// This method will automatically start polling for login completion with PollAndRetrieveFederatedTokens() /// after the login url has been opened. /// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_INVALID_FEDERATED_IDENTITY_PROVIDER: The specified federated identity provider is invalid or is not yet supported. ///
/// enum for the identity provider /// Delegate that is called once a login url for the federated provider is available. /// Delegate that is called once the player has finished logging in, and the token has been cached. /// How long the player has to login before polling for completion stops. /// How long the player has to login and polling for completion stops. public void FederatedLogin(FederatedIdentityProvider identityProvider, Action loginUrlRetrievedCallback, Action loginCompletionCallback = null, int loginTimeout = 90); /// /// Continually check if the player has completed signing in with the federated identity provider, then store their access tokens in the AwsGameKitSessionManager.

/// /// After calling this method, the player will be signed in and you'll be able to call the other GameKit APIs. /// This method stores the player's authorized access tokens in the AWS GameKit Session Manager, which automatically refreshes them before they expire.

/// /// To call this method, you must first call GetFederatedLoginUrl() to get a unique request ID.

/// /// This method will timeout after the specified limit, in which case the player is not logged in. /// You can call GetFederatedIdToken() to check if the login was successful.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful. ///
/// Object containing details for the request such as timeout and provider /// Delegate that is called once the function has finished executing public void PollAndRetrieveFederatedTokens(PollAndRetrieveFederatedTokensDesc pollAndRetrieveFederatedTokensDesc, Action callback); /// /// Get the player's authorized Id token for the specified federated identity provider.

/// /// The returned access token will be empty if the player is not logged in with the federated identity provider.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_INVALID_FEDERATED_IDENTITY_PROVIDER: The specified federated identity provider is invalid or is not yet supported. ///
/// enum for the identity provider /// Delegate that is called once the function has finished executing public void GetFederatedIdToken(FederatedIdentityProvider identityProvider, Action callback); /// /// Sign in the player through email and password.

/// /// After calling this method, the player will be signed in and you'll be able to call the other GameKit APIs. /// This method stores the player's authorized access tokens in the AwsGameKitSessionManager, and automatically refreshes them before they expire.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful. ///
/// Object containing login information /// Delegate that is called once the function has finished executing public void Login(UserLogin userLogin, Action callback); /// /// Sign out the currently logged in player.

/// /// This revokes the player's access tokens and clears them from the AwsGameKitSessionManager.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful. /// - GAMEKIT_ERROR_LOGIN_FAILED: There was no user logged in or an exception occurred while revoking the user's tokens. For the second case, please check the logs for details. ///
/// Delegate that is called once the function has finished executing public void Logout(Action callback); /// /// Get information about the currently logged in player.

/// /// The response is a JSON string containing the following information (or an empty string if the call failed):
/// - The date time when the player was registered.
/// - The date time of the last time the player's identity information was modified.
/// - The player's GameKit ID.

/// /// Result status codes returned in the callback function (from GameKitErrors.cs):
/// - GAMEKIT_SUCCESS: The API call was successful.
/// - GAMEKIT_ERROR_NO_ID_TOKEN: The player is not logged in.
/// - GAMEKIT_ERROR_HTTP_REQUEST_FAILED: The backend HTTP request failed. Check the output logs to see what the HTTP response code was
/// - GAMEKIT_ERROR_PARSE_JSON_FAILED: The backend returned a malformed JSON payload. This should not happen. If it does, it indicates there is a bug in the backend code. ///
/// Delegate that is called once the function has finished executing public void GetUser(Action callback); } }