* </ul>
*
* @param msg The JMS {@link Message} received.
*/
private UserGroupAdapter getUserFromMessageAndLookupAndInjectGroups(String [] userPass) {
UserGroupAdapter jmsUserGroupAdapter = null;
try {
if( userPass == null ) {
logger.warn("Unable to retrieve user and password from message: NOT injecting group information.");
return null;
}
Subject msgSubject = tryLogin(userPass);
if( msgSubject == null ) {
logger.warn("Unable to login to JAAS with received user and password.");
return null;
}
List<Principal> roles = getGroupsFromSubject(msgSubject);
String [] rolesArr = new String[roles.size()];
for( int i = 0; i < rolesArr.length; ++i ) {
rolesArr[i] = roles.get(i).getName();
}
UserGroupAdapter newUserGroupAdapter = new JmsUserGroupAdapter(userPass[0], rolesArr);
JAASUserGroupCallbackImpl.addExternalUserGroupAdapter(newUserGroupAdapter);
jmsUserGroupAdapter = newUserGroupAdapter;
} catch (Exception e) {
logger.warn("Unable to retrieve group information for user in message: " + e.getMessage(), e);
}