Include openid scope in OIDC authentication requests

This commit is contained in:
Maurus Decimus
2026-04-25 08:14:47 +02:00
parent 68f0ca3629
commit 2344c96651
3 changed files with 18 additions and 8 deletions
+5 -3
View File
@@ -2,10 +2,12 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.1] - 2026-04-XX ## [1.0.1] - 2026-04-25
### Added ### Added
- Logout users from OIDC provider when logging out of the app. - OIDC:
- Logout users from IdP when logging out of the app.
- Include `openid` scope in OIDC authentication requests.
### Changed ### Changed
@@ -14,7 +16,7 @@ All notable changes to this project will be documented in this file. This projec
- Editing a secret clears its masked value. - Editing a secret clears its masked value.
- Array label properties crashes app. - Array label properties crashes app.
## [0.1.0] - 2026-04-20 ## [1.0.0] - 2026-04-20
### Added ### Added
- Initial release. - Initial release.
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "stalwart-webui", "name": "stalwart-webui",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.1",
"description": "Stalwart WebUI", "description": "Stalwart WebUI",
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -67,4 +67,4 @@
"vite": "^8.0.4", "vite": "^8.0.4",
"vitest": "^4.1.4" "vitest": "^4.1.4"
} }
} }
+11 -3
View File
@@ -17,6 +17,7 @@ interface DiscoveryResponse {
authorization_endpoint: string; authorization_endpoint: string;
token_endpoint: string; token_endpoint: string;
end_session_endpoint?: string; end_session_endpoint?: string;
scopes_supported?: string[];
} }
export async function discover(username: string): Promise<DiscoveryResponse> { export async function discover(username: string): Promise<DiscoveryResponse> {
@@ -124,7 +125,8 @@ function getRedirectUri(): string {
} }
export async function startAuthFlow(username: string, returnUrl?: string | null): Promise<void> { export async function startAuthFlow(username: string, returnUrl?: string | null): Promise<void> {
const { authorization_endpoint, token_endpoint, end_session_endpoint } = await discover(username); const { authorization_endpoint, token_endpoint, end_session_endpoint, scopes_supported } =
await discover(username);
const codeVerifier = generateCodeVerifier(); const codeVerifier = generateCodeVerifier();
const { challenge: codeChallenge, method: codeChallengeMethod } = await generateCodeChallenge(codeVerifier); const { challenge: codeChallenge, method: codeChallengeMethod } = await generateCodeChallenge(codeVerifier);
@@ -161,8 +163,14 @@ export async function startAuthFlow(username: string, returnUrl?: string | null)
prompt: 'login', prompt: 'login',
}); });
if (SCOPES && SCOPES.length > 0) { const scope =
params.set('scope', SCOPES); SCOPES && SCOPES.length > 0
? SCOPES
: scopes_supported?.includes('openid')
? 'openid'
: '';
if (scope) {
params.set('scope', scope);
} }
window.location.href = `${authorization_endpoint}?${params.toString()}`; window.location.href = `${authorization_endpoint}?${params.toString()}`;