if (logger.isDebugEnabled()) {
logger.debug("Enter: AxisSecurityModel::isUserInRole");
}
SecurityProvider provider = (SecurityProvider)msgContext.getProperty(MessageContext.SECURITY_PROVIDER);
if ( provider instanceof ServletSecurityProvider )
{
// SecurityProvider must not be an instance of ServletSecurityProvider for AxisSecurityModel.
// Thus, provides SimpleSecurityProvider forcelly.
provider = new SimpleSecurityProvider();
}
if (provider != null) {
String userID = msgContext.getUsername();
if (logger.isDebugEnabled()) {
logger.debug("user : " + userID );
}
// in order to authenticate, the user must exist
if ( userID == null || userID.equals("") )
{
logger.debug("userID is null");
return false;
}
String passwd = msgContext.getPassword();
if (logger.isDebugEnabled()) {
logger.debug("password : " + passwd );
}
AuthenticatedUser authUser = provider.authenticate(msgContext);
// if a password is defined, then it must match
if ( authUser == null) {
logger.debug("authuser is null");
return false;
}
for ( String role : rolesAllowed )
{
if (provider.userMatches( authUser, role ) )
{
// BINGO !!
if (logger.isDebugEnabled()) {
logger.debug( "auth : " + userID + " is in role [" + role + "]");