diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-15 00:58:47 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-15 00:58:47 +0000 |
commit | e569f70dd1cc95ee8d30970389b718c529039261 (patch) | |
tree | 7aa918ed1b8909f2d827141de1b991ec56eb031b /sca-java-1.x/trunk/modules/binding-jsonrpc-runtime | |
parent | 4b42a1046edff7739d01f551704d5ad1112a7620 (diff) |
TUSCANY-3389 - Providing different http status code depending on the authentication/authorization error. 401 when user could not be authenticated, 403 when user was authenticated but it does not have the proper role to execute the operation
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@890591 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/trunk/modules/binding-jsonrpc-runtime')
-rw-r--r-- | sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java index a6ccd195ae..346a51e5e7 100644 --- a/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java +++ b/sca-java-1.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java @@ -97,7 +97,9 @@ public class JSONRPCServiceServlet extends JSONRPCServlet { handleServiceRequest(request, response); } catch(RuntimeException re) { - if (re.getCause() instanceof javax.security.auth.login.LoginException) { + if (re.getCause() instanceof javax.security.auth.login.FailedLoginException) { + response.sendError(HttpServletResponse.SC_FORBIDDEN); + }else if (re.getCause() instanceof javax.security.auth.login.LoginException) { response.setHeader("WWW-Authenticate", "BASIC realm=\"" + "ldap-realm" + "\""); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } |