Unifed NameMapper and HSNameMapper interfaces for use by the new IdPResponder servlet.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / common / NameIdentifierMapping.java
index 3573502..1b71aec 100644 (file)
@@ -30,13 +30,19 @@ import java.net.URI;
 import org.opensaml.SAMLNameIdentifier;
 
 /**
- * Defines a mechanism for converting SAML Name Identifiers to local {@link AuthNPrincipal}objects.
+ * Defines a mechanism for converting back and forth between SAML Name Identifiers and local {@link AuthNPrincipal}
+ * objects.
  * 
  * @author Walter Hoehn
  */
 public interface NameIdentifierMapping {
 
-       public static final String      mappingNamespace        = "urn:mace:shibboleth:namemapper:1.0";
+       public static final String mappingNamespace = "urn:mace:shibboleth:namemapper:1.0";
+
+       /**
+        * @return the id of this mapping or <code>null</code> is it is not configured with one
+        */
+       public String getId();
 
        /**
         * Returns the Name Identifier format for this mapping.
@@ -65,6 +71,24 @@ public interface NameIdentifierMapping {
                        throws NameIdentifierMappingException, InvalidNameIdentifierException;
 
        /**
+        * Maps a local principal to a SAML Name Identifier.
+        * 
+        * @param id
+        *            the id under which the effective {@link HSNameIdentifierMapping}is registered
+        * @param principal
+        *            the principal to map
+        * @param sProv
+        *            the provider initiating the request
+        * @param idProv
+        *            the provider handling the request
+        * @return the SAML name identifier
+        * @throws NameIdentifierMappingException
+        *             If the {@link NameMapper}encounters an internal error
+        */
+       public SAMLNameIdentifier getNameIdentifierName(AuthNPrincipal principal, ServiceProvider sProv,
+                       IdentityProvider idProv) throws NameIdentifierMappingException;
+
+       /**
         * Cleanup resources that won't be released when this object is garbage-collected
         */
        public void destroy();