Skip to content

Commit 4646240

Browse files
author
Eva Sarafianou
committed
docs(readme): Document createUnsignedAssertion()
1 parent 7ee7984 commit 4646240

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Create SAML assertions. Supports SAML 1.1 and SAML 2.0 tokens.
66

77
### Usage
88

9+
#### Signed Assertions
10+
911
```js
1012
var saml = require('saml').Saml20; // or Saml11
1113

@@ -20,14 +22,42 @@ var options = {
2022
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name': 'Foo Bar'
2123
},
2224
nameIdentifier: 'foo',
23-
sessionIndex: '_faed468a-15a0-4668-aed6-3d9c478cc8fa'
25+
sessionIndex: '_faed468a-15a0-4668-aed6-3d9c478cc8fa',
2426
};
2527

26-
var signedAssertion = saml.create(options);
28+
saml.create(options, (err, samlAssertion) => {
29+
if (err) { throw new Error(err) }
30+
console.log(samlAssertion)
31+
})
2732
```
2833

2934
Everything except the cert and key is optional.
3035

36+
#### Unsigned Assertions
37+
38+
```js
39+
var saml = require('saml').Saml20; // or Saml11
40+
41+
var options = {
42+
issuer: 'urn:issuer',
43+
lifetimeInSeconds: 600,
44+
audiences: 'urn:myapp',
45+
attributes: {
46+
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress': '[email protected]',
47+
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name': 'Foo Bar'
48+
},
49+
nameIdentifier: 'foo',
50+
sessionIndex: '_faed468a-15a0-4668-aed6-3d9c478cc8fa',
51+
};
52+
53+
saml.createUnsignedAssertion(options, (err, samlAssertion) => {
54+
if (err) { throw new Error(err) }
55+
console.log(samlAssertion)
56+
})
57+
```
58+
59+
All options are optional
60+
3161
## Issue Reporting
3262

3363
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.

0 commit comments

Comments
 (0)