authentication
This bundle provides a set of security widgets which are linked to the login state of the user:
- login/logout Buttons
- login UI (authentication window)
- authenticationInfo widget to show user details.
Furthermore, tools to trigger a login and a logout are provided.
Usage
Depending of the selected security mode, a UI appears on startup or a redirect to a login endpoint is performed. After validating the user credentials the user is redirected to the original app.
For more information about enabling security features in map.apps, see the Administration Guide.
Use Cases
How to register authentication tools
The following tool can be registered in a toolset by calling its tool ID:
Tool ID | Component | Description |
---|---|---|
loginTool | LoginTool | Triggers a login; Tool is only visible if user is not logged in. |
logoutTool | LogoutTool | Triggers a logout; Tool is only visible if user is logged in. |
How to register login-widgets in a template
Each of the following widgets can be registered in a template by calling its widget role:
Widget Role | Component | Description |
---|---|---|
username | UsernameWidget | Displays the username (deprecated) |
logoutBtn | LogoutBtn | Displays a logout button (deprecated) |
loginBtn | LoginBtn | Displays a login button (deprecated) |
loginUI | LoginUI | Displays a login dialog |
authenticationInfo | AuthenticationInfoWidget | Displays Login/Logout UI user infos |
How to specify the displayed user infos
Per default, the user's given name (${givenname}
), surname (${sn}
), Email address (${mail}
) and thumbnail (${thumbnail}
) are displayed in the authenticationInfo
widget are displayed.
This behavior can be configured in the AuthenticationInfoWidget component:
"authentication": {
"AuthenticationInfoWidget": {
"userInfosToDisplay": ["givenname", "sn", "mail", "thumbnail"]
}
}
The login name of the user is shown, to as label selector of the user menu. This label can be configured in the AuthenticationInfoWidget component:
"authentication": {
"AuthenticationInfoWidget": {
// defines a template to create a label out of the properties provided by the internal User instance.
// for example `${givenname} ${sn}`. You can use keys like `${givenname}`, `${sn}`, `$(mail)`.
// And any key provided in the json of the `/account/self` endpoint.
"usernameTemplate": "" // default value, which means the result of `authentication.getName()` is used.
}
}
How to refresh the app on logout instead of a redirect to the login page
By default, a user is redirected to the configured login page after logout.
To refresh the viewed page after logout, activate the refreshPage
property.
"authentication": {
"RedirectOnLogout": {
"refreshPage": true // default value is: false
}
}
How to hide authentication widgets or disable redirecting on logout in embedded mode
Per default, all widgets provided through this bundle are shown with respect to the user's login state. However, the AuthenticationWidgetController component can be used to disable specific widget.
"authentication": {
"AuthenticationWidgetController": {
// default is true for all properties here
"showLoginButton": false,
"showLogoutButton": false,
// redirect on logout
"disableRedirectInEmbeddedMode": false
}
}