Skip to content

Commit

Permalink
add more console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
melodie-bah committed May 10, 2023
1 parent 43ac427 commit f3afd47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ const ensureAuthenticated = async (req, res, next) => {
}
} else {
console.log('ensure authenticated for a coupled app req for url: ', req.originalUrl)
console.log(`req.user.id is ${req?.user?.id}`);
if (req.isAuthenticated()) {
console.log(`req is authenticated with session id ${req.sessionID}`);
if (!req.user.cn || !req.user.perms) {
// User has been authenticated in another app that does not have the CN SAML values
if (req.get('x-env-ssl_client_certificate')) {
Expand Down Expand Up @@ -296,10 +298,18 @@ const setupSaml = (app) => {

if (!IS_DECOUPLED) {
passport.serializeUser((user, done) => {
console.log(`serialize user: ${user} with id ${user?.id}`);
done(null, user);
});
passport.deserializeUser((user, done) => {
done(null, user);
console.log(`deserialize user: ${user} with id ${user?.id}`);
try {
done(null, user);
} catch(err) {
console.log('deserialize user error')
console.log(err)
console.log(err.message);
}
});

passport.use(new SamlStrategy(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dod-advana/advana-api-auth",
"version": "2.0.11",
"version": "2.0.12",
"description": "contains middleware shared authentication code",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f3afd47

Please sign in to comment.