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: implement new authenticators to handle sdk authentication #37

Merged
merged 10 commits into from
Aug 21, 2019

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Aug 16, 2019

Node changes for new authenticators. Usage examples are in the design wiki.

Breaking changes:

  • Base service class requires an Authenticator
  • Token managers no longer support access tokens (replaced by Bearer Token Authenticator)
  • Icp4dTokenManagerV1 renamed to Cp4dTokenManager
  • IamTokenManagerV1 renamed to IamTokenManager
  • JwtTokenManagerV1 renamed to JwtTokenManager

Happy to address any feedback

BREAKING CHANGE: The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.
…managers

BREAKING CHANGE: token managers no longer support user access tokens. use BearerTokenAuthenticator instead
require `new` keyword to be used when creating a new authenticator
@codecov
Copy link

codecov bot commented Aug 16, 2019

Codecov Report

❗ No coverage uploaded for pull request base (release-candidate-v1@208f930). Click here to learn what that means.
The diff coverage is 99.61%.

Impacted file tree graph

@@                   Coverage Diff                   @@
##             release-candidate-v1      #37   +/-   ##
=======================================================
  Coverage                        ?   95.87%           
=======================================================
  Files                           ?       23           
  Lines                           ?      582           
  Branches                        ?      126           
=======================================================
  Hits                            ?      558           
  Misses                          ?       23           
  Partials                        ?        1
Impacted Files Coverage Δ
lib/requestwrapper.ts 84.73% <ø> (ø)
auth/utils/read-credentials-file.ts 93.1% <ø> (ø)
auth/authenticators/index.ts 100% <100%> (ø)
auth/token-managers/jwt-token-manager.ts 100% <100%> (ø)
auth/authenticators/basic-authenticator.ts 100% <100%> (ø)
auth/authenticators/bearer-token-authenticator.ts 100% <100%> (ø)
lib/base_service.ts 100% <100%> (ø)
auth/index.ts 100% <100%> (ø)
auth/token-managers/index.ts 100% <100%> (ø)
...uthenticators/token-request-based-authenticator.ts 100% <100%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 208f930...8a54507. Read the comment docs.

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few cosmetic comments, but I think we need to make one change (bypass the Authorization header when the IAM client id/secret are not specified).

auth/authenticators/basic-authenticator.ts Outdated Show resolved Hide resolved
auth/authenticators/cloud-pak-for-data-authenticator.ts Outdated Show resolved Hide resolved
auth/token-managers/jwt-token-manager-v1.ts Outdated Show resolved Hide resolved
lib/base_service.ts Outdated Show resolved Hide resolved
auth/token-managers/iam-token-manager-v1.ts Outdated Show resolved Hide resolved
@dpopp07
Copy link
Member Author

dpopp07 commented Aug 19, 2019

Feedback addressed

Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

BREAKING CHANGE: The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`
…`setClientIdAndSecret`

BREAKING CHANGE: The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
@dpopp07 dpopp07 merged commit bfff0a8 into release-candidate-v1 Aug 21, 2019
@dpopp07 dpopp07 deleted the new-auth-strategy branch August 21, 2019 18:37
mkistler pushed a commit that referenced this pull request Sep 17, 2019
* feat: implement new authenticators to handle sdk authentication
* refactor: remove support for user-managed access tokens in the token managers
* refactor(iam-token-manager): do not use a default auth header if client id/secret are not set
* docs: update the migration document to reflect these changes
* refactor: rename token managers
* refactor(iam-token-manager): rename method `setAuthorizationInfo` to `setClientIdAndSecret`

BREAKING CHANGE: The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.

BREAKING CHANGE: token managers no longer support user access tokens. use BearerTokenAuthenticator instead

BREAKING CHANGE: The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`

BREAKING CHANGE: The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
dpopp07 added a commit that referenced this pull request Oct 3, 2019
* feat: implement new authenticators to handle sdk authentication
* refactor: remove support for user-managed access tokens in the token managers
* refactor(iam-token-manager): do not use a default auth header if client id/secret are not set
* docs: update the migration document to reflect these changes
* refactor: rename token managers
* refactor(iam-token-manager): rename method `setAuthorizationInfo` to `setClientIdAndSecret`

BREAKING CHANGE: The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.

BREAKING CHANGE: token managers no longer support user access tokens. use BearerTokenAuthenticator instead

BREAKING CHANGE: The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`

BREAKING CHANGE: The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
dpopp07 added a commit that referenced this pull request Oct 3, 2019
* feat: implement new authenticators to handle sdk authentication
* refactor: remove support for user-managed access tokens in the token managers
* refactor(iam-token-manager): do not use a default auth header if client id/secret are not set
* docs: update the migration document to reflect these changes
* refactor: rename token managers
* refactor(iam-token-manager): rename method `setAuthorizationInfo` to `setClientIdAndSecret`

BREAKING CHANGE: The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.

BREAKING CHANGE: token managers no longer support user access tokens. use BearerTokenAuthenticator instead

BREAKING CHANGE: The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`

BREAKING CHANGE: The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
ibm-devx-automation pushed a commit that referenced this pull request Oct 3, 2019
# [1.0.0](v0.3.6...v1.0.0) (2019-10-03)

### Bug Fixes

* Move check for serviceUrl to createRequest ([#47](#47)) ([6f04739](6f04739))
* parse result from response in token managers ([6bbe423](6bbe423))
* provide bundlers alternate file for browser support ([#58](#58)) ([88a9d16](88a9d16))

### Build System

* drop support for Node versions 6 and 8 ([#33](#33)) ([d47c737](d47c737))

### Code Refactoring

* look for credentials file in working dir before home dir ([#46](#46)) ([c5556de](c5556de))
* return detailed response as second callback argument ([#34](#34)) ([dc24154](dc24154))

### Features

* add `setServiceUrl` method as a setter for the `serviceUrl` property ([#41](#41)) ([cfb188f](cfb188f))
* add specific error handling for SSL errors with cloud private instances ([#54](#54)) ([056ec9a](056ec9a))
* export `UserOptions` interface from the BaseService ([#50](#50)) ([4f0075a](4f0075a))
* implement new authenticators to handle sdk authentication ([#37](#37)) ([f876b6d](f876b6d))
* refactor core to use Promises instead of callbacks ([#55](#55)) ([9ec8afd](9ec8afd))

### BREAKING CHANGES

* None of the authenticators or request methods take callbacks as arguments anymore - they return Promises instead.
* Users that have credential files in both the working directory and the home directory will see a change in which one is used.
* The internal property `url` no longer exists on the `baseOptions` object, it has been renamed to `serviceUrl`
* The old style of passing credentials to the base service will no longer work. An Authenticator instance MUST be passed in to the base service constructor.
* token managers no longer support user access tokens. use BearerTokenAuthenticator instead
* The class names of the token managers have changed.
* `Icp4dTokenManagerV1` renamed to `Cp4dTokenManager`
* `IamTokenManagerV1` renamed to `IamTokenManager`
* `JwtTokenManagerV1` renamed to `JwtTokenManager`
* The public method `setAuthorizationInfo` is renamed to `setClientIdAndSecret`
* The response body is no longer the 2nd callback argument, the detailed response is. The body is located under the `result` property. The `data` property is removed.
* This SDK may no longer work with applications running on Node 6 or 8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants