mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
AAE-39528 Session timeout features (#12008)
* feat: session timeout features
This commit is contained in:
@@ -13,6 +13,50 @@ The authType parameter specifies the authentication method, with BASIC and OAUTH
|
||||
"authType": "OAUTH"
|
||||
}
|
||||
```
|
||||
|
||||
## Session Timeout
|
||||
|
||||
ADF can track user activity and show a countdown dialog before logging out an idle authenticated session. Register the feature with `provideSessionTimeout` in your application providers:
|
||||
|
||||
```ts
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideSessionTimeout } from '@alfresco/adf-core';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideSessionTimeout({
|
||||
enabled: true,
|
||||
idleTimeoutMs: 30 * 60 * 1000,
|
||||
dialogTimeoutMs: 60 * 1000
|
||||
})
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
The same values can be configured in `app.config.json` with the `sessionTimeout` key:
|
||||
|
||||
```json
|
||||
{
|
||||
"sessionTimeout": {
|
||||
"enabled": true,
|
||||
"idleTimeoutMs": 1800000,
|
||||
"dialogTimeoutMs": 60000
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Registering `provideSessionTimeout` enables the feature: `enabled` defaults to `true`, so the countdown is active unless you set `enabled` to `false` in `app.config.json` or in the options passed to `provideSessionTimeout`. The default idle timeout is 30 minutes, and the default dialog timeout is 60 seconds. Values passed to `provideSessionTimeout` take precedence over values from `app.config.json`.
|
||||
|
||||
Applications can defer startup until another async condition is enabled:
|
||||
|
||||
```ts
|
||||
provideSessionTimeout({
|
||||
startWhen: () => featureService.isOn$('session-timeout-feature')
|
||||
});
|
||||
```
|
||||
|
||||
Whether the user clicks **Log out** in the countdown dialog or leaves it unanswered until the countdown elapses, the normal logout flow runs and the user is redirected to the configured IdP/login page. The same logout is broadcast to other tabs so every session ends together.
|
||||
|
||||
# OAuth2 Configuration
|
||||
OAuth2 is a protocol that allows the application to authorize operations without exposing user credentials. The configuration includes several parameters essential for setting up OAuth2 authentication.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user