-
Notifications
You must be signed in to change notification settings - Fork 143
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 method to revoke a refresh_token #86
Conversation
59970b8
to
6c34390
Compare
6c34390
to
a3e1d0c
Compare
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.
If it's not that much trouble I would like to make the change in tests, the one with willReturnSuccessfulEmptyBody()
* @return a request to configure and start | ||
*/ | ||
@SuppressWarnings("WeakerAccess") | ||
public ParameterizableRequest<Void, AuthenticationException> revokeToken(@NonNull String refreshToken) { |
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.
return a plain request, nobody should change anything anyway
@Test | ||
public void shouldRevokeTokenSync() throws Exception { | ||
Auth0 auth0 = new Auth0(CLIENT_ID, mockAPI.getDomain(), mockAPI.getDomain()); | ||
auth0.setOIDCConformant(true); |
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 this test sets this flag and the async one not?
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 think I did this to prove that the flag wasn't considered here. Anyway, the method only works for OIDC clients so I'm considering throwing if the method is called with this flag disabled. What do you think @nikolaseu ? and which exception should I throw, IllegalStateException
?
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.
Disregard my comment.. The oidc flag won't make a change on this endpoint since it should be callable anyway..
@@ -106,6 +106,12 @@ public AuthenticationAPI willReturnSuccessfulSignUp() { | |||
return this; | |||
} | |||
|
|||
public AuthenticationAPI willReturnSuccessfulEmptyBody() { | |||
String json = "{}"; | |||
server.enqueue(responseWithJSON(json, 200)); |
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.
from the docs:
If the request is valid, the refresh token is revoked and the response is HTTP 200, with an empty response body
empty response body is not the same as an empty object in the body.
just to be sure that when the test passes there are no issues when deserializing the response, let's make this return an actual empty body.
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.
Good catch.
No description provided.