-
Notifications
You must be signed in to change notification settings - Fork 149
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
API support for fetching session token #802
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
54 changes: 54 additions & 0 deletions
54
auth0/src/main/java/com/auth0/android/result/SSOCredentials.kt
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,54 @@ | ||
package com.auth0.android.result | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
/** | ||
* Holds the session token credentials required for SSO . | ||
pmathew92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* * *sessionToken*: Session Token for SSO | ||
pmathew92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* * *refreshToken*: Refresh Token that can be used to request new tokens without signing in again | ||
* * *tokenType*: Contains information about how the token should be used. | ||
* * *expiresIn*: The token expiration duration. | ||
* * *issuedTokenType*: Type of the token issued. | ||
* | ||
*/ | ||
public data class SSOCredentials( | ||
/** | ||
* The Session Token used for SSO . | ||
pmathew92 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* | ||
* @return the Session Token. | ||
*/ | ||
@field:SerializedName("access_token") public val sessionToken: String, | ||
|
||
/** | ||
* Type of the token issued.In this case, an Auth0 session token | ||
* | ||
* @return the issued token type. | ||
*/ | ||
@field:SerializedName("issued_token_type") public val issuedTokenType: String, | ||
|
||
/** | ||
* Contains information about how the token should be used. | ||
* If the issued token is not an access token or usable as an access token, then the token_type | ||
* value N_A is used to indicate that an OAuth 2.0 token_type identifier is not applicable in that context | ||
* | ||
* @return the token type. | ||
*/ | ||
@field:SerializedName("token_type") public val tokenType: String, | ||
|
||
/** | ||
* Expiration duration of the session token in seconds. Session tokens are short-lived and expire after a few minutes. | ||
* Once expired, the Session Token can no longer be used for SSO. | ||
* | ||
* @return the expiration duration of this Session Token | ||
*/ | ||
@field:SerializedName("expires_in") public val expiresIn: Int, | ||
|
||
|
||
/** | ||
* Refresh Token that can be used to request new tokens without signing in again. | ||
* | ||
* @return the Refresh Token. | ||
*/ | ||
@field:SerializedName("refresh_token") public val refreshToken: String? = null | ||
) |
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.
I'm not sure this method is needed. We're already providing a method for getting fresh
SSOCredentials
, which automaticaly saves the refresh token.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.
The same functionality can also be achieved by simply retrieving the credentials, replacing the refresh token, and saving them back.
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.
In the case we have it for internal code reuse, then we should not have it be public.
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.
Added this method for the scenario where we get a new refresh token when calling the API directly from the AuthenticationAPI class. The user would have to call this to replace the existing one else the following getSsoCredentials call will fail.