ARTEMIS-409 clarify STOMP login failure response

This commit is contained in:
jbertram 2016-05-24 10:46:14 -05:00
parent a39f43dfe9
commit eb785b4194
3 changed files with 9 additions and 6 deletions

View File

@ -67,8 +67,9 @@ public class StompFrameHandlerV10 extends VersionedStompFrameHandler implements
else { else {
//not valid //not valid
response = new StompFrameV10(Stomp.Responses.ERROR); response = new StompFrameV10(Stomp.Responses.ERROR);
response.addHeader(Stomp.Headers.Error.MESSAGE, "Failed to connect"); String responseText = "Security Error occurred: User name [" + login + "] or password is invalid";
response.setBody("The login account is not valid."); response.setBody(responseText);
response.addHeader(Stomp.Headers.Error.MESSAGE, responseText);
} }
return response; return response;
} }

View File

@ -93,8 +93,9 @@ public class StompFrameHandlerV11 extends VersionedStompFrameHandler implements
response = createStompFrame(Stomp.Responses.ERROR); response = createStompFrame(Stomp.Responses.ERROR);
response.setNeedsDisconnect(true); response.setNeedsDisconnect(true);
response.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain"); response.addHeader(Stomp.Headers.CONTENT_TYPE, "text/plain");
response.addHeader(Stomp.Headers.Error.MESSAGE, "Failed to connect"); String responseText = "Security Error occurred: User name [" + login + "] or password is invalid";
response.setBody("The login account is not valid."); response.setBody(responseText);
response.addHeader(Stomp.Headers.Error.MESSAGE, responseText);
} }
} }
catch (ActiveMQStompException e) { catch (ActiveMQStompException e) {

View File

@ -91,7 +91,6 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
return true; return true;
} }
catch (LoginException e) { catch (LoginException e) {
logger.info("Couldn't validate user: " + e.getMessage());
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Couldn't validate user", e); logger.debug("Couldn't validate user", e);
} }
@ -120,7 +119,9 @@ public class ActiveMQJAASSecurityManager implements ActiveMQSecurityManager2 {
localSubject = getAuthenticatedSubject(user, password, certificates); localSubject = getAuthenticatedSubject(user, password, certificates);
} }
catch (LoginException e) { catch (LoginException e) {
logger.debug("Couldn't validate user", e); if (logger.isDebugEnabled()) {
logger.debug("Couldn't validate user", e);
}
return false; return false;
} }