Skip to content

Commit

Permalink
SECOAUTH-366: Change default type of authentication in 401 response
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyer committed Apr 12, 2013
1 parent 88dea7e commit 2e55ee4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void handleError(ClientHttpResponse response) throws IOException {
@Test
@OAuth2ContextConfiguration(resource = InvalidClientCredentials.class, initialize = false)
public void testInvalidCredentialsWithFormAuthentication() throws Exception {
resource.setAuthenticationScheme(AuthenticationScheme.form);
resource.setClientAuthenticationScheme(AuthenticationScheme.form);
context.setAccessTokenProvider(new ClientCredentialsAccessTokenProvider() {
@Override
protected ResponseErrorHandler getResponseErrorHandler() {
Expand All @@ -122,7 +122,7 @@ public void handleError(ClientHttpResponse response) throws IOException {
}
// System.err.println(responseHeaders);
String header = responseHeaders.getFirst("WWW-Authenticate");
assertTrue("Wrong header: " + header, header.contains("Basic realm"));
assertTrue("Wrong header: " + header, header.contains("Form realm"));
assertEquals(HttpStatus.UNAUTHORIZED, responseStatus);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public ClientCredentialsTokenEndpointFilter() {

public ClientCredentialsTokenEndpointFilter(String path) {
super(path);
// If authentication fails the type is "Form"
((OAuth2AuthenticationEntryPoint)authenticationEntryPoint).setTypeName("Form");
}

/**
Expand Down

0 comments on commit 2e55ee4

Please sign in to comment.