Skip to content

Commit

Permalink
Merge remote-tracking branch 'blzaugg/patch-1' jaredhanson#630
Browse files Browse the repository at this point in the history
  • Loading branch information
rwky committed Jul 7, 2018
2 parents 85f6cb1 + da1b293 commit c763086
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Expand Up @@ -105,6 +105,27 @@ app.post('/login',
});
```

#### Protect Routes When Using Sessions

Passport provides an `isAuthenticated()` function on the request object, which
is used to determine if the user has been authenticated and stored in the
session.

```javascript
app.post('/some/protected/route',
function(req, res, next) {
if(req.isAuthenticated()){
next();
} else {
next(new Error('Unauthorized'));
}
});
```

For a more complete solution to handling unauthenticated users, see
[connect-ensure-login](https://github.com/jaredhanson/connect-ensure-login), a
middleware to ensure login sessions.

## Strategies

Passport has a comprehensive set of **over 480** authentication strategies
Expand Down

0 comments on commit c763086

Please sign in to comment.