IRhinoAccountsManager

public interface IRhinoAccountsManager
Performs various Rhino Accounts-related tasks.

Methods

ExecuteProtectedCode

#Since v7.0
Any synchronous method in the IRhinoAccountsManager class must be executed within the function passed to this method, or an InvalidOperationException will be thrown.
void ExecuteProtectedCode(
protectedCode
A function returning an awaitable task that has a SecretKey passed to it. You will need to pass this secret key to any method you wish to call within IRhinoAccountsManager.
)
Remarks: The code within the function passed must be kept as breif as possible for performance and security reasons.
RhinoAccountsOperationInProgressExceptionAnother operation is already in progress.

ExecuteProtectedCodeAsync

#
Any asynchronous method in the IRhinoAccountsManager class must be executed within the function passed to this method, or an InvalidOperationException will be thrown.
Task ExecuteProtectedCodeAsync(
protectedCode
A function returning an awaitable task that has a SecretKey passed to it. You will need to pass this secret key to any method you wish to call within IRhinoAccountsManager.
)
Remarks: The code within the function passed must be kept as breif as possible for performance and security reasons.
RhinoAccountsOperationInProgressExceptionAnother operation is already in progress.

GetAuthTokensAsync

#
Asynchronously retrieves auth tokens with the given criteria from the Rhino Accounts server.
Task<Tuple<IOpenIDConnectToken, IOAuth2Token>> GetAuthTokensAsync(
clientId,
The unique id of the client registered in Rhino Accounts.
clientSecret,
The secret of the client registered in Rhino Accounts
scope,
The scope desired for the tokens. Valid scope values can be found in the Rhino Accounts documentation.
prompt,
The prompt of the request. See Rhino Accounts documentation for details. You may pass null if no prompt is desired.
int?
maxAge,
The maxAge of the request. See Rhino Accounts documentation for details. You may pass null if no maxAge should be enforced.
showUI,
true if the user should see a UI showing the progress of the operation and a way to cancel it, or false if the UI should not be displayed. If false, it is strongly recommended that you pass a progress object and display your own UI to the user.
progress,
An object that will report the progress of the operation to the caller. If no progress is needed, you may pass null.
secretKey,
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
cancellationToken
A token that can be used to signal that the operation should be cancelled.
)
The auth tokens requested.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager
RhinoAccountsExceptionAn error occurred during the authentication process. You may look at the specific subclass of the exception gain more insight as to why the operation failed.
OperationCanceledExceptionThe operation was cancelled, either by internal decisions or because the cancellationToken was cancelled.

GetAuthTokensAsync

#Since v7.0
Asynchronously retrieves auth tokens with the given criteria from the Rhino Accounts server.
Task<Tuple<IOpenIDConnectToken, IOAuth2Token>> GetAuthTokensAsync(
clientId,
The unique id of the client registered in Rhino Accounts.
clientSecret,
The secret of the client registered in Rhino Accounts
secretKey,
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
cancellationToken
A token that can be used to signal that the operation should be cancelled.
)
Remarks: This method includes a default scope of 'openid', 'email', 'profile', and 'groups'. It should be suffifient for most workflows. This method shows the user a UI showing them the progress of the operation, and allows them to cancel it at any time. It also stores the retrieved tokens in a secure cache so they can be retrieved in the future by calling TryGetAuthTokens(string, SecretKey)
The auth tokens requested.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager
RhinoAccountsExceptionAn error occurred during the authentication process. You may look at the specific subclass of the exception gain more insight as to why the operation failed.
OperationCanceledExceptionThe operation was cancelled, either by internal decisions or because the cancellationToken was cancelled.

RevokeAuthTokenAsync

#Since v7.0
Invalidates/revokes an IOAuth2Token object from the Rhino Accounts server.
Task RevokeAuthTokenAsync(
oauth2Token,
The token to revoke.
secretKey,
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
cancellationToken
A token that can be used to signal that the operation should be cancelled.
)
Remarks: If the OAuth 2 token is stored in the local cache, it will be removed from the cache as well.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager
OperationCanceledExceptionThe operation was cancelled, either by internal decisions or because the cancellationToken was cancelled.

TryGetAuthTokens

#Since v7.0
Attempts to return cached auth tokens that match the given criteria if any have been stored in cache.
Tuple<IOpenIDConnectToken, IOAuth2Token> TryGetAuthTokens(
clientId,
The unique id of the client registered in Rhino Accounts.
scope,
The scope desired for the tokens. Valid scope values can be found in the Rhino Accounts documentation.
secretKey
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
)
Cached tokens matching the exact criteria passed, or null if none can be found matching the criteria.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager

TryGetAuthTokens

#Since v7.0
Attempts to return cached auth tokens that match the given criteria if any have been stored in cache.
Tuple<IOpenIDConnectToken, IOAuth2Token> TryGetAuthTokens(
clientId,
The unique id of the client registered in Rhino Accounts.
secretKey
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
)
Cached tokens matching the exact criteria passed, or null if none can be found matching the criteria.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager

UpdateOpenIDConnectTokenAsync

#Since v7.0
Updates an OpenID Connect token so that it contains the latest user information by contacting the Rhino Account's server userinfo endpoint using a compatible O
Task<IOpenIDConnectToken> UpdateOpenIDConnectTokenAsync(
currentToken,
The existing OpenID Connect token that you wish to updated with the latest user information.
oauth2Token,
A valid OAuth2 token used for authorization. The OAuth2 token must have been issued together with the OpenID Connect token passed or a RhinoAccountsAuthTokenMismatchException will be thrown.
secretKey,
A special key that was handed to you in ExecuteProtectedCodeAsync(Func<SecretKey, Task>)
cancellationToken
A token that can be used to signal that the operation should be cancelled.
)
Remarks: If the OpenID Connect token is currently stored in the local cache, it will be updated to reflect the new token.
The updated OpenIDConnectToken based on the original token passed to this method.
InvalidOperationExceptionAn invalid secretKey was passed, or the assembly is not allowed to call methods from IRhinoAccountsManager
RhinoAccountsExceptionAn error occurred during the authentication process. You may look at the specific subclass of the exception gain more insight as to why the operation failed.
OperationCanceledExceptionThe operation was cancelled, either by internal decisions or because the cancellationToken was cancelled.