Compare commits

...

2 Commits

Author SHA1 Message Date
cf02c3a769 removed un-needed files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-05-25 23:30:44 +01:00
cef2e3bf09 add helper to ease with generating requests 2024-05-25 23:30:26 +01:00
2 changed files with 17 additions and 3 deletions

View File

@ -1,3 +0,0 @@
{
}

View 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);