Compare commits
2 Commits
59ff73e032
...
cf02c3a769
Author | SHA1 | Date | |
---|---|---|---|
cf02c3a769 | |||
cef2e3bf09 |
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
|
|
||||||
}
|
|
17
helpers/requestGenerator.js
Normal file
17
helpers/requestGenerator.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const zlib = require('zlib');
|
||||||
|
|
||||||
|
const ISSUER = 'https://sp.example.com';
|
||||||
|
const REQUEST_ID = 'SSO_TOOLS_REQUEST_' + Math.random().toString(36).substr(2, 9);
|
||||||
|
|
||||||
|
const loginRequest = `<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="${REQUEST_ID}" Version="2.0" ProviderName="SP test" IssueInstant="2024-05-25T23:15:00Z" Destination="https://idp.example.com" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST">
|
||||||
|
<saml:Issuer>${ISSUER}</saml:Issuer>
|
||||||
|
<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" AllowCreate="true"/>
|
||||||
|
<samlp:RequestedAuthnContext Comparison="exact">
|
||||||
|
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
|
||||||
|
</samlp:RequestedAuthnContext>
|
||||||
|
</samlp:AuthnRequest>`;
|
||||||
|
|
||||||
|
const deflatedRequest = zlib.deflateRawSync(Buffer.from(loginRequest)).toString('base64');
|
||||||
|
const encodedRequest = encodeURIComponent(deflatedRequest);
|
||||||
|
|
||||||
|
console.log(encodedRequest);
|
Loading…
Reference in New Issue
Block a user