-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Buffer constructor usage to Buffer.from function (#339)
- Loading branch information
1 parent
0c0bc33
commit 16ded23
Showing
5 changed files
with
13 additions
and
13 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
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 |
---|---|---|
|
@@ -623,7 +623,7 @@ test('should reject signature wrapped response - case 1', async t => { | |
const user = { email: '[email protected]' }; | ||
const { id, context: SAMLResponse } = await idpNoEncrypt.createLoginResponse(sp, sampleRequestInfo, 'post', user, createTemplateCallback(idpNoEncrypt, sp, user)); | ||
//Decode | ||
const buffer = new Buffer(SAMLResponse, 'base64'); | ||
const buffer = Buffer.from(SAMLResponse, 'base64'); | ||
const xml = buffer.toString(); | ||
//Create version of response without signature | ||
const stripped = xml | ||
|
@@ -634,7 +634,7 @@ test('should reject signature wrapped response - case 1', async t => { | |
.replace('[email protected]', '[email protected]'); | ||
//Put stripped version under SubjectConfirmationData of modified version | ||
const xmlWrapped = outer.replace(/<saml:SubjectConfirmationData[^>]*\/>/, '<saml:SubjectConfirmationData>' + stripped.replace('<?xml version="1.0" encoding="UTF-8"?>', '') + '</saml:SubjectConfirmationData>'); | ||
const wrappedResponse = new Buffer(xmlWrapped).toString('base64'); | ||
const wrappedResponse = Buffer.from(xmlWrapped).toString('base64'); | ||
try { | ||
await sp.parseLoginResponse(idpNoEncrypt, 'post', { body: { SAMLResponse: wrappedResponse } }); | ||
} catch (e) { | ||
|
@@ -647,7 +647,7 @@ test('should reject signature wrapped response - case 2', async t => { | |
const user = { email: '[email protected]' }; | ||
const { id, context: SAMLResponse } = await idpNoEncrypt.createLoginResponse(sp, sampleRequestInfo, 'post', user, createTemplateCallback(idpNoEncrypt, sp, user)); | ||
//Decode | ||
const buffer = new Buffer(SAMLResponse, 'base64'); | ||
const buffer = Buffer.from(SAMLResponse, 'base64'); | ||
const xml = buffer.toString(); | ||
//Create version of response without signature | ||
const stripped = xml | ||
|
@@ -658,7 +658,7 @@ test('should reject signature wrapped response - case 2', async t => { | |
.replace('[email protected]', '[email protected]'); | ||
//Put stripped version under SubjectConfirmationData of modified version | ||
const xmlWrapped = outer.replace(/<\/saml:Conditions>/, '</saml:Conditions><saml:Advice>' + stripped.replace('<?xml version="1.0" encoding="UTF-8"?>', '') + '</saml:Advice>'); | ||
const wrappedResponse = new Buffer(xmlWrapped).toString('base64'); | ||
const wrappedResponse = Buffer.from(xmlWrapped).toString('base64'); | ||
try { | ||
const result = await sp.parseLoginResponse(idpNoEncrypt, 'post', { body: { SAMLResponse: wrappedResponse } }); | ||
} catch (e) { | ||
|
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