[Bug 359675] Principal != String, fix for issue in property file login

manager
This commit is contained in:
Jesse McConnell 2011-10-03 17:50:35 -05:00
parent c438d7c043
commit b67d307ff3
1 changed files with 11 additions and 2 deletions

View File

@ -14,8 +14,10 @@
package org.eclipse.jetty.plus.jaas.spi;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -108,10 +110,17 @@ public class PropertyFileLoginModule extends AbstractLoginModule
return null;
Set<Principal> principals = userIdentity.getSubject().getPrincipals();
String[] roles = principals.toArray(new String[principals.size()]);
List<String> roles = new ArrayList<String>();
for ( Principal principal : principals )
{
roles.add( principal.getName() );
}
Credential credential = (Credential)userIdentity.getSubject().getPrivateCredentials().iterator().next();
LOG.debug("Found: " + userName + " in PropertyUserStore");
return new UserInfo(userName, credential,Arrays.asList(roles));
return new UserInfo(userName, credential, roles);
}
}