You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-47
Original file line number
Diff line number
Diff line change
@@ -104,15 +104,13 @@ passport.use(
104
104
);
105
105
```
106
106
107
-
The options passed when the `MultiSamlStrategy` is initialized are also passed as default values to each provider.
108
-
e.g. If you provide an `issuer` on `MultiSamlStrategy`, this will be also a default value for every provider.
109
-
You can override these defaults by passing a new value through the `getSamlOptions` function.
107
+
The options passed when the `MultiSamlStrategy` is initialized are also passed as default values to each provider. e.g. If you provide an `issuer` on `MultiSamlStrategy`, this will be also a default value for every provider. You can override these defaults by passing a new value through the `getSamlOptions` function.
110
108
111
109
Using multiple providers supports `validateInResponseTo`, but all the `InResponse` values are stored on the same Cache. This means, if you're using the default `InMemoryCache`, that all providers have access to it and a provider might get its response validated against another's request. [Issue Report](!https://github.com/node-saml/passport-saml/issues/334). To amend this you should provide a different cache provider per SAML provider, through the `getSamlOptions` function.
112
110
113
-
> :warning:**There's a race condition [bug](https://github.com/node-saml/passport-saml/issues/425) in versions < 1.3.3 which makes it vulnerable to DOS attacks**: Please use > 1.3.3 if you want to use this issue
111
+
Please note that in the above examples, `findProvider()`, `findByNameId()`, and `findByEmail()` are an examples of functions you need to implement yourself. These are just examples. You can implement this functionality any way you see fit. Please note that calling `getSamlOptions()` should result in `done()` being called with a proper SAML Configuration (see the TypeScript typings for more information) and the `done()` callbacks for the second and third arguments should be called with an object that represents the user.
114
112
115
-
#### The profile object:
113
+
#### The profile object
116
114
117
115
The profile object referenced above contains the following:
118
116
@@ -135,9 +133,9 @@ export interface Profile {
135
133
}
136
134
```
137
135
138
-
#### Config parameter details:
136
+
#### Config parameter details
139
137
140
-
**Core**
138
+
##### **Core**
141
139
142
140
-`callbackUrl`: full callbackUrl (overrides path/protocol if supplied)
143
141
-`path`: path to callback; will be combined with protocol and server host information to construct callback url if `callbackUrl` is not specified (default: `/saml/consume`)
@@ -153,7 +151,7 @@ export interface Profile {
153
151
-`digestAlgorithm`: optionally set the digest algorithm used to provide a digest for the signed data object, valid values are 'sha1' (default), 'sha256', or 'sha512'
154
152
-`xmlSignatureTransforms`: optionally set an array of signature transforms to be used in HTTP-POST signatures. By default this is `[ 'http://www.w3.org/2000/09/xmldsig#enveloped-signature', 'http://www.w3.org/2001/10/xml-exc-c14n#' ]`
155
153
156
-
**Additional SAML behaviors**
154
+
##### **Additional SAML behaviors**
157
155
158
156
-`additionalParams`: dictionary of additional query params to add to all requests; if an object with this key is passed to `authenticate`, the dictionary of additional query params will be appended to those present on the returned URL, overriding any specified by initialization options' additional parameters (`additionalParams`, `additionalAuthorizeParams`, and `additionalLogoutParams`)
159
157
-`additionalAuthorizeParams`: dictionary of additional query params to add to 'authorize' requests
@@ -174,7 +172,7 @@ export interface Profile {
174
172
-`skipRequestCompression`: if set to true, the SAML request from the service provider won't be compressed.
175
173
-`authnRequestBinding`: if set to `HTTP-POST`, will request authentication from IDP via HTTP POST binding, otherwise defaults to HTTP Redirect
176
174
-`disableRequestAcsUrl`: if truthy, SAML AuthnRequest from the service provider will not include the optional AssertionConsumerServiceURL. Default is falsy so it is automatically included.
177
-
-`scoping`: An optional configuration which implements the functionality [explained in the SAML spec paragraph "3.4.1.2 Element <Scoping>"](https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf). The config object is structured as following:
175
+
-`scoping`: An optional configuration which implements the functionality [explained in the SAML spec paragraph "3.4.1.2 Element \<Scoping\>"](https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf). The config object is structured as following:
178
176
179
177
```javascript
180
178
{
@@ -195,24 +193,24 @@ export interface Profile {
195
193
};
196
194
```
197
195
198
-
**InResponseTo Validation**
196
+
##### **InResponseTo Validation**
199
197
200
198
-`validateInResponseTo`: if truthy, then InResponseTo will be validated from incoming SAML responses
201
199
-`requestIdExpirationPeriodMs`: Defines the expiration time when a Request ID generated for a SAML request will not be valid if seen in a SAML response in the `InResponseTo` field. Default is 8 hours.
202
200
-`cacheProvider`: Defines the implementation for a cache provider used to store request Ids generated in SAML requests as part of `InResponseTo` validation. Default is a built-in in-memory cache provider. For details see the 'Cache Provider' section.
203
201
204
-
**Issuer Validation**
202
+
##### **Issuer Validation**
205
203
206
204
-`idpIssuer`: if provided, then the IdP issuer will be validated for incoming Logout Requests/Responses. For ADFS this looks like `https://acme_tools.windows.net/deadbeef`
207
205
208
-
**Passport**
206
+
##### **Passport**
209
207
210
208
-`passReqToCallback`: if truthy, `req` will be passed as the first argument to the verify callback (default: `false`)
211
209
-`name`: Optionally, provide a custom name. (default: `saml`). Useful If you want to instantiate the strategy multiple times with different configurations,
212
210
allowing users to authenticate against multiple different SAML targets from the same site. You'll need to use a unique set of URLs
213
211
for each target, and use this custom name when calling `passport.authenticate()` as well.
214
212
215
-
**Logout**
213
+
##### **Logout**
216
214
217
215
-`logoutUrl`: base address to call with logout requests (default: `entryPoint`)
218
216
-`additionalLogoutParams`: dictionary of additional query params to add to 'logout' requests
@@ -300,26 +298,26 @@ Formats supported for `privateKey` field are,
300
298
301
299
1. Well formatted PEM:
302
300
303
-
```text
304
-
-----BEGIN PRIVATE KEY-----
305
-
<private key contents here delimited at 64 characters per row>
306
-
-----END PRIVATE KEY-----
301
+
```text
302
+
-----BEGIN PRIVATE KEY-----
303
+
<private key contents here delimited at 64 characters per row>
304
+
-----END PRIVATE KEY-----
307
305
308
-
```
306
+
```
309
307
310
-
```text
311
-
-----BEGIN RSA PRIVATE KEY-----
312
-
<private key contents here delimited at 64 characters per row>
313
-
-----END RSA PRIVATE KEY-----
308
+
```text
309
+
-----BEGIN RSA PRIVATE KEY-----
310
+
<private key contents here delimited at 64 characters per row>
311
+
-----END RSA PRIVATE KEY-----
314
312
315
-
```
313
+
```
316
314
317
-
(both versions work)
318
-
See example from tests of the first version of [well formatted private key](test/static/acme_tools_com.key).
315
+
(both versions work)
316
+
See example from tests of the first version of [well formatted private key](test/static/acme_tools_com.key).
319
317
320
-
2. Alternativelly a single line private key without start/end lines where all rows are joined into single line:
318
+
1. Alternativelly a single line private key without start/end lines where all rows are joined into single line:
321
319
322
-
See example from tests of [singleline private key](test/static/singleline_acme_tools_com.key).
320
+
See example from tests of [singleline private key](test/static/singleline_acme_tools_com.key).
323
321
324
322
Add it to strategy options like this:
325
323
@@ -372,33 +370,23 @@ For more detailed instructions, see [ADFS documentation](docs/adfs/README.md).
372
370
373
371
## SAML Response Validation - NotBefore and NotOnOrAfter
374
372
375
-
If the `NotBefore` or the `NotOnOrAfter` attributes are returned in the SAML response, Passport-SAML will validate them
376
-
against the current time +/- a configurable clock skew value. The default for the skew is 0s. This is to account for
377
-
differences between the clock time on the client (Node server with Passport-SAML) and the server (Identity provider).
373
+
If the `NotBefore` or the `NotOnOrAfter` attributes are returned in the SAML response, Passport-SAML will validate them against the current time +/- a configurable clock skew value. The default for the skew is 0s. This is to account for differences between the clock time on the client (Node server with Passport-SAML) and the server (Identity provider).
378
374
379
-
`NotBefore` and `NotOnOrAfter` can be part of either the `SubjectConfirmation` element, or within in the `Assertion/Conditions` element
380
-
in the SAML response.
375
+
`NotBefore` and `NotOnOrAfter` can be part of either the `SubjectConfirmation` element, or within in the `Assertion/Conditions` element in the SAML response.
381
376
382
377
## Subject confirmation validation
383
378
384
-
When configured (turn `validateInResponseTo` to `true` in the Passport-SAML config), the `InResponseTo` attribute will be validated.
385
-
Validation will succeed if Passport-SAML previously generated a SAML request with an id that matches the value of `InResponseTo`.
379
+
When configured (turn `validateInResponseTo` to `true` in the Passport-SAML config), the `InResponseTo` attribute will be validated. Validation will succeed if Passport-SAML previously generated a SAML request with an id that matches the value of `InResponseTo`.
386
380
387
-
Also note that `InResponseTo` is validated as an attribute of the top level `Response` element in the SAML response, as well
388
-
as part of the `SubjectConfirmation` element.
381
+
Also note that `InResponseTo` is validated as an attribute of the top level `Response` element in the SAML response, as well as part of the `SubjectConfirmation` element.
389
382
390
-
Previous request id's generated for SAML requests will eventually expire. This is controlled with the `requestIdExpirationPeriodMs` option
391
-
passed into the Passport-SAML config. The default is 28,800,000 ms (8 hours). Once expired, a subsequent SAML response
392
-
received with an `InResponseTo` equal to the expired id will not validate and an error will be returned.
383
+
Previous request id's generated for SAML requests will eventually expire. This is controlled with the `requestIdExpirationPeriodMs` option passed into the Passport-SAML config. The default is 28,800,000 ms (8 hours). Once expired, a subsequent SAML response received with an `InResponseTo` equal to the expired id will not validate and an error will be returned.
393
384
394
385
## Cache Provider
395
386
396
-
When `InResponseTo` validation is turned on, Passport-SAML will store generated request ids used in SAML requests to the IdP. The implementation
397
-
of how things are stored, checked to see if they exist, and eventually removed is from the Cache Provider used by Passport-SAML.
387
+
When `InResponseTo` validation is turned on, Passport-SAML will store generated request ids used in SAML requests to the IdP. The implementation of how things are stored, checked to see if they exist, and eventually removed is from the Cache Provider used by Passport-SAML.
398
388
399
-
The default implementation is a simple in-memory cache provider. For multiple server/process scenarios, this will not be sufficient as
400
-
the server/process that generated the request id and stored in memory could be different than the server/process handling the
401
-
SAML response. The `InResponseTo` could fail in this case erroneously.
389
+
The default implementation is a simple in-memory cache provider. For multiple server/process scenarios, this will not be sufficient as the server/process that generated the request id and stored in memory could be different than the server/process handling the SAML response. The `InResponseTo` could fail in this case erroneously.
402
390
403
391
To support this scenario you can provide an implementation for a cache provider by providing an object with following functions:
404
392
@@ -436,7 +424,7 @@ See [Releases](https://github.com/node-saml/passport-saml/releases) to find the
436
424
437
425
### Is there an example I can look at?
438
426
439
-
Gerard Braad has provided an example app at https://github.com/gbraad/passport-saml-example/
427
+
Gerard Braad has provided an example app at <https://github.com/gbraad/passport-saml-example/>
440
428
441
429
## Node Support Policy
442
430
@@ -452,9 +440,12 @@ We will accept code that allows this package to run on newer, non-LTS, versions
452
440
453
441
## Project History
454
442
455
-
The project was started by @bergie in 2012 based on Michael Bosworth's [express-saml](https://github.com/bozzltron/express-saml) library. From 2014 - 2016, @ploer served as primary maintainer.
456
-
@markstos served the primary maintainer from 2017 till 2020 when he created the node-saml organization. With a goal to create a team of maintainers, invitations were sent to major contributors and fork authors to work together to maintain all the improvements in one place.
443
+
The project was started by @bergie in 2012 based on Michael Bosworth's [express-saml](https://github.com/bozzltron/express-saml) library. From 2014 - 2016, @ploer served as primary maintainer. @markstos served the primary maintainer from 2017 till 2020 when he created the node-saml organization. With a goal to create a team of maintainers, invitations were sent to major contributors and fork authors to work together to maintain all the improvements in one place.
457
444
458
445
Since 2020, @cjbath emerged as the primary maintainer, with major contributions from @gugu and @zoellner. Major updates from the team included rewriting the project in TypeScript and splitting off a `node-saml` module which can be used without Passport. Almost 100 other developers have contributed improvements to the project.
459
446
460
447
The project continues to be maintained by volunteers. Contributions small and large are welcome.
0 commit comments