[jboss-cvs] JBossAS SVN: r92037 - in projects/security/security-spi/branches/Branch_2_0: spi/src/main/org/jboss/security/mapping and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 5 17:57:54 EDT 2009


Author: anil.saldhana at jboss.com
Date: 2009-08-05 17:57:53 -0400 (Wed, 05 Aug 2009)
New Revision: 92037

Added:
   projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/Attribute.java
   projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/AttributeFactory.java
Modified:
   projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingManager.java
   projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingType.java
Log:
SECURITY-427: mapping type attribute

Copied: projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/Attribute.java (from rev 92030, projects/security/security-spi/trunk/identity/src/main/org/jboss/security/identity/Attribute.java)
===================================================================
--- projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/Attribute.java	                        (rev 0)
+++ projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/Attribute.java	2009-08-05 21:57:53 UTC (rev 92037)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.security.identity;
+
+import java.io.Serializable;
+
+/**
+ * Represents an attribute of the identity
+ * @author Anil.Saldhana at redhat.com
+ */
+public interface Attribute<T> extends Serializable
+{
+   /**
+    * Get the name of the attribute
+    * @return
+    */
+   String getName();
+   
+   /**
+    * The value of the attribute
+    * @return
+    */
+   T getValue();
+   
+   public enum TYPE
+   {
+      COUNTRY("country"),
+      EMAIL_ADDRESS("email"),EMPLOYEE_TYPE("employeeType"),EMPLOYEE_NUMBER("employeeNumber"),
+      GIVEN_NAME("givenName"), 
+      PREFERRED_LANGUAGE("preferredLanguage"), PO_BOX("postOfficeBox"), POSTAL_CODE("postalCode"),
+      POSTAL_ADDRESS("postalAddress"),
+      SURNAME("surname"), STREET("street"), 
+      TITLE("title"), TELEPHONE("telephoneNumber");
+  
+      private String type;
+
+      TYPE(String type)
+      {
+         this.type = type; 
+      }
+      
+      public String get()
+      {
+         return this.type;
+      }
+   }
+}
\ No newline at end of file

Copied: projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/AttributeFactory.java (from rev 92030, projects/security/security-spi/trunk/identity/src/main/org/jboss/security/identity/AttributeFactory.java)
===================================================================
--- projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/AttributeFactory.java	                        (rev 0)
+++ projects/security/security-spi/branches/Branch_2_0/identity/src/main/org/jboss/security/identity/AttributeFactory.java	2009-08-05 21:57:53 UTC (rev 92037)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.security.identity;
+
+/**
+ * Creates Attributes
+ * @author Anil.Saldhana at redhat.com
+ */
+public class AttributeFactory
+{
+   /**
+    * Create an attribute
+    * @param <T>
+    * @param name
+    * @param value
+    * @return
+    */
+   public static <T>  Attribute<T> createAttribute(final String name, final T value)
+   {
+      return new Attribute<T>()
+      { 
+         private static final long serialVersionUID = 1L;
+
+         public String getName()
+         {
+            return name;
+         }
+
+         public T getValue()
+         {
+            return value;
+         }
+      };
+   }
+   
+   /**
+    * Create an email attribute
+    * @param emailAddress
+    * @return
+    */
+   public static Attribute<String> createEmailAddress(final String emailAddress)
+   {
+      return createAttribute(Attribute.TYPE.EMAIL_ADDRESS.get(), emailAddress);
+   }
+}
\ No newline at end of file

Modified: projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingManager.java
===================================================================
--- projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingManager.java	2009-08-05 21:57:17 UTC (rev 92036)
+++ projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingManager.java	2009-08-05 21:57:53 UTC (rev 92037)
@@ -31,5 +31,18 @@
  */
 public interface MappingManager extends BaseSecurityManager
 {
-   <T> MappingContext<T> getMappingContext(Class<T> mappingType); 
+   /**
+    * @deprecated
+    */
+   <T> MappingContext<T> getMappingContext(Class<T> mappingType);
+
+   /**
+    * Get the mapping context based on the type
+    * @see MappingType
+    * 
+    * @param <T>
+    * @param mappingType {@link MappingType}
+    * @return
+    */
+   <T> MappingContext<T> getMappingContext(String mappingType); 
 }
\ No newline at end of file

Modified: projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingType.java
===================================================================
--- projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingType.java	2009-08-05 21:57:17 UTC (rev 92036)
+++ projects/security/security-spi/branches/Branch_2_0/spi/src/main/org/jboss/security/mapping/MappingType.java	2009-08-05 21:57:53 UTC (rev 92037)
@@ -28,7 +28,7 @@
  */
 public enum MappingType 
 {
-   CREDENTIAL("credential"),PRINCIPAL("principal"),ROLE("role");
+   CREDENTIAL("credential"),PRINCIPAL("principal"),ROLE("role"), ATTRIBUTE("attribute");
    
    private String name;
 




More information about the jboss-cvs-commits mailing list