Class GitHubOidcProvider
Implementation of the OpenID Connect GitHub Provider
Implements
Namespace: i5.Toolkit.Core.OpenIDConnectClient
Assembly: cs.temp.dll.dll
Syntax
public class GitHubOidcProvider : IOidcProvider
Constructors
GitHubOidcProvider()
Creates a new instance of the GitHub client
Declaration
public GitHubOidcProvider()
Properties
AuthorizationFlow
Gets or sets the used authorization flow
Declaration
public AuthorizationFlow AuthorizationFlow { get; set; }
Property Value
Type | Description |
---|---|
AuthorizationFlow |
Browser
The implementation that should accesss the browser
Declaration
public IBrowser Browser { get; set; }
Property Value
Type | Description |
---|---|
IBrowser |
ClientData
Client data that are required to authorize the client at the provider
Declaration
public ClientData ClientData { get; set; }
Property Value
Type | Description |
---|---|
ClientData |
JsonSerializer
Serializer that is responsible for parsing JSON data and converting to JSON
Declaration
public IJsonSerializer JsonSerializer { get; set; }
Property Value
Type | Description |
---|---|
IJsonSerializer |
RestConnector
Specifies how the REST API of the Web service is accessed
Declaration
public IRestConnector RestConnector { get; set; }
Property Value
Type | Description |
---|---|
IRestConnector |
Methods
CheckAccessTokenAsync(String)
Checks if the access token is valid by checking it at the GitHub provider
Declaration
public async Task<bool> CheckAccessTokenAsync(string accessToken)
Parameters
Type | Name | Description |
---|---|---|
String | accessToken | The access token that should be checked |
Returns
Type | Description |
---|---|
Task<Boolean> | 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
public string GetAccessToken(Dictionary<string, string> redirectParameters)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<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
public async 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
public string GetAuthorizationCode(Dictionary<string, string> redirectParameters)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<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 GitHub provider
Declaration
public async 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 |
OpenLoginPage(String[], String)
Opens the GitHUb login page in the system's default Web browser
Declaration
public 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
public bool ParametersContainError(Dictionary<string, string> parameters, out string errorMessage)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<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 |
---|---|
Boolean | Returns true if the parameters contain an error message, otherwise false |