saml id cannot start with a number - http://books.xmlschemata.org/relaxng/ch19-77215.html (#77)
This commit is contained in:
parent
d1811b5d9b
commit
5134718b2c
@ -6,6 +6,9 @@ import saml from '@boxyhq/saml20';
|
|||||||
const responseXPath =
|
const responseXPath =
|
||||||
'/*[local-name(.)="Response" and namespace-uri(.)="urn:oasis:names:tc:SAML:2.0:protocol"]';
|
'/*[local-name(.)="Response" and namespace-uri(.)="urn:oasis:names:tc:SAML:2.0:protocol"]';
|
||||||
|
|
||||||
|
const randomId = () => {
|
||||||
|
return '_' + crypto.randomBytes(10).toString('hex');
|
||||||
|
};
|
||||||
const createResponseXML = async (params: {
|
const createResponseXML = async (params: {
|
||||||
idpIdentityId: string;
|
idpIdentityId: string;
|
||||||
audience: string;
|
audience: string;
|
||||||
@ -78,7 +81,7 @@ const createResponseXML = async (params: {
|
|||||||
'samlp:Response': {
|
'samlp:Response': {
|
||||||
'@xmlns:samlp': 'urn:oasis:names:tc:SAML:2.0:protocol',
|
'@xmlns:samlp': 'urn:oasis:names:tc:SAML:2.0:protocol',
|
||||||
'@Version': '2.0',
|
'@Version': '2.0',
|
||||||
'@ID': crypto.randomBytes(10).toString('hex'),
|
'@ID': randomId(),
|
||||||
'@Destination': acsUrl,
|
'@Destination': acsUrl,
|
||||||
'@InResponseTo': inResponseTo,
|
'@InResponseTo': inResponseTo,
|
||||||
'@IssueInstant': authTimestamp,
|
'@IssueInstant': authTimestamp,
|
||||||
@ -95,7 +98,7 @@ const createResponseXML = async (params: {
|
|||||||
'saml:Assertion': {
|
'saml:Assertion': {
|
||||||
'@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
|
'@xmlns:saml': 'urn:oasis:names:tc:SAML:2.0:assertion',
|
||||||
'@Version': '2.0',
|
'@Version': '2.0',
|
||||||
'@ID': crypto.randomBytes(10).toString('hex'),
|
'@ID': randomId(),
|
||||||
'@IssueInstant': authTimestamp,
|
'@IssueInstant': authTimestamp,
|
||||||
'saml:Issuer': {
|
'saml:Issuer': {
|
||||||
'#text': idpIdentityId,
|
'#text': idpIdentityId,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user