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

Provide middlewares for koa #109

Open
bzums opened this issue Oct 5, 2017 · 0 comments
Open

Provide middlewares for koa #109

bzums opened this issue Oct 5, 2017 · 0 comments

Comments

@bzums
Copy link
Collaborator

bzums commented Oct 5, 2017

Currently we provide middlewares for expressjs to:

  1. conveniently extract and validate an oauth2 access token from a response (handleOAuthRequestMiddleware, see https://github.com/zalando-incubator/authmosphere/blob/master/src/express-tooling.ts#L85)
  2. conveniently secure an endpoint via requiring an access token to have certain scopes (requireScopesMiddleware, see https://github.com/zalando-incubator/authmosphere/blob/master/src/express-tooling.ts#L40)

For both middlewares it would be nice to have a pendant for koajs.

The requirements for handleOAuthRequestMiddleware are:

  • accepts parameter of type MiddlewareOptions
  • extracts token from Authorization header of a request
  • validates this token via calling getTokenInfo
  • makes this token available for later use in the middleware chain

The requirements for requireScopesMiddleware are:

  • accepts a parameter of type string[] which defines the scopes necessary for calling an endpoint
  • gets the token extracted by handleOAuthRequestMiddleware
  • checks whether the given token has all necessary scopes
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

2 participants