diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2008-07-17 16:33:03 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2008-07-17 16:33:03 +0000 |
| commit | 8f84b0db27ba46ce5a4048435c2e3609b4476cf9 (patch) | |
| tree | 8f6fca2213bb2fd71430fa5f837076c58f5eadff /qpid/java | |
| parent | 5ab5d469ecd08acc31a68965248699f9e73d1766 (diff) | |
| download | qpid-python-8f84b0db27ba46ce5a4048435c2e3609b4476cf9.tar.gz | |
QPID-1182 : Added additional logging to identify the exception that caused Authentication to fail.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@677633 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
5 files changed, 35 insertions, 19 deletions
diff --git a/qpid/java/broker/etc/acl.config.xml b/qpid/java/broker/etc/acl.config.xml index 73c8d239de..614ecf0a88 100644 --- a/qpid/java/broker/etc/acl.config.xml +++ b/qpid/java/broker/etc/acl.config.xml @@ -93,7 +93,7 @@ <queues> <exchange>amq.direct</exchange> <!-- 4Mb --> - <maximumQueueDepth>4235g264</maximumQueueDepth> + <maximumQueueDepth>4235264</maximumQueueDepth> <!-- 2Mb --> <maximumMessageSize>2117632</maximumMessageSize> <!-- 10 mins --> diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java index 193c3a088b..621003be90 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java @@ -57,9 +57,6 @@ public class ConnectionSecureOkMethodHandler implements StateAwareMethodListener { AMQProtocolSession session = stateManager.getProtocolSession(); - - //fixme Vhost not defined yet - //session.getVirtualHost().getAuthenticationManager(); AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager(); SaslServer ss = session.getSaslServer(); @@ -72,11 +69,12 @@ public class ConnectionSecureOkMethodHandler implements StateAwareMethodListener switch (authResult.status) { case ERROR: - // Can't do this as we violate protocol. Need to send Close - // throw new AMQException(AMQConstant.NOT_ALLOWED.getCode(), AMQConstant.NOT_ALLOWED.getName()); - _logger.info("Authentication failed"); - stateManager.changeState(AMQState.CONNECTION_CLOSING); + Exception cause = authResult.getCause(); + _logger.info("Authentication failed:" + (cause == null ? "" : cause.getMessage())); + + // This should be abstracted + stateManager.changeState(AMQState.CONNECTION_CLOSING); ConnectionCloseBody connectionCloseBody = methodRegistry.createConnectionCloseBody(AMQConstant.NOT_ALLOWED.getCode(), @@ -84,7 +82,7 @@ public class ConnectionSecureOkMethodHandler implements StateAwareMethodListener body.getClazz(), body.getMethod()); - session.writeFrame(connectionCloseBody.generateFrame(0) ); + session.writeFrame(connectionCloseBody.generateFrame(0)); disposeSaslServer(session); break; case SUCCESS: @@ -96,7 +94,7 @@ public class ConnectionSecureOkMethodHandler implements StateAwareMethodListener ConnectionStartOkMethodHandler.getConfiguredFrameSize(), HeartbeatConfig.getInstance().getDelay()); session.writeFrame(tuneBody.generateFrame(0)); - session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID())); + session.setAuthorizedID(new UsernamePrincipal(ss.getAuthorizationID())); disposeSaslServer(session); break; case CONTINUE: diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java index f02121c89f..f53e56601b 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java @@ -93,7 +93,10 @@ public class ConnectionStartOkMethodHandler implements StateAwareMethodListener< switch (authResult.status) { case ERROR: - _logger.info("Authentication failed"); + Exception cause = authResult.getCause(); + + _logger.info("Authentication failed:" + (cause == null ? "" : cause.getMessage())); + stateManager.changeState(AMQState.CONNECTION_CLOSING); ConnectionCloseBody closeBody = diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java index 0e3aea4de0..3f846b9dd0 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/AuthenticationResult.java @@ -20,6 +20,8 @@ */ package org.apache.qpid.server.security.auth; +import javax.security.sasl.SaslException; + public class AuthenticationResult { public enum AuthenticationStatus @@ -29,15 +31,33 @@ public class AuthenticationResult public AuthenticationStatus status; public byte[] challenge; + + private Exception cause; + + public AuthenticationResult(AuthenticationStatus status) + { + this(null, status, null); + } public AuthenticationResult(byte[] challenge, AuthenticationStatus status) { + this(challenge, status, null); + } + + public AuthenticationResult(AuthenticationStatus error, Exception cause) + { + this(null, error, cause); + } + + public AuthenticationResult(byte[] challenge, AuthenticationStatus status, Exception cause) + { this.status = status; this.challenge = challenge; + this.cause = cause; } - public AuthenticationResult(AuthenticationStatus status) + public Exception getCause() { - this.status = status; + return cause; } } diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java index f589140e8e..e5bf3edfca 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java @@ -230,12 +230,7 @@ public class PrincipalDatabaseAuthenticationManager implements AuthenticationMan } catch (SaslException e) { - return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR); + return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR, e); } } - - public AuthenticationResult isAuthorize(VirtualHost vhost, String username) - { - return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR); - } } |
