Skip to content
This repository was archived by the owner on Aug 28, 2023. It is now read-only.

Commit c03ba97

Browse files
committedJun 3, 2020
Merge branch 'dev' into feature/add_proxy_support
2 parents 77a5583 + 5724e68 commit c03ba97

File tree

1 file changed

+36
-42
lines changed

1 file changed

+36
-42
lines changed
 

‎README.md

+36-42
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@ Latest version that support's SAML and WSFED - 2.0.3
2222
Minimum recommended version - 1.4.6
2323
You can find the changes for each version in the [change log](https://github.com/AzureAD/passport-azure-ad/blob/master/CHANGELOG.md).
2424

25-
## 3. Contribution History
26-
27-
[![Stories in Ready](https://badge.waffle.io/AzureAD/passport-azure-ad.png?label=ready&title=Ready)](https://waffle.io/AzureAD/passport-azure-ad)
28-
29-
[![Throughput Graph](https://graphs.waffle.io/AzureAD/passport-azure-ad/throughput.svg)](https://waffle.io/AzureAD/passport-azure-ad/metrics)
30-
31-
## 4. Installation
25+
## 3. Installation
3226

3327
$ npm install passport-azure-ad
3428

35-
## 5. Usage
29+
## 4. Usage
3630

3731
This library contains two strategies: OIDCStrategy and BearerStrategy.
3832

@@ -43,13 +37,13 @@ BearerStrategy uses Bearer Token protocol to protect web resource/api. It works
4337
User sends a request to the protected web api which contains an access_token in either the authorization header or body. Passport extracts and validates the access_token, and propagates the claims in access_token to the verify callback and let the framework finish the remaining authentication procedure. On successful authentication, passport adds the user information to `req.user` and passes it to the next middleware, which is usually the business logic of the web resource/api. In case of error, passport sends back an unauthorized response.
4438

4539

46-
We support AAD v1, v2 and B2C tenants for both strategies. Please check out [section 8](#8-samples-and-documentation) for the samples. You can manage v1 tenants and register applications at https://manage.windowsazure.com. For v2 tenants and applications, you should go to https://apps.dev.microsoft.com. For B2C tenants, go to https://manage.windowsazure.com and click 'Manage B2C settings' to register applications and policies.
40+
We support AAD v1, v2 and B2C tenants for both strategies. Please check out [section 8](#8-samples-and-documentation) for the samples. You can manage v1 tenants and register applications at https://manage.windowsazure.com. For v2 tenants and applications, you should go to https://aka.ms/appregistrations. For B2C tenants, go to https://manage.windowsazure.com and click 'Manage B2C settings' to register applications and policies.
4741

48-
### 5.1 OIDCStrategy
42+
### 4.1 OIDCStrategy
4943

50-
#### 5.1.1 Configure strategy and provide callback function
44+
#### 4.1.1 Configure strategy and provide callback function
5145

52-
##### 5.1.1.1 Sample using the OIDCStrategy
46+
##### 4.1.1.1 Sample using the OIDCStrategy
5347

5448
```javascript
5549
passport.use(new OIDCStrategy({
@@ -97,7 +91,7 @@ passport.use(new OIDCStrategy({
9791
));
9892
```
9993

100-
##### 5.1.1.2 Options
94+
##### 4.1.1.2 Options
10195

10296
* `identityMetadata` (Required)
10397

@@ -218,7 +212,7 @@ passport.use(new OIDCStrategy({
218212

219213
This value is the clock skew (in seconds) allowed in token validation. It must be a positive integer. The default value is 300 seconds.
220214

221-
##### 5.1.1.3 Verify callback
215+
##### 4.1.1.3 Verify callback
222216

223217
If you set `passReqToCallback` option to false, you can use one of the following signatures for the verify callback
224218

@@ -242,7 +236,7 @@ If you set `passReqToCallback` option to true, you can use one of the following
242236
function(req, profile, done)
243237
```
244238

245-
#### 5.1.1.4 JWE support
239+
#### 4.1.1.4 JWE support
246240

247241
We support encrypted id_token in JWE Compact Serialization format.
248242

@@ -331,7 +325,7 @@ If you set `passReqToCallback` option to true, you can use one of the following
331325
```
332326

333327

334-
#### 5.1.2 Use `passport.authenticate` to protect routes
328+
#### 4.1.2 Use `passport.authenticate` to protect routes
335329

336330
To complete the sample, provide a route that corresponds to the path
337331
configuration parameter that is sent to the strategy:
@@ -363,7 +357,7 @@ app.get('/logout', function(req, res){
363357

364358
```
365359

366-
#### 5.1.3 Options available for `passport.authenticate`
360+
#### 4.1.3 Options available for `passport.authenticate`
367361

368362
* `failureRedirect`: the url redirected to when the authentication fails
369363

@@ -395,7 +389,7 @@ Example:
395389
passport.authenticate('azuread-openidconnect', { tenantIdOrName: 'contoso.onmicrosoft.com' });
396390
```
397391

398-
#### 5.1.4 Session free support
392+
#### 4.1.4 Session free support
399393

400394
Passport framework uses session to keep a persistent login session. As a plug in, we also use session to store state and nonce by default, regardless whether you use { session: false } option in passport.authenticate or not. To be completely session free, you must configure passport-azure-ad to create state/nonce cookie instead of saving them in session. Please follow the following example:
401395

@@ -416,11 +410,11 @@ Passport framework uses session to keep a persistent login session. As a plug in
416410
417411
```
418412

419-
### 5.2 BearerStrategy
413+
### 4.2 BearerStrategy
420414

421-
#### 5.2.1 Configure strategy and provide callback function
415+
#### 4.2.1 Configure strategy and provide callback function
422416

423-
##### 5.2.1.1 Sample using the BearerStrategy
417+
##### 4.2.1.1 Sample using the BearerStrategy
424418

425419
```javascript
426420

@@ -464,7 +458,7 @@ var bearerStrategy = new BearerStrategy(options,
464458
);
465459
```
466460

467-
##### 5.2.1.2 Options
461+
##### 4.2.1.2 Options
468462

469463
* `identityMetadata` (Required)
470464

@@ -543,7 +537,7 @@ var bearerStrategy = new BearerStrategy(options,
543537

544538
This value is the proxy settings object: { port: 'proxyport', host: 'proxyhost', protocol: 'http' }
545539

546-
##### 5.2.1.3 Verify callback
540+
##### 4.2.1.3 Verify callback
547541

548542
If you set `passReqToCallback` option to false, you can use the following verify callback
549543

@@ -557,15 +551,15 @@ If you set `passReqToCallback` option to true, you can use the following verify
557551
function(req, token, done)
558552
```
559553

560-
#### 5.2.2 Use `passport.authenticate` to protect resources or APIs
554+
#### 4.2.2 Use `passport.authenticate` to protect resources or APIs
561555

562556
In the following example, we are using passport to protect '/api/tasks'. User sends a GET request to '/api/tasks' with access_token in authorization header or body. Passport validates the access_token, adds the related claims from access_token to `req.user`, and passes the request to listTasks middleware. The listTasks middleware can then read the user information in `req.user` and list all the tasks related to this user. Note that we do authentication every time, so we don't need to keep this user in session, and this can be achieved by using `session: false` option.
563557

564558
```javascript
565559
server.get('/api/tasks', passport.authenticate('oauth-bearer', { session: false }), listTasks);
566560
```
567561

568-
#### 5.2.3 Options available for `passport.authenticate`
562+
#### 4.2.3 Options available for `passport.authenticate`
569563

570564
* `session`: if you don't want a persistent login session, you can use `session: false`. The default value is true.
571565

@@ -577,25 +571,25 @@ Example:
577571
passport.authenticate('oauth-bearer', { session: false });
578572
```
579573

580-
## 6. Test
574+
## 5. Test
581575

582576
In the library root folder, type the following command to install the dependency packages:
583577

584578
```
585579
$ npm install
586580
```
587581

588-
### 6.1. Run all tests except the end to end tests
582+
### 5.1. Run all tests except the end to end tests
589583

590584
Type the following command to run tests:
591585

592586
```
593587
$ npm test
594588
```
595589

596-
### 6.2. Run all tests including the end to end tests
590+
### 5.2. Run all tests including the end to end tests
597591

598-
#### 6.2.1. Create test applications
592+
#### 5.2.1. Create test applications
599593

600594
First you need to register one application in v1 tenant, one in v2 tenant and one in B2C tenant.
601595

@@ -621,13 +615,13 @@ access token for the scope, and use BearerStrategy to validate the scope. Note f
621615
`b2c_params.scopeForOIDC` but only the name in `b2c_params.scopeForBearer`. For example,
622616
`b2c_params.scopeForOIDC=['https://sijun1b2c.onmicrosoft.com/oidc-b2c/read']` and `b2c_params.scopeForBearer=['read']`.
623617

624-
#### 6.2.2. Fill the test parameters
618+
#### 5.2.2. Fill the test parameters
625619

626620
Open `test/End_to_end_test/script.js`, set `is_test_parameters_completed` parameter to true. For `test_parameters` variable, fill in the tenant id/client id/client secret of your applications, and the username/password of your application user.
627621

628622
For `thumbprint` and `privatePEMKey` parameters, you need to specify a certificate for your app and register the public key in Azure Active Directory. `thumbprint` is the base64url format of the thumbprint of the public key, and `privatePEMKey` is the private pem key string. For a v1 tenant, you can follow [this post](http://www.andrewconnell.com/blog/user-app-app-only-permissions-client-credentials-grant-flow-in-azure-ad-office-365-apis) to generate a certificate and register the public key. For a v2 tenant, you can go to your application page in the [v2 portal](https://apps.dev.microsoft.com) and click `Generate New Key Pair`. A certificate will be generated for you to download. The corresponding public key is automatically registered in this case.
629623

630-
#### 6.2.3. Run the tests
624+
#### 5.2.3. Run the tests
631625

632626
Type the following commands to run the tests:
633627

@@ -640,7 +634,7 @@ Type the following commands to run the tests:
640634

641635
Tests will run automatically and in the terminal you can see how many tests are passing/failing. More details can be found [here](https://github.com/AzureAD/passport-azure-ad/blob/master/contributing.md).
642636

643-
## 7. Logging
637+
## 6. Logging
644638
#### Personal Identifiable Information (PII) & Organizational Identifiable Information (OII)
645639

646640
By default, passport-azure-ad logging does not capture or log any PII or OII. The library allows app developers to turn this on by configuring `loggingNoPII` in the config options. By turning on PII or OII, the app takes responsibility for safely handling highly-sensitive data and complying with any regulatory requirements.
@@ -662,7 +656,7 @@ var options = {
662656
```
663657

664658

665-
## 8. Samples and Documentation
659+
## 7. Samples and Documentation
666660

667661
[We provide a full suite of sample applications and documentation on GitHub](https://azure.microsoft.com/en-us/documentation/samples/?service=active-directory)
668662
to help you get started with learning the Azure Identity system. This includes
@@ -672,50 +666,50 @@ OAuth2, OpenID Connect, Graph API, and other awesome features.
672666

673667
Azure Identity samples for this plug-in can be found in the following links:
674668

675-
### 8.1 Samples for [OpenID connect strategy](https://github.com/AzureAD/passport-azure-ad/blob/master/lib/oidcstrategy.js)
669+
### 7.1 Samples for [OpenID connect strategy](https://github.com/AzureAD/passport-azure-ad/blob/master/lib/oidcstrategy.js)
676670

677671
* [sample using v1 endpoint](https://github.com/AzureADQuickStarts/WebApp-OpenIDConnect-NodeJS)
678672

679673
* [sample using v2 endpoint](https://github.com/AzureADQuickStarts/AppModelv2-WebApp-OpenIDConnect-nodejs)
680674

681675
* [sample using B2C tenant](https://github.com/AzureADQuickStarts/B2C-WebApp-OpenIDConnect-NodeJS)
682676

683-
### 8.2 Samples for [Bearer strategy](https://github.com/AzureAD/passport-azure-ad/blob/master/lib/bearerstrategy.js)
677+
### 7.2 Samples for [Bearer strategy](https://github.com/AzureAD/passport-azure-ad/blob/master/lib/bearerstrategy.js)
684678

685679
* [sample using v1 endpoint](https://github.com/AzureADQuickStarts/WebAPI-Bearer-NodeJS)
686680

687681
* [sample using v2 endpoint](https://github.com/AzureADQuickStarts/AppModelv2-WebAPI-nodejs)
688682

689683
* [sample using B2C tenant](https://github.com/AzureADQuickStarts/B2C-WebApi-Nodejs)
690684

691-
## 9. Community Help and Support
685+
## 8. Community Help and Support
692686

693687
We leverage [Stack Overflow](http://stackoverflow.com/) to work with the community on supporting Azure Active Directory and its SDKs, including this one. We highly recommend you ask your questions on Stack Overflow (we're all on there!) Also browser existing issues to see if someone has had your question before.
694688

695689
We recommend you use the "msal" tag so we can see it! Here is the latest Q&A on Stack Overflow for MSAL: [http://stackoverflow.com/questions/tagged/msal](http://stackoverflow.com/questions/tagged/msal)
696690

697-
## 10. Security Reporting
691+
## 9. Security Reporting
698692

699693
If you find a security issue with our libraries or services please report it to [secure@microsoft.com](mailto:secure@microsoft.com) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/en-us/security/dd252948) and subscribing to Security Advisory Alerts.
700694

701-
## 11. Contributing
695+
## 10. Contributing
702696

703697
All code is licensed under the MIT license and we triage actively on GitHub. We enthusiastically welcome contributions and feedback. You can clone the repo and start contributing now.
704698

705699
More details [about contribution](https://github.com/AzureAD/passport-azure-ad/blob/master/contributing.md)
706700

707-
## 12. Releases
701+
## 11. Releases
708702

709703
Please check the [releases](https://github.com/AzureAD/passport-azure-ad/releases) for updates.
710704

711-
## 13. Acknowledgements
705+
## 12. Acknowledgements
712706

713707
The code is based on Henri Bergius's [passport-saml](https://github.com/bergie/passport-saml) library and Matias Woloski's [passport-wsfed-saml2](https://github.com/auth0/passport-wsfed-saml2) library as well as Kiyofumi Kondoh's [passport-openid-google](https://github.com/kkkon/passport-google-openidconnect).
714708

715-
## 14. License
709+
## 13. License
716710
Copyright (c) Microsoft Corp. All rights reserved. Licensed under the MIT License;
717711

718-
## 15. Microsoft Open Source Code of Conduct
712+
## 14. Microsoft Open Source Code of Conduct
719713

720714
We Value and Adhere to the Microsoft Open Source Code of Conduct
721715

0 commit comments

Comments
 (0)
This repository has been archived.