-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format code and enforce code style on PR (#527)
* Format code and enforce code style on PR * Use line length of 100
- Loading branch information
Showing
28 changed files
with
3,748 additions
and
2,935 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
"prettier" | ||
], | ||
"rules": { | ||
"no-console": "warn", | ||
"prettier/prettier": "warn" | ||
"no-console": "warn" | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
{} | ||
{ | ||
"printWidth": 100 | ||
} |
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 |
---|---|---|
@@ -1,41 +1,47 @@ | ||
// This will help generate signing info for test cases. | ||
// Simply fill in the data and run it to get <DigestValue /> and <SignatureValue />. | ||
|
||
const crypto = require('crypto') | ||
const crypto = require("crypto"); | ||
|
||
const private_key = `-----BEGIN PRIVATE KEY----- | ||
-----END PRIVATE KEY----- | ||
` | ||
`; | ||
|
||
const cert = `-----BEGIN CERTIFICATE----- | ||
-----END CERTIFICATE----- | ||
` | ||
`; | ||
|
||
const saml_message = `` | ||
const saml_message = ``; | ||
|
||
const signed_info = `<SignedInfo...</SignedInfo>` | ||
const signed_info = `<SignedInfo...</SignedInfo>`; | ||
|
||
const signer = crypto.createSign('RSA-SHA1'); | ||
const signer = crypto.createSign("RSA-SHA1"); | ||
signer.update(signed_info); | ||
signer.end(); | ||
|
||
const signature = signer.sign(private_key) | ||
const signature_b64 = signature.toString('base64') | ||
|
||
const verifier = crypto.createVerify('RSA-SHA1') | ||
verifier.update(signed_info) | ||
verifier.end() | ||
|
||
const verified = verifier.verify(cert, signature) | ||
|
||
const hash = crypto.createHash('RSA-SHA1') | ||
hash.update(saml_message, 'utf8') | ||
const digest_b64 = hash.digest('base64') | ||
|
||
console.log(JSON.stringify({ | ||
signature: signature_b64, | ||
digest: digest_b64, | ||
verified: verified, | ||
}, null, 2)) | ||
const signature = signer.sign(private_key); | ||
const signature_b64 = signature.toString("base64"); | ||
|
||
const verifier = crypto.createVerify("RSA-SHA1"); | ||
verifier.update(signed_info); | ||
verifier.end(); | ||
|
||
const verified = verifier.verify(cert, signature); | ||
|
||
const hash = crypto.createHash("RSA-SHA1"); | ||
hash.update(saml_message, "utf8"); | ||
const digest_b64 = hash.digest("base64"); | ||
|
||
console.log( | ||
JSON.stringify( | ||
{ | ||
signature: signature_b64, | ||
digest: digest_b64, | ||
verified: verified, | ||
}, | ||
null, | ||
2 | ||
) | ||
); |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import * as MultiSAMLStrategy from './lib/passport-saml/multiSamlStrategy'; | ||
export = MultiSAMLStrategy; | ||
import * as MultiSAMLStrategy from "./lib/passport-saml/multiSamlStrategy"; | ||
export = MultiSAMLStrategy; |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
const MultiSamlStrategy = require('./lib/passport-saml/multiSamlStrategy.js'); | ||
const MultiSamlStrategy = require("./lib/passport-saml/multiSamlStrategy.js"); | ||
module.exports = MultiSamlStrategy; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import * as crypto from 'crypto'; | ||
import * as crypto from "crypto"; | ||
|
||
export function getSigningAlgorithm (shortName: string): string { | ||
switch(shortName) { | ||
case 'sha256': | ||
return 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'; | ||
case 'sha512': | ||
return 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512'; | ||
export function getSigningAlgorithm(shortName: string): string { | ||
switch (shortName) { | ||
case "sha256": | ||
return "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"; | ||
case "sha512": | ||
return "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"; | ||
default: | ||
return 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'; | ||
return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; | ||
} | ||
} | ||
|
||
export function getDigestAlgorithm (shortName: string): string { | ||
switch(shortName) { | ||
case 'sha256': | ||
return 'http://www.w3.org/2001/04/xmlenc#sha256'; | ||
case 'sha512': | ||
return 'http://www.w3.org/2001/04/xmlenc#sha512'; | ||
export function getDigestAlgorithm(shortName: string): string { | ||
switch (shortName) { | ||
case "sha256": | ||
return "http://www.w3.org/2001/04/xmlenc#sha256"; | ||
case "sha512": | ||
return "http://www.w3.org/2001/04/xmlenc#sha512"; | ||
default: | ||
return 'http://www.w3.org/2000/09/xmldsig#sha1'; | ||
return "http://www.w3.org/2000/09/xmldsig#sha1"; | ||
} | ||
} | ||
|
||
export function getSigner (shortName: string): crypto.Signer { | ||
switch(shortName) { | ||
case 'sha256': | ||
return crypto.createSign('RSA-SHA256'); | ||
case 'sha512': | ||
return crypto.createSign('RSA-SHA512'); | ||
export function getSigner(shortName: string): crypto.Signer { | ||
switch (shortName) { | ||
case "sha256": | ||
return crypto.createSign("RSA-SHA256"); | ||
case "sha512": | ||
return crypto.createSign("RSA-SHA512"); | ||
default: | ||
return crypto.createSign('RSA-SHA1'); | ||
return crypto.createSign("RSA-SHA1"); | ||
} | ||
} |
Oops, something went wrong.