Skip to content

Commit 4b0896e

Browse files
author
Vito Chin
committed
Add route to receive token from Azure AD
1 parent adc1e77 commit 4b0896e

File tree

4 files changed

+41
-42
lines changed

4 files changed

+41
-42
lines changed

_helpers/jwt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ function jwt() {
88
return expressJwt({ secret }).unless({
99
path: [
1010
// public routes that don't require authentication
11-
'/users/authenticate'
11+
'/users/authenticate',
12+
'/token'
1213
]
1314
});
1415
}

package-lock.json

Lines changed: 35 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ app.use(jwt());
1515

1616
// api routes
1717
app.use('/users', require('./users/users.controller'));
18+
app.use('/token', require('./token/token.controller'));
1819

1920
// global error handler
2021
app.use(errorHandler);

users/user.service.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
const jwt = require('jsonwebtoken');
33

44
// users hardcoded for simplicity, store in a db for production applications
5-
const users = [{ id: 1, username: 'test', password: 'test', firstName: 'Test', lastName: 'User' }];
5+
const users = [
6+
{ id: 1, username: 'test', password: 'test', firstName: 'Test', lastName: 'User' }
7+
];
68

79
module.exports = {
810
authenticate,

0 commit comments

Comments
 (0)