added OAuth error display page, closes #559
parent
118237ab05
commit
4655650a68
|
@ -38,7 +38,8 @@
|
||||||
request-validator-ref="oauthRequestValidator"
|
request-validator-ref="oauthRequestValidator"
|
||||||
redirect-resolver-ref="blacklistAwareRedirectResolver"
|
redirect-resolver-ref="blacklistAwareRedirectResolver"
|
||||||
authorization-endpoint-url="/authorize"
|
authorization-endpoint-url="/authorize"
|
||||||
token-endpoint-url="/token">
|
token-endpoint-url="/token"
|
||||||
|
error-page="/error">
|
||||||
|
|
||||||
<oauth:authorization-code authorization-code-services-ref="defaultOAuth2AuthorizationCodeService"/>
|
<oauth:authorization-code authorization-code-services-ref="defaultOAuth2AuthorizationCodeService"/>
|
||||||
<oauth:implicit />
|
<oauth:implicit />
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
|
|
||||||
<bean id="oauthRequestValidator" class="org.mitre.oauth2.token.StructuredScopeAwareOAuth2RequestValidator" />
|
<bean id="oauthRequestValidator" class="org.mitre.oauth2.token.StructuredScopeAwareOAuth2RequestValidator" />
|
||||||
|
|
||||||
|
<!-- Error page handler. -->
|
||||||
|
<mvc:view-controller path="/error" view-name="error" />
|
||||||
|
|
||||||
</beans>
|
</beans>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
|
||||||
|
<%@ taglib prefix="o" tagdir="/WEB-INF/tags"%>
|
||||||
|
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||||
|
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
|
||||||
|
|
||||||
|
<spring:message code="error.title" var="title"/>
|
||||||
|
<o:header title="${title}" />
|
||||||
|
<o:topbar pageName="Error" />
|
||||||
|
<div class="container-fluid main">
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="offset1 span10">
|
||||||
|
<div class="hero-unit">
|
||||||
|
<h1>Error:</h1>
|
||||||
|
<h2 class="text-error"><c:out value="${error.getOAuth2ErrorCode()}" /></h2>
|
||||||
|
<p>
|
||||||
|
There was an error processing your request. The server's message was:
|
||||||
|
<blockquote class="text-error"><b><c:out value="${error.message}" /></b></blockquote>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<o:footer />
|
|
@ -103,19 +103,14 @@ public class AuthorizationRequestFilter extends GenericFilterBean {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
// we have to create our own auth request in order to get at all the parmeters appropriately
|
// we have to create our own auth request in order to get at all the parmeters appropriately
|
||||||
AuthorizationRequest authRequest = authRequestFactory.createAuthorizationRequest(createRequestMap(request.getParameterMap()));
|
AuthorizationRequest authRequest = null;
|
||||||
|
|
||||||
ClientDetailsEntity client = null;
|
ClientDetailsEntity client = null;
|
||||||
|
|
||||||
try {
|
authRequest = authRequestFactory.createAuthorizationRequest(createRequestMap(request.getParameterMap()));
|
||||||
client = clientService.loadClientByClientId(authRequest.getClientId());
|
client = clientService.loadClientByClientId(authRequest.getClientId());
|
||||||
} catch (InvalidClientException e) {
|
|
||||||
// no need to worry about this here, it would be caught elsewhere
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
// no need to worry about this here, it would be caught elsewhere
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// save the login hint to the session
|
// save the login hint to the session
|
||||||
if (authRequest.getExtensions().get(LOGIN_HINT) != null) {
|
if (authRequest.getExtensions().get(LOGIN_HINT) != null) {
|
||||||
|
@ -124,7 +119,6 @@ public class AuthorizationRequestFilter extends GenericFilterBean {
|
||||||
session.removeAttribute(LOGIN_HINT);
|
session.removeAttribute(LOGIN_HINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (authRequest.getExtensions().get(PROMPT) != null) {
|
if (authRequest.getExtensions().get(PROMPT) != null) {
|
||||||
// we have a "prompt" parameter
|
// we have a "prompt" parameter
|
||||||
String prompt = (String)authRequest.getExtensions().get(PROMPT);
|
String prompt = (String)authRequest.getExtensions().get(PROMPT);
|
||||||
|
@ -228,6 +222,10 @@ public class AuthorizationRequestFilter extends GenericFilterBean {
|
||||||
chain.doFilter(req, res);
|
chain.doFilter(req, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (InvalidClientException e) {
|
||||||
|
// we couldn't find the client, move on and let the rest of the system catch the error
|
||||||
|
chain.doFilter(req, res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue