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

Add sessions and refresh tokens to Users Management API #654

Closed
wants to merge 2 commits into from

Conversation

jak
Copy link
Contributor

@jak jak commented Jun 26, 2024

Changes

Adds support for the following APIs:

These APIs only support the checkpoint pagination so I've added a different filter for them.

References

Fixes #653

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language

Checklist

@jak jak requested a review from a team as a code owner June 26, 2024 16:00
@jak
Copy link
Contributor Author

jak commented Jul 1, 2024

@desusai7 @jimmyjames Sorry for the direct tags - I can see you've been recently active in the repo.

Is this change acceptable? I'd welcome any and all feedback.

Thanks

@jak jak requested a review from a team as a code owner August 6, 2024 12:16
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SessionsPage {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use inheritance and extend generic Page<> class. For reference, refer ClientsPage class

@JsonProperty("clients")
private List<Client> clients;
@JsonProperty("authentication")
private Authentication authentication;
Copy link
Contributor

Choose a reason for hiding this comment

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

last_interacted_at field is missing. For reference - https://auth0.com/docs/api/management/v2/users/get-sessions-for-user

*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RefreshTokensPage {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use inheritance and extend generic Page<> class. For reference, refer ClientsPage class

@JsonProperty("rotating")
private Boolean rotating;
@JsonProperty("resource_servers")
private List<ResourceServer> resourceServers;
Copy link
Contributor

Choose a reason for hiding this comment

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

Device object and last_exchanged_at fields are missing. For reference - https://auth0.com/docs/api/management/v2/users/get-refresh-tokens-for-user#scopes

@@ -0,0 +1,38 @@
package com.auth0.client.mgmt.filter;

public class CheckpointPaginationFilter extends BaseFilter {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use PageFilter for now instead of creating new class CheckpointPaginationFilter

* @return a Request to execute
*/
public Request<SessionsPage> listSessions(String userId, CheckpointPaginationFilter filter) {
Asserts.assertNotNull(userId, "user id");
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets use "user ID" everywhere

* @param filter an optional pagination filter
* @return a Request to execute
*/
public Request<SessionsPage> listSessions(String userId, CheckpointPaginationFilter filter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use PageFilter for now instead of creating new class CheckpointPaginationFilter

* @return a Request to execute
*/
public Request<RefreshTokensPage> listRefreshTokens(String userId, CheckpointPaginationFilter filter) {
Asserts.assertNotNull(userId, "user id");
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets use "user ID" everywhere

* @param filter an optional pagination filter
* @return a Request to execute
*/
public Request<RefreshTokensPage> listRefreshTokens(String userId, CheckpointPaginationFilter filter) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use PageFilter for now instead of creating new class CheckpointPaginationFilter

@tanya732
Copy link
Contributor

Hi @jak
We have to add support for few more API's. Created a new PR, and added this PR changes.

Thank you

@tanya732 tanya732 closed this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for sessions and refresh-tokens for Users in the Management API
2 participants