From b67d307ff3a1e32ea78ea802b9502910a4d448fc Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 3 Oct 2011 17:50:35 -0500 Subject: [PATCH] [Bug 359675] Principal != String, fix for issue in property file login manager --- .../plus/jaas/spi/PropertyFileLoginModule.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/PropertyFileLoginModule.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/PropertyFileLoginModule.java index d3e69878cc1..1e36eb5f5fc 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/PropertyFileLoginModule.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/jaas/spi/PropertyFileLoginModule.java @@ -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 principals = userIdentity.getSubject().getPrincipals(); - String[] roles = principals.toArray(new String[principals.size()]); + + List roles = new ArrayList(); + + 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); } } \ No newline at end of file