-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add SSO SAML metadataUrl support and various improvements (#6139)
* feat: add various sso improvements * fix: remove test button assertion * fix: fix type imports * test: attempt fixing unit tests * fix: changed to using useToast for error toasts * Minor copy tweaks and swapped buttons position. * fix locale ref * align error with UI wording * simplify saving ux * fix pretty * fix: update saml sso setting saving * fix: undo try/catch changes when saving saml config * metadata url tab selected at first * chore: fix linting issue * test: fix activation checkbox test --------- Co-authored-by: Giulio Andreini <[email protected]> Co-authored-by: Michael Auerswald <[email protected]> Co-authored-by: Romain Minaud <[email protected]>
- Loading branch information
1 parent
4b85433
commit e3a53fd
Showing
8 changed files
with
264 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { Server, Request } from 'miragejs'; | ||
import { Response } from 'miragejs'; | ||
import type { SamlPreferences, SamlPreferencesExtractedData } from '@/Interface'; | ||
import { faker } from '@faker-js/faker'; | ||
import type { AppSchema } from '@/__tests__/server/types'; | ||
import { jsonParse } from 'n8n-workflow'; | ||
|
||
let samlConfig: SamlPreferences & SamlPreferencesExtractedData = { | ||
metadata: '<?xml version="1.0"?>', | ||
metadataUrl: '', | ||
entityID: faker.internet.url(), | ||
returnUrl: faker.internet.url(), | ||
}; | ||
|
||
export function routesForSSO(server: Server) { | ||
server.get('/rest/sso/saml/config', () => { | ||
return new Response(200, {}, { data: samlConfig }); | ||
}); | ||
|
||
server.post('/rest/sso/saml/config', (schema: AppSchema, request: Request) => { | ||
const requestBody = jsonParse(request.requestBody) as Partial< | ||
SamlPreferences & SamlPreferencesExtractedData | ||
>; | ||
|
||
samlConfig = { | ||
...samlConfig, | ||
...requestBody, | ||
}; | ||
|
||
return new Response(200, {}, { data: samlConfig }); | ||
}); | ||
|
||
server.get('/rest/sso/saml/config/test', () => { | ||
return new Response(200, {}, { data: '<?xml version="1.0"?>' }); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.