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

feat(microservices): Add oauth bearer to SASLOptions #5636

Closed
wants to merge 1 commit into from
Closed

feat(microservices): Add oauth bearer to SASLOptions #5636

wants to merge 1 commit into from

Conversation

smhmayboudi
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #5635

What is the new behavior?

  sasl: {
    mechanism: 'oauthbearer',
    oauthBearerProvider: async () => {
      // Use an unsecured token...
      const token = jwt.sign({ sub: 'test' }, 'abc', { algorithm: 'none' })

      // ...or, more realistically, grab the token from some OAuth endpoint

      return {
        value: token
      }
    }
  },

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

@coveralls
Copy link

Pull Request Test Coverage Report for Build 31683

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 160 unchanged lines in 31 files lost coverage.
  • Overall coverage increased (+0.7%) to 95.443%

Files with Coverage Reduction New Missed Lines %
packages/common/decorators/http/route-params.decorator.ts 1 88.1%
packages/common/pipes/validation.pipe.ts 1 94.38%
packages/core/router/router-execution-context.ts 1 97.42%
packages/microservices/client/client-redis.ts 1 92.86%
packages/microservices/server/server-kafka.ts 1 97.54%
packages/microservices/server/server-mqtt.ts 1 96.83%
packages/websockets/socket-server-provider.ts 1 91.18%
packages/common/decorators/core/apply-decorators.ts 2 66.67%
packages/common/decorators/core/set-metadata.decorator.ts 2 85.71%
packages/microservices/client/client-kafka.ts 2 97.12%
Totals Coverage Status
Change from base Build 31dcaa7c-d83e-4300-bead-bda09e984628: 0.7%
Covered Lines: 4482
Relevant Lines: 4696

💛 - Coveralls

@galesky
Copy link
Contributor

galesky commented Oct 31, 2020

Hello @smhmayboudi

Given that implementing oauthbearer makes the username and password optional on the SASLOptions interface, what are your thoughts on refining the Interface a little so that those properties are not ALWAYS optional ?

I'm coming from the idea that for the other 5 "SASLMechism"s the username and password are still required.

edit: typo

@kamilmysliwiec kamilmysliwiec modified the milestone: 7.5.0 Nov 2, 2020
@kamilmysliwiec
Copy link
Member

Ping @smhmayboudi 🏓

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

Successfully merging this pull request may close these issues.

4 participants