Class OpenIDConnectService
Service that implements the OpenID Connect authentification
Namespace: i5.Toolkit.Core.OpenIDConnectClient
Assembly: cs.temp.dll.dll
Syntax
public class OpenIDConnectService : IUpdateableService
Constructors
OpenIDConnectService()
Creates a new instance of the OpenID Connect service
Declaration
public OpenIDConnectService()
Properties
AccessToken
The access token of the logged in user Use this token to access data about the user or to access protected Web resources
Declaration
public string AccessToken { get; }
Property Value
Type | Description |
---|---|
String |
Enabled
If set to true, the Update method will be executed every frame
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsLoggedIn
Is true if the user of the application is currently logged in
Declaration
public bool IsLoggedIn { get; }
Property Value
Type | Description |
---|---|
Boolean |
OidcProvider
The provider that should be used for the OpenID Connect procedure
Declaration
public IOidcProvider OidcProvider { get; set; }
Property Value
Type | Description |
---|---|
IOidcProvider |
RedirectURI
The URI which should be shown to the user after the login For UWP and Android apps, change the Uri schema to something unique and also change it in the project settings This way, the app will be opened again on the redirect. If this URI is not set, a standard page is shown.
Declaration
public string RedirectURI { get; set; }
Property Value
Type | Description |
---|---|
String |
Scopes
List of scopes that the user must agree to and which give the client access to specific data
Declaration
public string[] Scopes { get; set; }
Property Value
Type | Description |
---|---|
String[] |
ServerListener
A server listener implementation that listens for the redirect
Declaration
public IRedirectServerListener ServerListener { get; set; }
Property Value
Type | Description |
---|---|
IRedirectServerListener |
Methods
CheckAccessToken()
Checks if the access token is valid
Declaration
public Task<bool> CheckAccessToken()
Returns
Type | Description |
---|---|
Task<Boolean> | Returns true if the access token could be verified at the provider |
Cleanup()
Called by the service manager once the service is unregistered Stops the server if it is running and logs the user out
Declaration
public void Cleanup()
GetUserDataAsync()
Gets the user's information
Declaration
public Task<IUserInfo> GetUserDataAsync()
Returns
Type | Description |
---|---|
Task<IUserInfo> | Returns user data from the OIDC provider |
HandleActivation(DeepLinkArgs)
Handles the activation by deep links Allows both the login path, e.g. i5:/login or i5:/ for backwards compatibility.
Declaration
public void HandleActivation(DeepLinkArgs deepLinkArgs)
Parameters
Type | Name | Description |
---|---|---|
DeepLinkArgs | deepLinkArgs | The parameters of the deep link activation |
Initialize(IServiceManager)
Initialization which is called by the server manager once the service is registered
Declaration
public void Initialize(IServiceManager owner)
Parameters
Type | Name | Description |
---|---|---|
IServiceManager | owner | The service manager that owns this service |
Logout()
Logs the user out
Declaration
public void Logout()
OpenLoginPage()
Opens a login page in the system's default browser so that the user can log in Requires a configured OpenID Connect provider
Declaration
public void OpenLoginPage()
ServerListener_RedirectReceived(Object, RedirectReceivedEventArgs)
Called by the server listener once a redirect was received
Declaration
public void ServerListener_RedirectReceived(object sender, RedirectReceivedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | The sender of the event |
RedirectReceivedEventArgs | e | The arguments of the redirect event |
Update()
Called each frame by the service manager Handles the redirect processing on the main thread
Declaration
public void Update()
Events
LoginCompleted
Event which is raised once the login was successfully completed
Declaration
public event EventHandler LoginCompleted
Event Type
Type | Description |
---|---|
EventHandler |
LogoutCompleted
Event which is reaised once the logout was completed
Declaration
public event EventHandler LogoutCompleted
Event Type
Type | Description |
---|---|
EventHandler |