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

Open
wants to merge 2 commits into
base: master
Choose a base branch
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
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

*/
@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

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