passport-entra 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -16
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
# README #
|
|
2
2
|
|
|
3
|
-
This README would normally document whatever steps are necessary to get your application up and running.
|
|
4
|
-
|
|
5
3
|
### What is this repository for? ###
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
* Version
|
|
9
|
-
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
|
5
|
+
This is a replacement for passport-azure-ad.
|
|
10
6
|
|
|
11
7
|
### How do I get set up? ###
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
Set up authentication:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
const clientID = ...
|
|
13
|
+
const scope = ...
|
|
14
|
+
const tenantID = ...
|
|
15
|
+
|
|
16
|
+
const issuer = `https://login.microsoftonline.com/${tenantID}/v2.0`;
|
|
17
|
+
|
|
18
|
+
const options: BearerOptions = {
|
|
19
|
+
clientID,
|
|
20
|
+
identityMetadata: `${issuer}/.well-known/openid-configuration`,
|
|
21
|
+
issuer,
|
|
22
|
+
scope: [scope],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const bearerStrategy = new BearerStrategy(
|
|
26
|
+
options,
|
|
27
|
+
(token: object, done: AuthenticateCallback) => { done(null, {}, token); },
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
passport.use(bearerStrategy);
|
|
31
|
+
|
|
32
|
+
const authenticate = passport.authenticate(
|
|
33
|
+
'oauth-bearer',
|
|
34
|
+
{ session: false },
|
|
35
|
+
);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use with express:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
const app = express();
|
|
42
|
+
|
|
43
|
+
// all calls require user authentication
|
|
44
|
+
app.all('/api/*splat', authenticate);
|
|
45
|
+
|
|
46
|
+
// authentication passed
|
|
47
|
+
app.all('/api/*splat', async (req, res, next) => {
|
|
48
|
+
logger.info(`${req.method} ${req.path}`);
|
|
49
|
+
logger.info(req.authInfo);
|
|
50
|
+
next();
|
|
51
|
+
});
|
|
52
|
+
```
|
|
19
53
|
|
|
20
54
|
### Contribution guidelines ###
|
|
21
55
|
|
|
22
|
-
|
|
23
|
-
* Code review
|
|
24
|
-
* Other guidelines
|
|
56
|
+
Feel free to raise an issue at https://bitbucket.org/janbakker/passport-entra
|
|
25
57
|
|
|
26
58
|
### Who do I talk to? ###
|
|
27
59
|
|
|
28
|
-
|
|
29
|
-
* Other community or team contact
|
|
60
|
+
Kind regards, Jan Bakker
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passport-entra",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Microsoft Entra authentication strategy for passport",
|
|
5
5
|
"main": "dist/passport-entra.js",
|
|
6
6
|
"types": "dist/passport-entra.d.ts",
|
|
7
7
|
"homepage": "https://bitbucket.org/janbakker/passport-entra",
|
|
8
|
-
"repository":
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://bitbucket.org/janbakker/passport-entra.git"
|
|
11
|
+
},
|
|
9
12
|
"scripts": {
|
|
10
13
|
"build": "tsc",
|
|
11
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|