-
Notifications
You must be signed in to change notification settings - Fork 382
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: Backwards-Compatible Auth #1624
Closed
Closed
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a83e506
feat: Backwards-compatible Auth
d-goog a856a8c
chore: clean-up unused test items
d-goog 09dd5b4
Merge branch 'main' into backwards-compatible-auth
d-goog 86f1760
docs: clarify
d-goog 95f9cec
Merge branch 'main' into backwards-compatible-auth
d-goog 8f2f144
docs: update
d-goog 53ab465
doc: Add links
d-goog fde6e66
Merge branch 'main' of github.com:googleapis/google-auth-library-node…
d-goog 1a438af
refactor: Add `setCredentials` to further narrow valid `AuthClient`s
d-goog cd574f8
docs: minor typos
d-goog 22ce13d
chore: copyright header complaint
d-goog b0f103d
refactor: Use `instanceof` approach instead
d-goog 59486f2
fix: child classes should use original method
d-goog c3c5d19
test: Add additional test
d-goog 58a3ea3
fix: versions
d-goog 5155334
docs: clarify
d-goog 7ad2f8a
docs: Clean-up usage
d-goog ee15fe4
Merge branch 'main' of github.com:googleapis/google-auth-library-node…
d-goog 6892656
fix: nullish check for `in` operator
d-goog 1138f88
Merge branch 'main' of github.com:googleapis/google-auth-library-node…
d-goog d2d3886
chore: remove unused
d-goog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import {strict as assert} from 'assert'; | ||
import {AuthClient} from '../src'; | ||
import {GaxiosPromise} from 'gaxios'; | ||
|
||
describe('static', () => { | ||
describe('normalize', () => { | ||
it('should accept and normalize `AuthClient`', async () => { | ||
class MyAuthClient extends AuthClient { | ||
getRequestHeaders = async () => ({}); | ||
getAccessToken = async () => ({}); | ||
|
||
request<T>(): GaxiosPromise<T> { | ||
return {} as GaxiosPromise<T>; | ||
} | ||
} | ||
|
||
const authClient = new MyAuthClient(); | ||
const auth = AuthClient.normalize(authClient); | ||
|
||
assert.equal(auth, authClient); | ||
}); | ||
|
||
it('should accept and normalize `AuthClientLike`', async () => { | ||
const authClientLike = { | ||
request: async () => ({}), | ||
setCredentials: () => {}, | ||
}; | ||
const auth = AuthClient.normalize(authClientLike); | ||
|
||
assert.equal(auth, authClientLike); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,6 @@ describe('jwt', () => { | |
const keypair = require('keypair'); | ||
const PEM_PATH = './test/fixtures/private.pem'; | ||
const PEM_CONTENTS = fs.readFileSync(PEM_PATH, 'utf8'); | ||
const P12_PATH = './test/fixtures/key.p12'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, was it just an unused value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, an unused value |
||
|
||
nock.disableNetConnect(); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this related to the changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really; noticed it was an unused file that we can remove