Interface IOidcProvider
Contract that specifies the capabilities of an OpenID Connect provider
Namespace: i5.Toolkit.Core.OpenIDConnectClient
Assembly: cs.temp.dll.dll
Syntax
public interface IOidcProvider
Properties
AuthorizationFlow
Gets the authorization flow that should be used for the provider
Declaration
AuthorizationFlow AuthorizationFlow { get; }
Property Value
Type | Description |
---|---|
AuthorizationFlow |
ClientData
Client data that are required to authorize the client at the provider
Declaration
ClientData ClientData { get; set; }
Property Value
Type | Description |
---|---|
ClientData |
RestConnector
Specifies how the REST API of the Web service is accessed
Declaration
IRestConnector RestConnector { get; set; }
Property Value
Type | Description |
---|---|
IRestConnector |
Methods
CheckAccessTokenAsync(string)
Checks if the access token is valid by checking it at the provider
Declaration
Task<bool> CheckAccessTokenAsync(string accessToken)
Parameters
Type | Name | Description |
---|---|---|
string | accessToken | The access token that should be checked |
Returns
Type | Description |
---|---|
Task<><bool> | True if the access token is valid, otherwise false |
GetAccessToken(Dictionary<string, string>)
Gets the access token from a list of parameters in a Web answer
Declaration
string GetAccessToken(Dictionary<string, string> redirectParameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<TKey, TValue><string, string> | redirectParameters | The parameters of the Web answer as a dictionary |
Returns
Type | Description |
---|---|
string | Returns the access token if it exists in the parameters, otherwise an empty string is returned |
GetAccessTokenFromCodeAsync(string, string)
Gets the access token based on a previously retrieved authorization code
Declaration
Task<string> GetAccessTokenFromCodeAsync(string code, string redirectUri)
Parameters
Type | Name | Description |
---|---|---|
string | code | The authorization code |
string | redirectUri | The redirect URI which was used during the login |
Returns
Type | Description |
---|---|
Task<><string> | Returns the access token if it could be retrieved; otherwise it returns an empty string |
GetAuthorizationCode(Dictionary<string, string>)
Extracts the authorization code from parameters of a Web answer
Declaration
string GetAuthorizationCode(Dictionary<string, string> redirectParameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<TKey, TValue><string, string> | redirectParameters | Parameters of a Web answer as a dictionary |
Returns
Type | Description |
---|---|
string | The authorization code if it could be found, otherwise an empty string is returned |
GetUserInfoAsync(string)
Gets information about the logged in user from the provider
Declaration
Task<IUserInfo> GetUserInfoAsync(string accessToken)
Parameters
Type | Name | Description |
---|---|---|
string | accessToken | The access token to authenticate the user |
Returns
Type | Description |
---|---|
Task<><IUserInfo> | Returns information about the logged in user if the request was successful, otherwise null |
InitializeEndpointsAsync()
Sets the required endpoints
Declaration
Task<EndpointsData> InitializeEndpointsAsync()
Returns
Type | Description |
---|---|
Task<><EndpointsData> | Returns the fetched endpoints response |
OpenLoginPage(string[], string)
Opens the provider's login page in the system's default Web browser
Declaration
void OpenLoginPage(string[] scopes, string redirectUri)
Parameters
Type | Name | Description |
---|---|---|
string[] | scopes | The OpenID Connect scopes that the user must agree to |
string | redirectUri | The URI to which the browser should redirect after the successful login |
ParametersContainError(Dictionary<string, string>, out string)
Checks if the provider included error messages in the parameters of a Web answer
Declaration
bool ParametersContainError(Dictionary<string, string> parameters, out string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<TKey, TValue><string, string> | parameters | The parameters of a Web answer as a dictionary |
string | errorMessage | The error message that the provider included, empty if no error exists |
Returns
Type | Description |
---|---|
bool | Returns true if the parameters contain an error message, otherwise false |