Skip to content

Commit

Permalink
Merge pull request #2135 from solliancenet/sc-allow-user-configuratio…
Browse files Browse the repository at this point in the history
…n-of-token-timeout

Allow user configuration of token timeout on User Portal
  • Loading branch information
ciprianjichici authored Jan 17, 2025
2 parents 0c854a4 + a0e7816 commit 48e8fcc
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 2 deletions.
8 changes: 8 additions & 0 deletions docs/release-notes/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ To support the event grid infrastructure, the following new App Configuration se
The following topic needs to be created in the event grid namespace, must have a `resource-providers` topic with a publisher type of `Custom` and an input schema of `Cloud Events v1.0`.

### Configuration changes

Added the following App Configuration value:

|Name | Default value | Description |
|--- | --- | --- |
`FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes` | `60` | The timeout in minutes for a user's auth token in the User Portal. |

## Starting with 0.9.1-rc117

### Agent configuration changes
Expand Down
8 changes: 8 additions & 0 deletions src/dotnet/Common/Constants/Data/AppConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,14 @@
"value": "${env:ENTRA_CHAT_UI_CLIENT_ID}",
"content_type": "",
"first_version": "0.8.0"
},
{
"name": "TimeoutInMinutes",
"description": "The timeout in minutes for the auth token in the User Portal.",
"secret": "",
"value": "60",
"content_type": "",
"first_version": "0.9.1"
}
]
},
Expand Down
7 changes: 7 additions & 0 deletions src/dotnet/Common/Templates/AppConfigurationKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,13 @@ public static class AppConfigurationKeys
/// </summary>
public const string FoundationaLLM_UserPortal_Authentication_Entra_ClientId =
"FoundationaLLM:UserPortal:Authentication:Entra:ClientId";

/// <summary>
/// The app configuration key for the FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes setting.
/// <para>Value description:<br/>The timeout in minutes for the auth token in the User Portal.</para>
/// </summary>
public const string FoundationaLLM_UserPortal_Authentication_Entra_TimeoutInMinutes =
"FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes";

#endregion

Expand Down
7 changes: 7 additions & 0 deletions src/dotnet/Common/Templates/appconfig.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,13 @@
"content_type": "",
"tags": {}
},
{
"key": "FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes",
"value": "60",
"label": null,
"content_type": "",
"tags": {}
},
{
"key": "FoundationaLLM:UserPortal:Configuration:ShowLastConversationOnStartup",
"value": "false",
Expand Down
7 changes: 5 additions & 2 deletions src/ui/UserPortal/components/SessionExpirationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ export default {
},
startDialogTimer() {
// Show the dialog every hour
// Show the dialog every configured interval
const timeoutInMinutes = this.$appConfigStore.auth.timeoutInMinutes;
const timeoutInMS = timeoutInMinutes * 60 * 1000;
this.dialogInterval = setInterval(
() => {
this.triggerDialog();
},
60 * 60 * 1000,
timeoutInMS,
);
},
Expand Down
1 change: 1 addition & 0 deletions src/ui/UserPortal/server/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const allowedKeys = [
'FoundationaLLM:UserPortal:Authentication:Entra:TenantId',
'FoundationaLLM:UserPortal:Authentication:Entra:Scopes',
'FoundationaLLM:UserPortal:Authentication:Entra:CallbackPath',
'FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes',
'FoundationaLLM:UserPortal:Configuration:ShowMessageRating',
'FoundationaLLM:UserPortal:Configuration:ShowViewPrompt',
'FoundationaLLM:UserPortal:Configuration:ShowMessageTokens',
Expand Down
4 changes: 4 additions & 0 deletions src/ui/UserPortal/stores/appConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const useAppConfigStore = defineStore('appConfig', {
tenantId: null,
scopes: [],
callbackPath: null,
timeoutInMinutes: 60,
},
}),
getters: {},
Expand Down Expand Up @@ -96,6 +97,7 @@ export const useAppConfigStore = defineStore('appConfig', {
authTenantId,
authScopes,
authCallbackPath,
authTimeoutInMinutes,
] = await Promise.all([
api.getConfigValue('FoundationaLLM:APIEndpoints:CoreAPI:Essentials:APIUrl'),

Expand Down Expand Up @@ -138,6 +140,7 @@ export const useAppConfigStore = defineStore('appConfig', {
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:TenantId'),
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:Scopes'),
api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:CallbackPath'),
getConfigValueSafe('FoundationaLLM:UserPortal:Authentication:Entra:TimeoutInMinutes', 60),
]);

this.apiUrl = apiUrl;
Expand Down Expand Up @@ -177,6 +180,7 @@ export const useAppConfigStore = defineStore('appConfig', {
this.auth.tenantId = authTenantId;
this.auth.scopes = authScopes;
this.auth.callbackPath = authCallbackPath;
this.auth.timeoutInMinutes = authTimeoutInMinutes;
},
},
});

0 comments on commit 48e8fcc

Please sign in to comment.