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
This is a [SAML 2.0](http://en.wikipedia.org/wiki/SAML_2.0) authentication provider for [Passport](http://passportjs.org/), the Node.js authentication library.
6
8
@@ -10,9 +12,9 @@ Passport-SAML has been tested to work with Onelogin, Okta, Shibboleth, [SimpleSA
10
12
11
13
## Installation
12
14
13
-
$ npm install passport-saml
14
-
15
-
/
15
+
```shell
16
+
npm install passport-saml
17
+
```
16
18
17
19
## Usage
18
20
@@ -88,27 +90,28 @@ Using multiple providers supports `validateInResponseTo`, but all the `InRespons
88
90
The profile object referenced above contains the following:
-`callbackUrl`: full callbackUrl (overrides path/protocol if supplied)
113
116
-`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`)
114
117
-`protocol`: protocol for callback; will be combined with path and server host information to construct callback url if `callbackUrl` is not specified (default: `http://`)
@@ -122,7 +125,9 @@ type Profile = {
122
125
-`signatureAlgorithm`: optionally set the signature algorithm for signing requests, valid values are 'sha1' (default), 'sha256', or 'sha512'
123
126
-`digestAlgorithm`: optionally set the digest algorithm used to provide a digest for the signed data object, valid values are 'sha1' (default), 'sha256', or 'sha512'
124
127
-`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#' ]`
125
-
-**Additional SAML behaviors**
128
+
129
+
**Additional SAML behaviors**
130
+
126
131
-`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`)
127
132
-`additionalAuthorizeParams`: dictionary of additional query params to add to 'authorize' requests
128
133
-`identifierFormat`: optional name identifier format to request from identity provider (default: `urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress`)
@@ -147,31 +152,38 @@ type Profile = {
147
152
{
148
153
entries: [ // required
149
154
{
150
-
providerId:'yourProviderId', // required for each entry
151
-
name:'yourName', // optional
152
-
loc:'yourLoc', // optional
153
-
}
155
+
providerId:"yourProviderId", // required for each entry
156
+
name:"yourName", // optional
157
+
loc:"yourLoc", // optional
158
+
},
154
159
],
155
-
getComplete:'URI to your complete IDP list', // optional
160
+
getComplete:"URI to your complete IDP list", // optional
156
161
},
157
162
],
158
163
proxyCount:2, // optional
159
-
requesterId:'requesterId', // optional
160
-
}
164
+
requesterId:"requesterId", // optional
165
+
};
161
166
```
162
167
163
-
-**InResponseTo Validation**
168
+
**InResponseTo Validation**
169
+
164
170
-`validateInResponseTo`: if truthy, then InResponseTo will be validated from incoming SAML responses
165
171
-`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.
166
172
-`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.
167
-
-**Issuer Validation**
173
+
174
+
**Issuer Validation**
175
+
168
176
-`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`
169
-
-**Passport**
177
+
178
+
**Passport**
179
+
170
180
-`passReqToCallback`: if truthy, `req` will be passed as the first argument to the verify callback (default: `false`)
171
181
-`name`: Optionally, provide a custom name. (default: `saml`). Useful If you want to instantiate the strategy multiple times with different configurations,
172
182
allowing users to authenticate against multiple different SAML targets from the same site. You'll need to use a unique set of URLs
173
183
for each target, and use this custom name when calling `passport.authenticate()` as well.
174
-
-**Logout**
184
+
185
+
**Logout**
186
+
175
187
-`logoutUrl`: base address to call with logout requests (default: `entryPoint`)
176
188
-`additionalLogoutParams`: dictionary of additional query params to add to 'logout' requests
177
189
-`logoutCallbackUrl`: The value with which to populate the `Location` attribute in the `SingleLogoutService` elements in the generated service provider metadata.
If you have a certificate in the binary DER encoding, you can convert it to the necessary PEM encoding like this:
292
307
293
-
```bash
294
-
openssl x509 -inform der -in my_certificate.cer -out my_certificate.pem
308
+
```shell
309
+
openssl x509 -inform der -in my_certificate.cer -out my_certificate.pem
295
310
```
296
311
297
312
If the Identity Provider has multiple signing certificates that are valid (such as during the rolling from an old key to a new key and responses signed with either key are valid) then the `cert` configuration key can be an array:
@@ -359,17 +374,17 @@ To support this scenario you can provide an implementation for a cache provider
359
374
360
375
```javascript
361
376
{
362
-
saveAsync:asyncfunction(key, value) {
363
-
// saves the key with the optional value, returns the saved value
364
-
},
365
-
getAsync:asyncfunction(key) {
366
-
// returns the value if found, null otherwise
367
-
},
368
-
removeAsync:asyncfunction(key) {
369
-
// removes the key from the cache, returns the
370
-
// key removed, null if no key is removed
371
-
}
372
-
}
377
+
saveAsync:asyncfunction(key, value) {
378
+
// saves the key with the optional value, returns the saved value
379
+
},
380
+
getAsync:asyncfunction(key) {
381
+
// returns the value if found, null otherwise
382
+
},
383
+
removeAsync:asyncfunction(key) {
384
+
// removes the key from the cache, returns the
385
+
// key removed, null if no key is removed
386
+
},
387
+
};
373
388
```
374
389
375
390
Provide an instance of an object which has these functions passed to the `cacheProvider` config option when using Passport-SAML.
0 commit comments