/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.web.tomcat.security;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.security.Principal;
import java.util.List;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.security.auth.Subject;

import org.apache.catalina.Realm;
import org.apache.catalina.net.ServerSocketFactory;
import org.apache.catalina.realm.GenericPrincipal;

import org.jboss.security.SecurityDomain;
import org.jboss.security.ssl.DomainServerSocketFactory;

/**
 * An implementation of the catalina GenericPrincipal to allow caching of
 * security manager invocation results.
 * 
 * @author remm@jboss.org
 * @author Scott.Stark@jboss.org
 * @version $Revision: 1.1.2.3 $
 */
class JBossGenericPrincipal
   extends GenericPrincipal
{
   /** The authenticated user name as a Principal */
   private Principal principal = null;
   /** The authenticated user credentials */
   private Object credentials = null;
   /** The authenticated user Subject */
   private Subject subject = null;

   JBossGenericPrincipal(Realm realm, Subject subject,
      Principal principal, Object credentials, List roles)
   {
      super(realm, principal.getName(), null, roles);
      this.credentials = credentials;
      this.principal = principal;
      this.subject = subject;
   }

   /**
    * Gets the value of principal
    * 
    * @return the value of principal
    */
   Principal getPrincipal()
   {
      return this.principal;
   }

   /**
    * Gets the value of credentials
    * 
    * @return the value of credentials
    */
   Object getCredentials()
   {
      return this.credentials;
   }

   Subject getSubject()
   {
      return subject;
   }

}
