[jboss-svn-commits] JBoss Portal SVN: r5356 - trunk/identity/src/main/org/jboss/portal/identity/auth

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Oct 7 20:27:46 EDT 2006


Author: julien at jboss.com
Date: 2006-10-07 20:27:43 -0400 (Sat, 07 Oct 2006)
New Revision: 5356

Added:
   trunk/identity/src/main/org/jboss/portal/identity/auth/PortalPrincipal.java
Modified:
   trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
Log:
added a portal specific PortalPrincipal in the authenticated subject in order to retrieve the username in a deterministic way

Modified: trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java	2006-10-07 23:16:31 UTC (rev 5355)
+++ trunk/identity/src/main/org/jboss/portal/identity/auth/IdentityLoginModule.java	2006-10-08 00:27:43 UTC (rev 5356)
@@ -218,4 +218,12 @@
          throw new LoginException(cause.toString());
       }
    }
+
+   /**
+    * Subclass to use the PortalPrincipal to make the username easier to retrieve by the portal.
+    */
+   protected Principal createIdentity(String username) throws Exception
+   {
+      return new PortalPrincipal(username);
+   }
 }

Added: trunk/identity/src/main/org/jboss/portal/identity/auth/PortalPrincipal.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/auth/PortalPrincipal.java	2006-10-07 23:16:31 UTC (rev 5355)
+++ trunk/identity/src/main/org/jboss/portal/identity/auth/PortalPrincipal.java	2006-10-08 00:27:43 UTC (rev 5356)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity.auth;
+
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PortalPrincipal implements Principal
+{
+
+   /** . */
+   private final String name;
+
+   public PortalPrincipal(String name)
+   {
+      if (name == null)
+      {
+         throw new IllegalArgumentException("No null principal name accepted");
+      }
+      this.name = name;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public String toString()
+   {
+      return "PortalPrincipal[" + name + "]";
+   }
+}




More information about the jboss-svn-commits mailing list