class MAGES::UserAuthentication::MAGESUserAuthentication¶
Overview¶
MAGES User Authentication Module. More…
class MAGESUserAuthentication: public MAGES::UserAuthenticationModule { public: // structs struct CheckoutLicenseRequestBody; struct HeartbeatLicenseRequestBody; // properties override bool OfflineMode; override bool RequireLoginAndLicenseBeforeOperationStart; override string ProductCode; override GameObject AuthenticationUI; override bool IsLoggedIn; override bool HasActiveLicense; // methods virtual override async Task<ResponseStatusCode> LogIn( string username, string password ); virtual override void LogOut(); virtual override async Task<ResponseStatusCode> LogInAndRequestLicense( string username, string password ); virtual override async Task<ResponseStatusCode> RequestLicense(); virtual override async Task<(ResponseStatusCode, User?)> GetUser(bool forceFetchFromServer = false); virtual override async Task<(ResponseStatusCode, License?)> GetActiveLicense(bool forceFetchFromServer = false); virtual override async TaskSendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption, CancellationToken cancellationToken ); virtual override async Task SendRequestAsync(HttpRequestMessage msg); virtual override async Task SendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption ); virtual override async Task SendRequestAsync( HttpRequestMessage msg, CancellationToken cancellationToken ); override void Startup(); override void Shutdown(); };
Inherited Members¶
public: // properties int Version; UnityEvent LoggedIn; UnityEvent LoggedOut; UnityEvent LicenseGranted; UnityEvent LicenseRevoked; bool IsLoggedIn; bool HasActiveLicense; bool OfflineMode; bool RequireLoginAndLicenseBeforeOperationStart; string ProductCode; GameObject AuthenticationUI; bool IsLoggedIn; bool HasActiveLicense; UnityEvent LoggedIn; UnityEvent LoggedOut; UnityEvent LicenseGranted; UnityEvent LicenseRevoked; // methods void Startup(); void Shutdown(); virtual void UpdateModule(UpdatePhase updatePhase); Task<ResponseStatusCode> LogIn(string username, string password); void LogOut(); Task<ResponseStatusCode> LogInAndRequestLicense( string username, string password ); Task<ResponseStatusCode> RequestLicense(); Task<(ResponseStatusCode, User?)> GetUser(bool forceFetchFromServer = false); Task<(ResponseStatusCode, License?)> GetActiveLicense(bool forceFetchFromServer = false); TaskSendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption, CancellationToken cancellationToken ); Task SendRequestAsync(HttpRequestMessage msg); Task SendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption ); Task SendRequestAsync( HttpRequestMessage msg, CancellationToken cancellationToken ); virtual async Task<ResponseStatusCode> LogIn(string username, string password); virtual void LogOut(); virtual async Task<ResponseStatusCode> LogInAndRequestLicense( string username, string password ); virtual async Task<ResponseStatusCode> RequestLicense(); virtual async Task<(ResponseStatusCode, User?)> GetUser(bool forceFetchFromServer = false); virtual async Task<(ResponseStatusCode, License?)> GetActiveLicense(bool forceFetchFromServer = false); virtual async Task SendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption, CancellationToken cancellationToken ); virtual async Task SendRequestAsync(HttpRequestMessage msg); virtual Task SendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption ); virtual Task SendRequestAsync( HttpRequestMessage msg, CancellationToken cancellationToken );
Detailed Documentation¶
MAGES User Authentication Module.
Properties¶
override bool IsLoggedIn
Gets a value indicating whether a user is logged in.
override bool HasActiveLicense
Gets a value indicating whether the user has activated a license.
Methods¶
virtual override async Task<ResponseStatusCode> LogIn( string username, string password )
Perform Login.
Parameters:
username |
The username. |
password |
The password. |
Returns:
The request status code.
virtual override void LogOut()
Performs log out.
virtual override async Task<ResponseStatusCode> LogInAndRequestLicense( string username, string password )
Logs in and requests a license.
Parameters:
username |
The username. |
password |
The password. |
Returns:
The request status code.
virtual override async Task<ResponseStatusCode> RequestLicense()
Requests a license.
Returns:
The request status code.
virtual override async Task<(ResponseStatusCode, User?)> GetUser(bool forceFetchFromServer = false)
Gets the User Information.
Parameters:
forceFetchFromServer |
If set to |
Returns:
The request status code and the logged in User, if any.
virtual override async Task<(ResponseStatusCode, License?)> GetActiveLicense(bool forceFetchFromServer = false)
Gets the currently active license, or a new one if no active license is found.
Parameters:
forceFetchFromServer |
If set to |
Returns:
The request status code and the currently active license, if any.
virtual override async TaskSendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption, CancellationToken cancellationToken )
Adds the Authorization header and sends the web request. If the request fails due to an expired access token, it will try to refresh the token and retry the request.
Parameters:
msg |
The HTTP request message to send. |
completionOption |
When the operation should complete (as soon as a response is available or after reading the whole response content). |
cancellationToken |
The cancellation token to cancel operation. |
Returns:
The task object representing the asynchronous operation.
virtual override async TaskSendRequestAsync(HttpRequestMessage msg)
Adds the Authorization header and sends the web request. If the request fails due to an expired access token, it will try to refresh the token and retry the request.
Parameters:
msg |
The HTTP request message to send. |
Returns:
The task object representing the asynchronous operation.
virtual override async TaskSendRequestAsync( HttpRequestMessage msg, HttpCompletionOption completionOption )
Adds the Authorization header and sends the web request. If the request fails due to an expired access token, it will try to refresh the token and retry the request.
Parameters:
msg |
The HTTP request message to send. |
completionOption |
When the operation should complete (as soon as a response is available or after reading the whole response content). |
Returns:
The task object representing the asynchronous operation.
virtual override async TaskSendRequestAsync( HttpRequestMessage msg, CancellationToken cancellationToken )
Adds the Authorization header and sends the web request. If the request fails due to an expired access token, it will try to refresh the token and retry the request.
Parameters:
msg |
The HTTP request message to send. |
cancellationToken |
The cancellation token to cancel operation. |
Returns:
The task object representing the asynchronous operation.