Skip to content

Commit

Permalink
capture oidc invalid_grant error for invalidcredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Aug 15, 2017
1 parent a52a2ca commit 3cb8a81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public boolean isRuleError() {

/// When username and/or password used for authentication are invalid
public boolean isInvalidCredentials() {
return "invalid_user_password".equals(code);
return "invalid_user_password".equals(code) || "invalid_grant".equals(code) && "Wrong email or password.".equals(description);
}

/// When authenticating with web-based authentication and the resource server denied access per OAuth2 spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ public void shouldHaveInvalidCredentials() throws Exception {
assertThat(ex.isInvalidCredentials(), is(true));
}

@Test
public void shouldHaveOIDCInvalidCredentials() throws Exception {
values.put(CODE_KEY, "invalid_grant");
values.put(ERROR_DESCRIPTION_KEY, "Wrong email or password.");
AuthenticationException ex = new AuthenticationException(values);
assertThat(ex.isInvalidCredentials(), is(true));
}

@Test
public void shouldHaveAccessDenied() throws Exception {
values.put(CODE_KEY, "access_denied");
Expand Down

0 comments on commit 3cb8a81

Please sign in to comment.