Skip to content

Commit af483a0

Browse files
committed
tngan#274 Export without default
1 parent e1bbdc5 commit af483a0

File tree

6 files changed

+42
-35
lines changed

6 files changed

+42
-35
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ Starting from v2.6, multiple schema validators are now supported. You can simply
2222

2323
```js
2424
import samlify = require('samlify');
25-
import validator from '@authenio/samlify-xsd-schema-validator';
26-
// import validator from '@authenio/samlify-validate-with-xmllint';
27-
// import validator from '@authenio/samlify-node-xmllint';
28-
// import validator from '@authenio/samlify-libxml-xsd'; // only support for version of nodejs <= 8
25+
import * as validator from '@authenio/samlify-xsd-schema-validator';
26+
// import * as validator from '@authenio/samlify-validate-with-xmllint';
27+
// import * as validator from '@authenio/samlify-node-xmllint';
28+
// import * as validator from '@authenio/samlify-libxml-xsd'; // only support for version of nodejs <= 8
29+
30+
// const validator = require('@authenio/samlify-xsd-schema-validator');
31+
// const validator = require('@authenio/samlify-validate-with-xmllint');
32+
// const validator = require('@authenio/samlify-node-xmllint');
33+
// const validator = require('@authenio/samlify-libxml-xsd');
2934

3035
samlify.setSchemaValidator(validator);
3136
```

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "samlify",
3-
"version": "2.6.0-rc1",
3+
"version": "2.6.0-rc2",
44
"description": "High-level API for Single Sign On (SAML 2.0)",
55
"main": "build/index.js",
66
"keywords": [
@@ -46,10 +46,10 @@
4646
"xpath": "^0.0.27"
4747
},
4848
"devDependencies": {
49-
"@authenio/samlify-xsd-schema-validator": "^1.0.1",
50-
"@authenio/samlify-validate-with-xmllint": "^1.0.0",
51-
"@authenio/samlify-node-xmllint": "^1.0.0",
52-
"@authenio/samlify-libxml-xsd": "^1.0.0",
49+
"@authenio/samlify-xsd-schema-validator": "^1.0.2",
50+
"@authenio/samlify-validate-with-xmllint": "^1.0.1",
51+
"@authenio/samlify-node-xmllint": "^1.0.1",
52+
"@authenio/samlify-libxml-xsd": "^1.0.1",
5353
"@types/camelcase": "^5.2.0",
5454
"@types/node": "^11.11.3",
5555
"@types/node-forge": "^0.7.4",

src/libsaml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ const libSaml = () => {
235235
*/
236236
attributeStatementBuilder(attributes: LoginResponseAttribute[]): string {
237237
const attr = attributes.map(({ name, nameFormat, valueTag, valueXsiType, valueXmlnsXs, valueXmlnsXsi }) => {
238-
const defaultValueXmlnsXs = 'http://www.w3.org/2001/XMLSchema'
239-
const defaultValueXmlnsXsi = 'http://www.w3.org/2001/XMLSchema-instance'
238+
const defaultValueXmlnsXs = 'http://www.w3.org/2001/XMLSchema';
239+
const defaultValueXmlnsXsi = 'http://www.w3.org/2001/XMLSchema-instance';
240240
return `<saml:Attribute Name="${name}" NameFormat="${nameFormat}"><saml:AttributeValue xmlns:xs="${valueXmlnsXs ? valueXmlnsXs : defaultValueXmlnsXs}" xmlns:xsi="${valueXmlnsXsi ? valueXmlnsXsi : defaultValueXmlnsXsi}" xsi:type="${valueXsiType}">{${tagging('attr', valueTag)}}</saml:AttributeValue></saml:Attribute>`;
241241
}).join('');
242242
return `<saml:AttributeStatement>${attr}</saml:AttributeStatement>`;

test/flow.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ import { PostBindingContext } from '../src/entity';
55
import * as uuid from 'uuid';
66
import * as url from 'url';
77
import util from '../src/utility';
8-
import validator from '@authenio/samlify-xsd-schema-validator';
9-
// import validator from '@authenio/samlify-validate-with-xmllint';
10-
// import validator from '@authenio/samlify-node-xmllint';
11-
// import validator from '@authenio/samlify-libxml-xsd';
8+
9+
import * as validator from '@authenio/samlify-xsd-schema-validator';
10+
// import * as validator from '@authenio/samlify-validate-with-xmllint';
11+
// import * as validator from '@authenio/samlify-node-xmllint';
12+
// import * as validator from '@authenio/samlify-libxml-xsd';
13+
14+
// const validator = require('@authenio/samlify-xsd-schema-validator');
15+
// const validator = require('@authenio/samlify-validate-with-xmllint');
16+
// const validator = require('@authenio/samlify-node-xmllint');
17+
// const validator = require('@authenio/samlify-libxml-xsd');
1218

1319
esaml2.setSchemaValidator(validator);
1420

@@ -33,6 +39,8 @@ const loginResponseTemplate = {
3339
],
3440
};
3541

42+
const failedResponse: string = String(readFileSync('./test/misc/failed_response.xml'));
43+
3644
const createTemplateCallback = (_idp, _sp, user) => template => {
3745
const _id = '_8e8dc5f69a98cc4c1ff3427e5ce34606fd672f91e6';
3846
const now = new Date();
@@ -659,7 +667,6 @@ test('should reject signature wrapped response - case 2', async t => {
659667
});
660668

661669
test('should throw two-tiers code error when the response does not return success status', async t => {
662-
const failedResponse: string = String(readFileSync('./test/misc/failed_response.xml'));
663670
try {
664671
const _result = await sp.parseLoginResponse(idpNoEncrypt, 'post', { body: { SAMLResponse: utility.base64Encode(failedResponse) } });
665672
} catch (e) {

tslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"ordered-imports": false,
2929
"quotemark": [true, "single", "avoid-escape", "avoid-template"],
3030
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
31-
"interface-over-type-literal": false
31+
"interface-over-type-literal": false,
32+
"no-var-requires": false
3233
},
3334
"jsRules": {}
3435
}

yarn.lock

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
# yarn lockfile v1
33

44

5-
"@authenio/samlify-libxml-xsd@^1.0.0":
6-
version "1.0.0"
7-
resolved "https://registry.yarnpkg.com/@authenio/samlify-libxml-xsd/-/samlify-libxml-xsd-1.0.0.tgz#0795248729ec4c1fb7bb259d859ce4be4343b830"
5+
"@authenio/samlify-libxml-xsd@^1.0.1":
6+
version "1.0.1"
7+
resolved "https://registry.yarnpkg.com/@authenio/samlify-libxml-xsd/-/samlify-libxml-xsd-1.0.1.tgz#4d15fc66ac76c4b852d1985f07c3d765fd6d497e"
88
dependencies:
99
libxml-xsd "^0.5.2"
1010

11-
"@authenio/samlify-node-xmllint@^1.0.0":
12-
version "1.0.0"
13-
resolved "https://registry.yarnpkg.com/@authenio/samlify-node-xmllint/-/samlify-node-xmllint-1.0.0.tgz#1633baae0f8c749e62bf2dc2365cca9610b68031"
11+
"@authenio/samlify-node-xmllint@^1.0.1":
12+
version "1.0.1"
13+
resolved "https://registry.yarnpkg.com/@authenio/samlify-node-xmllint/-/samlify-node-xmllint-1.0.1.tgz#325659eed8b561fcdc2a15e187b8f052fbb7c172"
1414
dependencies:
1515
node-xmllint "^1.0.0"
1616

17-
"@authenio/samlify-validate-with-xmllint@^1.0.0":
18-
version "1.0.0"
19-
resolved "https://registry.yarnpkg.com/@authenio/samlify-validate-with-xmllint/-/samlify-validate-with-xmllint-1.0.0.tgz#6ea47cacc234963769bed21388df48fec45962f6"
17+
"@authenio/samlify-validate-with-xmllint@^1.0.1":
18+
version "1.0.1"
19+
resolved "https://registry.yarnpkg.com/@authenio/samlify-validate-with-xmllint/-/samlify-validate-with-xmllint-1.0.1.tgz#9fdf4e44e657e6863e32acc33bdeaff59276459a"
2020
dependencies:
2121
validate-with-xmllint "^1.0.2"
2222

23-
"@authenio/samlify-xsd-schema-validator@^1.0.1":
24-
version "1.0.1"
25-
resolved "https://registry.yarnpkg.com/@authenio/samlify-xsd-schema-validator/-/samlify-xsd-schema-validator-1.0.1.tgz#940d641cf6b4959e0dc9a850c789c10edbe9d1dd"
23+
"@authenio/samlify-xsd-schema-validator@^1.0.2":
24+
version "1.0.2"
25+
resolved "https://registry.yarnpkg.com/@authenio/samlify-xsd-schema-validator/-/samlify-xsd-schema-validator-1.0.2.tgz#ba150e1e04cce71093941c715a873f4d0b76e606"
2626
dependencies:
2727
"@authenio/xsd-schema-validator" "^0.7.1"
2828

@@ -987,7 +987,6 @@ commander@^2.12.1:
987987
commander@~2.20.0:
988988
version "2.20.0"
989989
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
990-
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
991990

992991
common-path-prefix@^1.0.0:
993992
version "1.0.0"
@@ -1655,7 +1654,6 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2:
16551654
handlebars@^4.0.3:
16561655
version "4.1.2"
16571656
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.1.2.tgz#b6b37c1ced0306b221e094fc7aca3ec23b131b67"
1658-
integrity sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==
16591657
dependencies:
16601658
neo-async "^2.6.0"
16611659
optimist "^0.6.1"
@@ -2130,7 +2128,6 @@ js-tokens@^3.0.2:
21302128
js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.7.0:
21312129
version "3.13.1"
21322130
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
2133-
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
21342131
dependencies:
21352132
argparse "^1.0.7"
21362133
esprima "^4.0.0"
@@ -2591,7 +2588,6 @@ needle@^2.2.1:
25912588
neo-async@^2.6.0:
25922589
version "2.6.1"
25932590
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
2594-
integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==
25952591

25962592
node-forge@^0.7.4, node-forge@^0.7.5:
25972593
version "0.7.6"
@@ -3722,7 +3718,6 @@ typescript@^3.4.5:
37223718
uglify-js@^3.1.4:
37233719
version "3.6.0"
37243720
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5"
3725-
integrity sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==
37263721
dependencies:
37273722
commander "~2.20.0"
37283723
source-map "~0.6.1"
@@ -3841,7 +3836,6 @@ validate-npm-package-license@^3.0.1:
38413836
validate-with-xmllint@^1.0.2:
38423837
version "1.0.2"
38433838
resolved "https://registry.yarnpkg.com/validate-with-xmllint/-/validate-with-xmllint-1.0.2.tgz#7cf0010fa58d74ffffbd13f388a54210eaf2322b"
3844-
integrity sha512-CvyrXE7y0fxqWDXbo4y2lsa1hLnD6j/ojDxVW6+FzBN0hr8agl71tznsVHpyNqmaB9k6Akxx/GzEe8WSl3zxnw==
38453839

38463840
38473841
version "1.10.0"

0 commit comments

Comments
 (0)