Skip to content

Commit

Permalink
Add SAML IDP logout url (+DefaultRelayState +ForceAuthentication) (#381)
Browse files Browse the repository at this point in the history
* Add SAML IDP logout url (+DefaultRelayState +ForceAuthentication)

* Fix tests
  • Loading branch information
guyp-descope authored Jul 30, 2024
1 parent f34368b commit 28bddf9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/management/ssoapplication.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const mockSSOApplications = [
acsAllowedCallbacks: [],
subjectNameIdType: '',
subjectNameIdFormat: '',
defaultRelayState: 'rs',
forceAuthentication: false,
idpLogoutUrl: 'http://dummyidp.com/logout',
logoutRedirectUrl: 'http://dummy.com/logout',
},
oidcSettings: null,
},
Expand All @@ -57,6 +61,7 @@ const mockSSOApplications = [
loginPageUrl: 'http://dummy.com/login',
issuer: 'http://dummy.com/issuer',
discoveryUrl: 'http://dummy/discovery',
forceAuthentication: true,
},
},
];
Expand Down Expand Up @@ -87,6 +92,7 @@ describe('Management SSOApplication', () => {
await management.ssoApplication.createOidcApplication({
name: 'name',
loginPageUrl: 'http://dummy.com',
forceAuthentication: true,
});

expect(mockHttpClient.post).toHaveBeenCalledWith(
Expand All @@ -98,6 +104,7 @@ describe('Management SSOApplication', () => {
description: undefined,
enabled: true,
logo: undefined,
forceAuthentication: true,
},
{ token: 'key' },
);
Expand Down Expand Up @@ -129,6 +136,9 @@ describe('Management SSOApplication', () => {
loginPageUrl: 'http://dummy.com',
useMetadataInfo: true,
metadataUrl: 'http://dummy.com/metadata',
defaultRelayState: 'rs',
forceAuthentication: true,
logoutRedirectUrl: 'http://dummy.com/logout',
});

expect(mockHttpClient.post).toHaveBeenCalledWith(
Expand All @@ -150,6 +160,9 @@ describe('Management SSOApplication', () => {
acsAllowedCallbacks: undefined,
subjectNameIdType: undefined,
subjectNameIdFormat: undefined,
defaultRelayState: 'rs',
forceAuthentication: true,
logoutRedirectUrl: 'http://dummy.com/logout',
},
{ token: 'key' },
);
Expand Down Expand Up @@ -242,6 +255,7 @@ describe('Management SSOApplication', () => {
description: undefined,
enabled: false,
logo: undefined,
forceAuthentication: undefined,
},
{ token: 'key' },
);
Expand Down Expand Up @@ -295,6 +309,9 @@ describe('Management SSOApplication', () => {
acsAllowedCallbacks: undefined,
subjectNameIdType: undefined,
subjectNameIdFormat: undefined,
defaultRelayState: undefined,
forceAuthentication: undefined,
logoutRedirectUrl: undefined,
},
{ token: 'key' },
);
Expand Down
9 changes: 9 additions & 0 deletions lib/management/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export type OidcApplicationOptions = {
description?: string;
logo?: string;
enabled?: boolean;
forceAuthentication?: boolean;
};

/**
Expand All @@ -53,6 +54,9 @@ export type SamlApplicationOptions = {
acsAllowedCallbacks?: string[];
subjectNameIdType?: string;
subjectNameIdFormat?: string;
defaultRelayState?: string;
forceAuthentication?: boolean;
logoutRedirectUrl?: string;
};

/**
Expand Down Expand Up @@ -185,6 +189,7 @@ export type SSOApplicationOIDCSettings = {
loginPageUrl: string;
issuer: string;
discoveryUrl: string;
forceAuthentication: boolean;
};

/** Represents SAML settings of an SSO application in a project. */
Expand All @@ -204,6 +209,10 @@ export type SSOApplicationSAMLSettings = {
acsAllowedCallbacks: string[];
subjectNameIdType: string;
subjectNameIdFormat: string;
defaultRelayState: string;
forceAuthentication: boolean;
idpLogoutUrl: string;
logoutRedirectUrl: string;
};

/** Represents an SSO application in a project. */
Expand Down

0 comments on commit 28bddf9

Please sign in to comment.