Pulled the local principal implementation class out of the name identifier interface...
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 29 Apr 2005 19:44:01 +0000 (19:44 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 29 Apr 2005 19:44:01 +0000 (19:44 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1435 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/common/NameIdentifierMapping.java
src/edu/internet2/middleware/shibboleth/common/NameMapper.java
src/edu/internet2/middleware/shibboleth/common/provider/AQHNameIdentifierMapping.java
src/edu/internet2/middleware/shibboleth/common/provider/CryptoShibHandle.java
src/edu/internet2/middleware/shibboleth/common/provider/PrincipalNameIdentifier.java
src/edu/internet2/middleware/shibboleth/common/provider/SharedMemoryShibHandle.java
src/edu/internet2/middleware/shibboleth/common/provider/X509SubjectNameNameIdentifierMapping.java
tests/edu/internet2/middleware/shibboleth/common/provider/NameMapperTests.java

index ed0cafd..b7767c6 100644 (file)
 package edu.internet2.middleware.shibboleth.common;
 
 import java.net.URI;
+import java.security.Principal;
 
 import org.opensaml.SAMLNameIdentifier;
 
 /**
- * Defines a mechanism for converting back and forth between SAML Name Identifiers and local {@link AuthNPrincipal}
+ * Defines a mechanism for converting back and forth between SAML Name Identifiers and local {@link LocalPrincipal}
  * objects.
  * 
  * @author Walter Hoehn
@@ -67,7 +68,7 @@ public interface NameIdentifierMapping {
         * @throws InvalidNameIdentifierException
         *             If the {@link SAMLNameIdentifier}contains invalid data
         */
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException;
 
        /**
@@ -83,8 +84,8 @@ public interface NameIdentifierMapping {
         * @throws NameIdentifierMappingException
         *             If the {@link NameMapper}encounters an internal error
         */
-       public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv,
-                       IdentityProvider idProv) throws NameIdentifierMappingException;
+       public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
+                       throws NameIdentifierMappingException;
 
        /**
         * Cleanup resources that won't be released when this object is garbage-collected
index 3309bea..062409d 100644 (file)
@@ -29,6 +29,7 @@ import java.io.StringReader;
 import java.lang.reflect.Constructor;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.security.Principal;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -44,7 +45,7 @@ import edu.internet2.middleware.shibboleth.common.provider.SharedMemoryShibHandl
 import edu.internet2.middleware.shibboleth.xml.Parser;
 
 /**
- * Facility for managing mappings from SAML Name Identifiers to local {@link AuthNPrincipal}objects. Mappings are
+ * Facility for managing mappings from SAML Name Identifiers to local {@link LocalPrincipal}objects. Mappings are
  * registered by Name Identifier format and can be associated with a <code>String</code> id and recovered based on the
  * same.
  * 
@@ -62,7 +63,7 @@ public class NameMapper {
        /** Mapping to use if no other mappings have been added */
        protected SharedMemoryShibHandle defaultMapping;
 
-       //Preload aliases for bundled mappings
+       // Preload aliases for bundled mappings
        static {
                try {
                        registeredMappingTypes.put("CryptoHandleGenerator", Class
@@ -85,11 +86,12 @@ public class NameMapper {
        public NameMapper() {
 
                try {
-                       //Load the default mapping
+                       // Load the default mapping
                        String rawConfig = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
-                                       + "<NameMapping xmlns=\"urn:mace:shibboleth:namemapper:1.0\" format=\"urn:mace:shibboleth:1.0:nameIdentifier\"" + "             handleTTL=\"1800\"/>";
+                                       + "<NameMapping xmlns=\"urn:mace:shibboleth:namemapper:1.0\" format=\"urn:mace:shibboleth:1.0:nameIdentifier\""
+                                       + "             handleTTL=\"1800\"/>";
                        Parser.DOMParser parser = new Parser.DOMParser(false);
-                       parser.parse(new InputSource(new StringReader(rawConfig)));                     
+                       parser.parse(new InputSource(new StringReader(rawConfig)));
                        defaultMapping = new SharedMemoryShibHandle(parser.getDocument().getDocumentElement());
 
                } catch (Exception e) {
@@ -254,7 +256,7 @@ public class NameMapper {
         * @throws InvalidNameIdentifierException
         *             If the {@link SAMLNameIdentifier}contains invalid data
         */
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                NameIdentifierMapping mapping = null;
@@ -283,7 +285,7 @@ public class NameMapper {
         * @throws NameIdentifierMappingException
         *             If the <code>NameMapper</code> encounters an internal error
         */
-       public SAMLNameIdentifier getNameIdentifierName(String id, AuthNPrincipal principal, ServiceProvider sProv,
+       public SAMLNameIdentifier getNameIdentifierName(String id, LocalPrincipal principal, ServiceProvider sProv,
                        IdentityProvider idProv) throws NameIdentifierMappingException {
 
                NameIdentifierMapping mapping = getNameIdentifierMappingById(id);
@@ -299,7 +301,7 @@ public class NameMapper {
 
                private TestNameIdentifierMapping() {
 
-               //Constructor to prevent others from creating this class
+               // Constructor to prevent others from creating this class
                }
 
                /*
@@ -324,7 +326,7 @@ public class NameMapper {
                 *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
                 *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
                 */
-               public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+               public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                                throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                        log.info("Request references built-in test principal.");
@@ -336,7 +338,7 @@ public class NameMapper {
                                                + ") for the referenced subject is not valid for this identity provider.");
                        }
 
-                       return new AuthNPrincipal("test-handle");
+                       return new LocalPrincipal("test-handle");
                }
 
                /*
@@ -346,7 +348,7 @@ public class NameMapper {
                 */
                public void destroy() {
 
-               //Nothing to do
+               // Nothing to do
                }
 
                /*
@@ -362,11 +364,11 @@ public class NameMapper {
                /*
                 * (non-Javadoc)
                 * 
-                * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifierName(edu.internet2.middleware.shibboleth.common.AuthNPrincipal,
+                * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifierName(edu.internet2.middleware.shibboleth.common.LocalPrincipal,
                 *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
                 *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
                 */
-               public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv,
+               public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv,
                                IdentityProvider idProv) throws NameIdentifierMappingException {
 
                        try {
index 3113f30..076cebc 100644 (file)
@@ -32,7 +32,7 @@ import javax.xml.namespace.QName;
 import org.opensaml.SAMLException;
 import org.w3c.dom.Element;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 
 /**
@@ -69,7 +69,7 @@ public abstract class AQHNameIdentifierMapping extends BaseNameIdentifierMapping
                }
        }
 
-       protected HandleEntry createHandleEntry(AuthNPrincipal principal) {
+       protected HandleEntry createHandleEntry(LocalPrincipal principal) {
 
                return new HandleEntry(principal, handleTTL);
        }
@@ -78,7 +78,7 @@ public abstract class AQHNameIdentifierMapping extends BaseNameIdentifierMapping
 class HandleEntry implements Serializable {
 
        static final long serialVersionUID = 1L;
-       protected AuthNPrincipal principal;
+       protected LocalPrincipal principal;
        protected long expirationTime;
 
        /**
@@ -89,7 +89,7 @@ class HandleEntry implements Serializable {
         * @param TTL
         *            the time, in seconds, for which the handle should be valid.
         */
-       protected HandleEntry(AuthNPrincipal principal, long TTL) {
+       protected HandleEntry(LocalPrincipal principal, long TTL) {
 
                this.principal = principal;
                expirationTime = System.currentTimeMillis() + (TTL * 1000);
index a94941a..720b794 100644 (file)
@@ -37,6 +37,7 @@ import java.security.KeyException;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
 import java.security.SecureRandom;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
@@ -57,9 +58,9 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
 import edu.internet2.middleware.shibboleth.common.IdentityProvider;
 import edu.internet2.middleware.shibboleth.common.InvalidNameIdentifierException;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMapping;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 import edu.internet2.middleware.shibboleth.common.ServiceProvider;
@@ -159,7 +160,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
        /**
         * Decode an encrypted handle back into a principal
         */
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                verifyQualifier(nameId, idProv);
@@ -204,7 +205,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                        long decodedExpirationTime = dataStream.readLong();
                        String decodedPrincipal = dataStream.readUTF();
 
-                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(new AuthNPrincipal(decodedPrincipal));
+                       HMACHandleEntry macHandleEntry = createHMACHandleEntry(new LocalPrincipal(decodedPrincipal));
                        macHandleEntry.setExpirationTime(decodedExpirationTime);
                        byte[] generatedMac = macHandleEntry.getMAC(mac);
 
@@ -250,7 +251,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
         * to encode the IV or MAC's lengths. They can be obtained from Cipher.getBlockSize() and Mac.getMacLength(),
         * respectively.
         */
-       public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
+       public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException {
 
                if (principal == null) {
@@ -395,7 +396,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
                return Arrays.equals(defaultKey, encodedKey);
        }
 
-       protected HMACHandleEntry createHMACHandleEntry(AuthNPrincipal principal) {
+       protected HMACHandleEntry createHMACHandleEntry(LocalPrincipal principal) {
 
                return new HMACHandleEntry(principal, handleTTL);
        }
@@ -408,7 +409,7 @@ public class CryptoShibHandle extends AQHNameIdentifierMapping implements NameId
 
 class HMACHandleEntry extends HandleEntry {
 
-       protected HMACHandleEntry(AuthNPrincipal principal, long TTL) {
+       protected HMACHandleEntry(LocalPrincipal principal, long TTL) {
 
                super(principal, TTL);
        }
index b24f697..e799090 100644 (file)
 
 package edu.internet2.middleware.shibboleth.common.provider;
 
+import java.security.Principal;
+
 import org.apache.log4j.Logger;
 import org.opensaml.SAMLException;
 import org.opensaml.SAMLNameIdentifier;
 import org.w3c.dom.Element;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
 import edu.internet2.middleware.shibboleth.common.IdentityProvider;
 import edu.internet2.middleware.shibboleth.common.InvalidNameIdentifierException;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMapping;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 import edu.internet2.middleware.shibboleth.common.ServiceProvider;
@@ -52,15 +54,15 @@ public class PrincipalNameIdentifier extends BaseNameIdentifierMapping {
                super(config);
        }
 
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                verifyQualifier(nameId, idProv);
-               return new AuthNPrincipal(nameId.getName());
+               return new LocalPrincipal(nameId.getName());
        }
 
-       public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv,
-                       IdentityProvider idProv) throws NameIdentifierMappingException {
+       public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
+                       throws NameIdentifierMappingException {
 
                if (principal == null) {
                        log.error("A principal must be supplied for Name Identifier creation.");
index 06416c2..fb00054 100644 (file)
@@ -25,6 +25,7 @@
 
 package edu.internet2.middleware.shibboleth.common.provider;
 
+import java.security.Principal;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -38,9 +39,9 @@ import org.opensaml.SAMLException;
 import org.opensaml.SAMLNameIdentifier;
 import org.w3c.dom.Element;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
 import edu.internet2.middleware.shibboleth.common.IdentityProvider;
 import edu.internet2.middleware.shibboleth.common.InvalidNameIdentifierException;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMapping;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 import edu.internet2.middleware.shibboleth.common.ServiceProvider;
@@ -65,11 +66,11 @@ public class SharedMemoryShibHandle extends AQHNameIdentifierMapping implements
        /*
         * (non-Javadoc)
         * 
-        * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifier(edu.internet2.middleware.shibboleth.common.AuthNPrincipal,
+        * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifier(edu.internet2.middleware.shibboleth.common.LocalPrincipal,
         *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
         *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
         */
-       public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
+       public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException {
 
                if (principal == null) {
@@ -97,7 +98,7 @@ public class SharedMemoryShibHandle extends AQHNameIdentifierMapping implements
         *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
         *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
         */
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                verifyQualifier(nameId, idProv);
index dc47e40..086ebe4 100644 (file)
@@ -1,19 +1,21 @@
 
 package edu.internet2.middleware.shibboleth.common.provider;
 
+import java.security.Principal;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
-import org.apache.log4j.Logger;
 import javax.xml.namespace.QName;
+
+import org.apache.log4j.Logger;
 import org.opensaml.SAMLException;
 import org.opensaml.SAMLNameIdentifier;
 import org.w3c.dom.Element;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
 import edu.internet2.middleware.shibboleth.common.IdentityProvider;
 import edu.internet2.middleware.shibboleth.common.InvalidNameIdentifierException;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMapping;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 import edu.internet2.middleware.shibboleth.common.ServiceProvider;
@@ -71,7 +73,7 @@ public class X509SubjectNameNameIdentifierMapping extends BaseNameIdentifierMapp
         *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
         *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
         */
-       public AuthNPrincipal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
+       public Principal getPrincipal(SAMLNameIdentifier nameId, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException, InvalidNameIdentifierException {
 
                if (!nameId.getNameQualifier().equals(qualifier)) {
@@ -86,17 +88,17 @@ public class X509SubjectNameNameIdentifierMapping extends BaseNameIdentifierMapp
                String principal = matcher.group(1);
                if (principal == null) { throw new InvalidNameIdentifierException("Unable to map X509SubjectName ("
                                + nameId.getName() + ") to a local principal.", errorCodes); }
-               return new AuthNPrincipal(principal);
+               return new LocalPrincipal(principal);
        }
 
        /*
         * (non-Javadoc)
         * 
-        * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifier(edu.internet2.middleware.shibboleth.common.AuthNPrincipal,
+        * @see edu.internet2.middleware.shibboleth.common.NameIdentifierMapping#getNameIdentifier(edu.internet2.middleware.shibboleth.common.LocalPrincipal,
         *      edu.internet2.middleware.shibboleth.common.ServiceProvider,
         *      edu.internet2.middleware.shibboleth.common.IdentityProvider)
         */
-       public SAMLNameIdentifier getNameIdentifier(AuthNPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
+       public SAMLNameIdentifier getNameIdentifier(LocalPrincipal principal, ServiceProvider sProv, IdentityProvider idProv)
                        throws NameIdentifierMappingException {
 
                try {
index 3693ce8..b91f8cf 100644 (file)
@@ -28,6 +28,7 @@ package edu.internet2.middleware.shibboleth.common.provider;
 import java.io.File;
 import java.io.StringReader;
 import java.net.MalformedURLException;
+import java.security.Principal;
 
 import junit.framework.TestCase;
 
@@ -37,15 +38,14 @@ import org.apache.log4j.Logger;
 import org.opensaml.SAMLNameIdentifier;
 import org.xml.sax.InputSource;
 
-import edu.internet2.middleware.shibboleth.common.AuthNPrincipal;
 import edu.internet2.middleware.shibboleth.common.Credential;
 import edu.internet2.middleware.shibboleth.common.IdentityProvider;
 import edu.internet2.middleware.shibboleth.common.InvalidNameIdentifierException;
+import edu.internet2.middleware.shibboleth.common.LocalPrincipal;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMapping;
 import edu.internet2.middleware.shibboleth.common.NameIdentifierMappingException;
 import edu.internet2.middleware.shibboleth.common.NameMapper;
 import edu.internet2.middleware.shibboleth.common.ServiceProvider;
-import edu.internet2.middleware.shibboleth.common.provider.CryptoShibHandle;
 import edu.internet2.middleware.shibboleth.xml.Parser;
 
 /**
@@ -101,10 +101,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new AuthNPrincipal(
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new LocalPrincipal(
                                        "testprincipal"), new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
 
@@ -139,13 +139,13 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new AuthNPrincipal(
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new LocalPrincipal(
                                        "testprincipal"), new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
                        log.debug("Waiting 11 seconds for the handle to expire.");
                        Thread.sleep(11000);
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        fail("Error: crypto handle should have expired but appears to work.");
@@ -186,10 +186,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new AuthNPrincipal(
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new LocalPrincipal(
                                        "testprincipal"), new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
 
@@ -224,10 +224,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new AuthNPrincipal(
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("cryptotest", new LocalPrincipal(
                                        "testprincipal"), new BasicServiceProvider(), new BasicIdentityProvider("urn-x:good"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:bad"));
 
                        fail("Expected failure for bad name qualifier.");
@@ -250,10 +250,10 @@ public class NameMapperTests extends TestCase {
 
                        NameMapper nameMapper = new NameMapper();
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName(null, new AuthNPrincipal("testprincipal"),
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName(null, new LocalPrincipal("testprincipal"),
                                        new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
@@ -286,10 +286,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName(null, new AuthNPrincipal("testprincipal"),
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName(null, new LocalPrincipal("testprincipal"),
                                        new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
@@ -341,7 +341,7 @@ public class NameMapperTests extends TestCase {
 
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       nameMapper.getNameIdentifierName(null, new AuthNPrincipal("testprincipal"), new BasicServiceProvider(),
+                       nameMapper.getNameIdentifierName(null, new LocalPrincipal("testprincipal"), new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        fail("HSNameMapper defaulted to incorrect name mapping.");
@@ -371,10 +371,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("memorytest", new AuthNPrincipal(
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("memorytest", new LocalPrincipal(
                                        "testprincipal"), new BasicServiceProvider(), new BasicIdentityProvider("urn-x:testid"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
@@ -404,10 +404,10 @@ public class NameMapperTests extends TestCase {
                        parser.parse(new InputSource(new StringReader(rawConfig)));
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
-                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("memory", new AuthNPrincipal("testprincipal"),
+                       SAMLNameIdentifier nameId = nameMapper.getNameIdentifierName("memory", new LocalPrincipal("testprincipal"),
                                        new BasicServiceProvider(), new BasicIdentityProvider("urn-x:good"));
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:bad"));
 
                        fail("Expected failure for bad name qualifier.");
@@ -440,7 +440,7 @@ public class NameMapperTests extends TestCase {
                        nameMapper.addNameMapping(parser.getDocument().getDocumentElement());
 
                        SAMLNameIdentifier nameId = new SAMLNameIdentifier("testprincipal", "urn-x:testid", format);
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:testid"));
 
                        assertEquals("Round-trip handle validation failed.", principal.getName(), "testprincipal");
@@ -472,7 +472,7 @@ public class NameMapperTests extends TestCase {
 
                        SAMLNameIdentifier nameId = new SAMLNameIdentifier("testprincipal", "urn-x:good", format);
 
-                       AuthNPrincipal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
+                       Principal principal = nameMapper.getPrincipal(nameId, new BasicServiceProvider(),
                                        new BasicIdentityProvider("urn-x:bad"));
 
                        fail("Expected failure for bad name qualifier.");