-
Notifications
You must be signed in to change notification settings - Fork 377
feat(jwt): public API — IUserJwtInvalidatedListener, updateUserJwt, login JWT (5/6) #2633
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
Open
nan-li
wants to merge
8
commits into
feat/iv-http-executors-04
Choose a base branch
from
feat/iv-public-api-05
base: feat/iv-http-executors-04
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.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e147ea2
feat(iv): public API — IUserJwtInvalidatedListener, updateUserJwt, lo…
nan-li d137481
refactor(iv): align jwt-invalidated replay with #2613 buffer-and-consume
nan-li 07f3070
fix(iv): gate jwt-invalidated listener add/remove on init
nan-li 5f5311c
fix(iv): wake queue on login(sameId, freshJwt) refresh path
nan-li eb44594
fix(iv): expose new public methods on OneSignal facade + log hygiene
nan-li 46d525f
refactor(iv): drop jwt-invalidated buffer/replay; pure pub/sub matche…
nan-li 215b888
refactor(iv): move IUserJwtInvalidatedListener notifier into JwtToken…
nan-li 8c4c64a
nit: don't force executions if token no change
nan-li 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
26 changes: 26 additions & 0 deletions
26
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/IUserJwtInvalidatedListener.kt
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,26 @@ | ||
| package com.onesignal | ||
|
|
||
| /** | ||
| * Implement this interface and provide an instance to | ||
| * [IOneSignal.addUserJwtInvalidatedListener] to be notified when the SDK has | ||
| * detected that the JWT for a user is no longer valid (typically a 401 from | ||
| * the OneSignal backend on a request signed with that JWT). | ||
| * | ||
| * Threading: delivered on a background dispatcher | ||
| * (`OneSignalDispatchers.launchOnDefault`). Implementations should not assume a | ||
| * specific thread and should re-dispatch to the UI thread if needed. | ||
| * | ||
| * Pure pub/sub: only listeners subscribed at the time of the invalidation | ||
| * receive the event. Subscribe early (e.g. in `Application.onCreate`) to avoid | ||
| * missing cold-start 401s. | ||
| */ | ||
| fun interface IUserJwtInvalidatedListener { | ||
| /** | ||
| * Called when the JWT is invalidated for [UserJwtInvalidatedEvent.externalId]. | ||
| * Apps should use this signal to fetch a fresh JWT from their backend and | ||
| * supply it via [IOneSignal.updateUserJwt]. | ||
| * | ||
| * @param event Describes which user's JWT was invalidated. | ||
| */ | ||
| fun onUserJwtInvalidated(event: UserJwtInvalidatedEvent) | ||
| } |
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
9 changes: 9 additions & 0 deletions
9
OneSignalSDK/onesignal/core/src/main/java/com/onesignal/UserJwtInvalidatedEvent.kt
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,9 @@ | ||
| package com.onesignal | ||
|
|
||
| /** | ||
| * The event passed into [IUserJwtInvalidatedListener.onUserJwtInvalidated]. | ||
| * Delivery occurs on a background thread. | ||
| */ | ||
| class UserJwtInvalidatedEvent( | ||
| val externalId: 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
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.
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.
Uh oh!
There was an error while loading. Please reload this page.