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

[express-openapi] How to integrate with passport-azure-ad? #851

Open
mjedynak opened this issue Jan 12, 2023 · 0 comments
Open

[express-openapi] How to integrate with passport-azure-ad? #851

mjedynak opened this issue Jan 12, 2023 · 0 comments

Comments

@mjedynak
Copy link

I can't figure out how to use passport-azure-ad within my express app.

The way my app is initialized:

const app = express();
initialize({
  app,
  apiDoc: './apiDoc.yml',
  docsPath: 'somePath',
  promiseMode: true,
  operations: {
    getFoo: function(req, res) {     
      res.send('foo');
    }
  }
});

I'd like to verify request using passport-azure-ad when getFoo operation is invoked.
In standard express app this is done this way:

const app = express();
const passport = require("passport");
app.use(passport.initialize());
passport.use(new BearerStrategy(...));

app.get('/getFooUrl', 
  passport.authenticate('oauth-bearer', { session: false }),
  function(req, res) {
     log.info('getFoo');
  });

Any idea how to correctly invoke authenticate method in express-openapi setup mentioned above?

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

No branches or pull requests

1 participant