Search in sources :

Example 11 with InvalidClientException

use of org.springframework.security.oauth2.common.exceptions.InvalidClientException in project spring-security-oauth by spring-projects.

the class WhitelabelErrorEndpointTests method testErrorPage.

@Test
public void testErrorPage() throws Exception {
    request.setContextPath("/foo");
    request.setAttribute("error", new InvalidClientException("FOO"));
    ModelAndView result = endpoint.handleError(request);
    result.getView().render(result.getModel(), request, response);
    String content = response.getContentAsString();
    assertTrue("Wrong content: " + content, content.contains("OAuth Error"));
    assertTrue("Wrong content: " + content, content.contains("invalid_client"));
}
Also used : InvalidClientException(org.springframework.security.oauth2.common.exceptions.InvalidClientException) ModelAndView(org.springframework.web.servlet.ModelAndView) Test(org.junit.Test)

Aggregations

InvalidClientException (org.springframework.security.oauth2.common.exceptions.InvalidClientException)11 Test (org.junit.Test)6 Authentication (org.springframework.security.core.Authentication)4 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)4 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 InvalidGrantException (org.springframework.security.oauth2.common.exceptions.InvalidGrantException)3 OAuth2Exception (org.springframework.security.oauth2.common.exceptions.OAuth2Exception)3 RedirectMismatchException (org.springframework.security.oauth2.common.exceptions.RedirectMismatchException)3 InsufficientAuthenticationException (org.springframework.security.authentication.InsufficientAuthenticationException)2 InvalidRequestException (org.springframework.security.oauth2.common.exceptions.InvalidRequestException)2 ClientDetails (org.springframework.security.oauth2.provider.ClientDetails)2 OAuth2Request (org.springframework.security.oauth2.provider.OAuth2Request)2 TokenRequest (org.springframework.security.oauth2.provider.TokenRequest)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ModelAndView (org.springframework.web.servlet.ModelAndView)2 IOException (java.io.IOException)1 URI (java.net.URI)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1