-
Notifications
You must be signed in to change notification settings - Fork 934
Write BYO-CIAM token, expiresIn to the Auth Object initialized #9052
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
Draft
mansisampat
wants to merge
9
commits into
sammansi-gcip-byociam-web
Choose a base branch
from
sammansi-gcip-byociam-web-interop
base: sammansi-gcip-byociam-web
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ff61e6c
Throw Operation Not Allowed for Invalid Auth Endpoint (#9013)
mansisampat 537bdc6
Throw Operation Not Allowed for Invalid Auth Endpoint (#9013) (#9019)
mansisampat c0cc6eb
Throw Operation Not Allowed for Invalid Auth Endpoint (#9013) (#9019)
mansisampat b609765
Implement exchangeToken public api
mansisampat 28ccf1e
Write BYO-CIAM token, expiresIn to the Auth Object initialized
mansisampat ccd5174
Throw Operation Not Allowed for Invalid Auth Endpoint (#9013) (#9019)
mansisampat a361d46
Throw Operation Not Allowed for Invalid Auth Endpoint (#9013) (#9019)
mansisampat 7ca7909
yarn docgen:all
mansisampat 14eb393
Exchange Token interop changes
mansisampat 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
Project: /docs/reference/js/_project.yaml | ||
Book: /docs/reference/_book.yaml | ||
page_type: reference | ||
|
||
{% comment %} | ||
DO NOT EDIT THIS FILE! | ||
This is generated by the JS SDK team, and any local changes will be | ||
overwritten. Changes should be made in the source code at | ||
https://github.com/firebase/firebase-js-sdk | ||
{% endcomment %} | ||
|
||
# TokenResponse interface | ||
Interface for TokenRespone returned via [exchangeToken()](./auth.md#exchangetoken_b6b1871) endpoint. This is expected to be returned only if [Auth](./auth.auth.md#auth_interface) object initialized has defined [TenantConfig](./auth.tenantconfig.md#tenantconfig_interface)<!-- -->. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface TokenResponse | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [expiresIn](./auth.tokenresponse.md#tokenresponseexpiresin) | string | | | ||
| [token](./auth.tokenresponse.md#tokenresponsetoken) | string | | | ||
|
||
## TokenResponse.expiresIn | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly expiresIn: string; | ||
``` | ||
|
||
## TokenResponse.token | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly token: string; | ||
``` |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -37,7 +37,8 @@ import { | |
NextFn, | ||
Unsubscribe, | ||
PasswordValidationStatus, | ||
TenantConfig | ||
TenantConfig, | ||
TokenResponse | ||
} from '../../model/public_types'; | ||
import { | ||
createSubscribe, | ||
|
@@ -99,6 +100,7 @@ export const enum DefaultConfig { | |
export class AuthImpl implements AuthInternal, _FirebaseService { | ||
currentUser: User | null = null; | ||
emulatorConfig: EmulatorConfig | null = null; | ||
tokenResponse: TokenResponse | null = null; | ||
private operations = Promise.resolve(); | ||
private persistenceManager?: PersistenceUserManager; | ||
private redirectPersistenceManager?: PersistenceUserManager; | ||
|
@@ -454,6 +456,12 @@ export class AuthImpl implements AuthInternal, _FirebaseService { | |
}); | ||
} | ||
|
||
async _updateTokenResponse(tokenResponse: TokenResponse): Promise<void> { | ||
if (tokenResponse) { | ||
this.tokenResponse = tokenResponse; | ||
} | ||
} | ||
|
||
async signOut(): Promise<void> { | ||
if (_isFirebaseServerApp(this.app)) { | ||
return Promise.reject( | ||
|
@@ -621,6 +629,11 @@ export class AuthImpl implements AuthInternal, _FirebaseService { | |
} | ||
} | ||
|
||
async getTokenForRegionalAuth(): | ||
Promise<string> { | ||
if (Date.now() > this.tokenResponse?.expiresIn) | ||
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. This looks incomplete |
||
} | ||
|
||
toJSON(): object { | ||
return { | ||
apiKey: this.config.apiKey, | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Why not store this as a Number instead of string?
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.
Also shouldn't the name match the backend name? https://source.corp.google.com/piper///depot/google3/google/cloud/identityplatform/v2main/token_exchange_service.proto;l=85?q=%20%22exchangeOidcToken%22