Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Express Req and Res in Controller #1395

Closed
Purus opened this issue Jun 21, 2018 · 3 comments
Closed

Getting Express Req and Res in Controller #1395

Purus opened this issue Jun 21, 2018 · 3 comments

Comments

@Purus
Copy link

Purus commented Jun 21, 2018

I have successfully implemented LDAP login based on PassportJs. the user info is now present in the express req object.

How do i get the values from express req object in to my controller so that I can echo back the user name of the LDAP user?

@Purus
Copy link
Author

Purus commented Jun 21, 2018

The 2 below objects has some server information. But not sure how to get the user information from them which is present in express.

controller.httpserver
controller.webserver

EDIT: To add more info on my question..

I am able to access the user info from session as below. I should be able to access the req.session from my bot controller.

  webserver.get('/',ensureAuthenticated, function (req, res) {

    console.log(req.session.passport.user);
    
    res.render('index', {
      layout: 'layouts/default',
      base_url: req.hostname,
      user: req.session.passport.user
    });
  });

@stale
Copy link

stale bot commented Oct 22, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 22, 2018
@stale stale bot closed this as completed Oct 30, 2018
@valeadami
Copy link

@Purus Hi Purus, did you find a solution? I think I have the same problem...thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants