docpouch-client 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/test-post-logout.js +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -414,6 +414,7 @@ export interface I_OidcUserInfo {
|
|
|
414
414
|
export interface I_OidcClientRegistration {
|
|
415
415
|
client_name: string;
|
|
416
416
|
redirect_uris: string[];
|
|
417
|
+
post_logout_redirect_uris?: string[];
|
|
417
418
|
grant_types?: string[];
|
|
418
419
|
response_types?: string[];
|
|
419
420
|
scope?: string;
|
|
@@ -433,6 +434,7 @@ export interface I_OidcClientResponse {
|
|
|
433
434
|
registration_client_uri?: string;
|
|
434
435
|
client_name?: string;
|
|
435
436
|
redirect_uris?: string[];
|
|
437
|
+
post_logout_redirect_uris?: string[];
|
|
436
438
|
grant_types?: string[];
|
|
437
439
|
response_types?: string[];
|
|
438
440
|
scope?: string;
|
package/dist/index.js
CHANGED
|
@@ -491,7 +491,8 @@ export default class docPouchClient {
|
|
|
491
491
|
const wasOidc = this.authMethod === 'oidc';
|
|
492
492
|
// For OIDC, redirect to /end_session endpoint
|
|
493
493
|
if (wasOidc && this.oidcConfig && typeof window !== 'undefined') {
|
|
494
|
-
|
|
494
|
+
// Use postLogoutRedirectUri if available, otherwise fallback to redirectUri
|
|
495
|
+
const redirectUri = options?.redirectUri || this.oidcConfig.postLogoutRedirectUri || this.oidcConfig.redirectUri || window.location.origin;
|
|
495
496
|
let url = `${this.oidcConfig.issuer}/end_session?post_logout_redirect_uri=${encodeURIComponent(redirectUri)}`;
|
|
496
497
|
// Add id_token_hint if available
|
|
497
498
|
const idToken = options?.idTokenHint || this.oidcIdToken;
|
|
@@ -543,7 +544,7 @@ export default class docPouchClient {
|
|
|
543
544
|
if (!this.oidcConfig?.issuer) {
|
|
544
545
|
throw new Error('OIDC issuer not configured');
|
|
545
546
|
}
|
|
546
|
-
const { redirectUri = this.oidcConfig.redirectUri || window.location.origin, idTokenHint } = options || {};
|
|
547
|
+
const { redirectUri = this.oidcConfig.postLogoutRedirectUri || this.oidcConfig.redirectUri || window.location.origin, idTokenHint } = options || {};
|
|
547
548
|
let url = `${this.oidcConfig.issuer}/end_session?post_logout_redirect_uri=${encodeURIComponent(redirectUri)}`;
|
|
548
549
|
if (idTokenHint) {
|
|
549
550
|
url += `&id_token_hint=${idTokenHint}`;
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Test script to verify post_logout_redirect_uris functionality
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
|
|
4
|
+
// Read the built client to verify the changes
|
|
5
|
+
const clientCode = fs.readFileSync('dist/index.js', 'utf8');
|
|
6
|
+
|
|
7
|
+
console.log('Checking for post_logout_redirect_uris support...');
|
|
8
|
+
|
|
9
|
+
// Check if the interfaces include post_logout_redirect_uris
|
|
10
|
+
const hasRegistrationInterface = clientCode.includes('post_logout_redirect_uris?: string[]');
|
|
11
|
+
const hasResponseInterface = clientCode.includes('post_logout_redirect_uris?: string[]');
|
|
12
|
+
|
|
13
|
+
// Check if logout methods use postLogoutRedirectUri
|
|
14
|
+
const usesPostLogoutUri = clientCode.includes('this.oidcConfig.postLogoutRedirectUri');
|
|
15
|
+
|
|
16
|
+
console.log('I_OidcClientRegistration has post_logout_redirect_uris:', hasRegistrationInterface);
|
|
17
|
+
console.log('I_OidcClientResponse has post_logout_redirect_uris:', hasResponseInterface);
|
|
18
|
+
console.log('Logout methods use postLogoutRedirectUri:', usesPostLogoutUri);
|
|
19
|
+
|
|
20
|
+
if (hasRegistrationInterface && hasResponseInterface && usesPostLogoutUri) {
|
|
21
|
+
console.log('✅ All post_logout_redirect_uris functionality is properly implemented!');
|
|
22
|
+
} else {
|
|
23
|
+
console.log('❌ Some post_logout_redirect_uris functionality is missing');
|
|
24
|
+
}
|