Skip to content

Commit 96aeca4

Browse files
warwickschroederjasontaylordev
authored andcommitted
Allow multiple api scopes. Add audience config which is needed for some IdPs
1 parent 61cf046 commit 96aeca4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Frontend/src/stores/AuthStore.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ interface AuthConfigResponse {
88
enabled: boolean;
99
client_id: string;
1010
authority: string;
11-
api_scope: string;
11+
api_scopes: string;
12+
audience: string;
1213
}
1314

1415
export const useAuthStore = defineStore("auth", () => {
@@ -46,19 +47,23 @@ export const useAuthStore = defineStore("auth", () => {
4647
}
4748

4849
function transformToAuthConfig(config: AuthConfigResponse): AuthConfig {
50+
const apiScope = JSON.parse(config.api_scopes).join(" ");
4951
return {
5052
authority: config.authority,
5153
client_id: config.client_id,
5254
redirect_uri: window.location.origin,
5355
post_logout_redirect_uri: window.location.origin,
5456
response_type: "code",
55-
scope: `${config.api_scope} openid profile email offline_access`,
57+
scope: `${apiScope} openid profile email offline_access`,
5658
automaticSilentRenew: true,
5759
loadUserInfo: false,
5860
includeIdTokenInSilentRenew: true,
5961
silent_redirect_uri: window.location.origin + "/silent-renew.html",
6062
filterProtocolClaims: true,
6163
userStore: new WebStorageStateStore({ store: window.sessionStorage }),
64+
extraQueryParams: {
65+
audience: config.audience,
66+
},
6267
};
6368
}
6469

src/Frontend/vite.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const port = 5173;
2525
const defaultUrls = [
2626
"http://10.211.55.3:*", // The default Parallels url to access Windows VM
2727
"http://localhost:*",
28-
"https://login.microsoftonline.com", // Entra ID authentication
29-
"https://graph.microsoft.com", // Microsoft Graph API
28+
"https://*",
3029
];
3130

3231
// https://vitejs.dev/config/

0 commit comments

Comments
 (0)