org.eclipse.jetty.security_8.1.3.v20120522

16:45:24.216 INFO  jd.cli.Main - Decompiling org.eclipse.jetty.security_8.1.3.v20120522.jar
package org.eclipse.jetty.security;

import java.security.Principal;

final class SecurityHandler$1
  implements Principal
{
  public String getName()
  {
    return null;
  }
  
  public String toString()
  {
    return "No User";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.SecurityHandler.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.Serializable;

public class MappedLoginService$Anonymous
  implements MappedLoginService.UserPrincipal, Serializable
{
  private static final long serialVersionUID = 1097640442553284845L;
  
  public boolean isAuthenticated()
  {
    return false;
  }
  
  public String getName()
  {
    return "Anonymous";
  }
  
  public boolean authenticate(Object credentials)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.MappedLoginService.Anonymous
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.util.List;
import java.util.Set;

public abstract interface ConstraintAware
{
  public abstract List<ConstraintMapping> getConstraintMappings();
  
  public abstract Set<String> getRoles();
  
  public abstract void setConstraintMappings(List<ConstraintMapping> paramList, Set<String> paramSet);
  
  public abstract void addConstraintMapping(ConstraintMapping paramConstraintMapping);
  
  public abstract void addRole(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.ConstraintAware
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.GeneralSecurityException;

public class ServerAuthException
  extends GeneralSecurityException
{
  public ServerAuthException() {}
  
  public ServerAuthException(String s)
  {
    super(s);
  }
  
  public ServerAuthException(String s, Throwable throwable)
  {
    super(s, throwable);
  }
  
  public ServerAuthException(Throwable throwable)
  {
    super(throwable);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.ServerAuthException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.Principal;

final class SecurityHandler$2
  implements Principal
{
  public String getName()
  {
    return "Nobody";
  }
  
  public String toString()
  {
    return getName();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.SecurityHandler.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ConcurrentMap;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.security.Credential;

public class JDBCLoginService
  extends MappedLoginService
{
  private static final Logger LOG = Log.getLogger(JDBCLoginService.class);
  private String _config;
  private String _jdbcDriver;
  private String _url;
  private String _userName;
  private String _password;
  private String _userTableKey;
  private String _userTablePasswordField;
  private String _roleTableRoleField;
  private int _cacheTime;
  private long _lastHashPurge;
  private Connection _con;
  private String _userSql;
  private String _roleSql;
  
  public JDBCLoginService()
    throws IOException
  {}
  
  public JDBCLoginService(String name)
    throws IOException
  {
    setName(name);
  }
  
  public JDBCLoginService(String name, String config)
    throws IOException
  {
    setName(name);
    setConfig(config);
  }
  
  public JDBCLoginService(String name, IdentityService identityService, String config)
    throws IOException
  {
    setName(name);
    setIdentityService(identityService);
    setConfig(config);
  }
  
  protected void doStart()
    throws Exception
  {
    Properties properties = new Properties();
    Resource resource = Resource.newResource(_config);
    properties.load(resource.getInputStream());
    
    _jdbcDriver = properties.getProperty("jdbcdriver");
    _url = properties.getProperty("url");
    _userName = properties.getProperty("username");
    _password = properties.getProperty("password");
    String _userTable = properties.getProperty("usertable");
    _userTableKey = properties.getProperty("usertablekey");
    String _userTableUserField = properties.getProperty("usertableuserfield");
    _userTablePasswordField = properties.getProperty("usertablepasswordfield");
    String _roleTable = properties.getProperty("roletable");
    String _roleTableKey = properties.getProperty("roletablekey");
    _roleTableRoleField = properties.getProperty("roletablerolefield");
    String _userRoleTable = properties.getProperty("userroletable");
    String _userRoleTableUserKey = properties.getProperty("userroletableuserkey");
    String _userRoleTableRoleKey = properties.getProperty("userroletablerolekey");
    _cacheTime = new Integer(properties.getProperty("cachetime")).intValue();
    if ((_jdbcDriver == null) || (_jdbcDriver.equals("")) || (_url == null) || (_url.equals("")) || (_userName == null) || (_userName.equals("")) || (_password == null) || (_cacheTime < 0)) {
      LOG.warn("UserRealm " + getName() + " has not been properly configured", new Object[0]);
    }
    _cacheTime *= 1000;
    _lastHashPurge = 0L;
    _userSql = ("select " + _userTableKey + "," + _userTablePasswordField + " from " + _userTable + " where " + _userTableUserField + " = ?");
    _roleSql = ("select r." + _roleTableRoleField + " from " + _roleTable + " r, " + _userRoleTable + " u where u." + _userRoleTableUserKey + " = ?" + " and r." + _roleTableKey + " = u." + _userRoleTableRoleKey);
    
    Loader.loadClass(getClass(), _jdbcDriver).newInstance();
    super.doStart();
  }
  
  public String getConfig()
  {
    return _config;
  }
  
  public void setConfig(String config)
  {
    if (isRunning()) {
      throw new IllegalStateException("Running");
    }
    _config = config;
  }
  
  public void connectDatabase()
  {
    try
    {
      Class.forName(_jdbcDriver);
      _con = DriverManager.getConnection(_url, _userName, _password);
    }
    catch (SQLException e)
    {
      LOG.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
    }
    catch (ClassNotFoundException e)
    {
      LOG.warn("UserRealm " + getName() + " could not connect to database; will try later", e);
    }
  }
  
  public UserIdentity login(String username, Object credentials)
  {
    long now = System.currentTimeMillis();
    if ((now - _lastHashPurge > _cacheTime) || (_cacheTime == 0))
    {
      _users.clear();
      _lastHashPurge = now;
      closeConnection();
    }
    return super.login(username, credentials);
  }
  
  protected void loadUsers() {}
  
  protected UserIdentity loadUser(String username)
  {
    try
    {
      if (null == _con) {
        connectDatabase();
      }
      if (null == _con) {
        throw new SQLException("Can't connect to database");
      }
      PreparedStatement stat = _con.prepareStatement(_userSql);
      stat.setObject(1, username);
      ResultSet rs = stat.executeQuery();
      if (rs.next())
      {
        int key = rs.getInt(_userTableKey);
        String credentials = rs.getString(_userTablePasswordField);
        stat.close();
        
        stat = _con.prepareStatement(_roleSql);
        stat.setInt(1, key);
        rs = stat.executeQuery();
        List<String> roles = new ArrayList();
        while (rs.next()) {
          roles.add(rs.getString(_roleTableRoleField));
        }
        stat.close();
        return putUser(username, Credential.getCredential(credentials), (String[])roles.toArray(new String[roles.size()]));
      }
    }
    catch (SQLException e)
    {
      LOG.warn("UserRealm " + getName() + " could not load user information from database", e);
      closeConnection();
    }
    return null;
  }
  
  private void closeConnection()
  {
    if (_con != null)
    {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Closing db connection for JDBCUserRealm", new Object[0]);
      }
      try
      {
        _con.close();
      }
      catch (Exception e)
      {
        LOG.ignore(e);
      }
    }
    _con = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.JDBCLoginService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract interface CrossContextPsuedoSession<T>
{
  public abstract T fetch(HttpServletRequest paramHttpServletRequest);
  
  public abstract void store(T paramT, HttpServletResponse paramHttpServletResponse);
  
  public abstract void clear(HttpServletRequest paramHttpServletRequest);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.CrossContextPsuedoSession
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

class SecurityHandler$3 {}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.SecurityHandler.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.Principal;
import javax.security.auth.Subject;
import org.eclipse.jetty.server.UserIdentity;

public abstract interface IdentityService
{
  public static final String[] NO_ROLES = new String[0];
  
  public abstract Object associate(UserIdentity paramUserIdentity);
  
  public abstract void disassociate(Object paramObject);
  
  public abstract Object setRunAs(UserIdentity paramUserIdentity, RunAsToken paramRunAsToken);
  
  public abstract void unsetRunAs(Object paramObject);
  
  public abstract UserIdentity newUserIdentity(Subject paramSubject, Principal paramPrincipal, String[] paramArrayOfString);
  
  public abstract RunAsToken newRunAsToken(String paramString);
  
  public abstract UserIdentity getSystemUserIdentity();
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.IdentityService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import javax.security.auth.Subject;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.Scanner.BulkListener;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.security.Credential;

public class PropertyUserStore
  extends AbstractLifeCycle
{
  private static final Logger LOG = Log.getLogger(PropertyUserStore.class);
  private String _config;
  private Resource _configResource;
  private Scanner _scanner;
  private int _refreshInterval;
  private IdentityService _identityService;
  private boolean _firstLoad;
  private final List<String> _knownUsers;
  private final Map<String, UserIdentity> _knownUserIdentities;
  private List<UserListener> _listeners;
  
  public PropertyUserStore()
  {
    _refreshInterval = 0;
    
    _identityService = new DefaultIdentityService();
    _firstLoad = true;
    _knownUsers = new ArrayList();
    _knownUserIdentities = new HashMap();
  }
  
  public String getConfig()
  {
    return _config;
  }
  
  public void setConfig(String config)
  {
    _config = config;
  }
  
  public UserIdentity getUserIdentity(String userName)
  {
    return (UserIdentity)_knownUserIdentities.get(userName);
  }
  
  public Resource getConfigResource()
    throws IOException
  {
    if (_configResource == null) {
      _configResource = Resource.newResource(_config);
    }
    return _configResource;
  }
  
  public void setRefreshInterval(int msec)
  {
    _refreshInterval = msec;
  }
  
  public int getRefreshInterval()
  {
    return _refreshInterval;
  }
  
  private void loadUsers()
    throws IOException
  {
    if (_config == null) {
      return;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("Load " + this + " from " + _config, new Object[0]);
    }
    Properties properties = new Properties();
    if (getConfigResource().exists()) {
      properties.load(getConfigResource().getInputStream());
    }
    Set<String> known = new HashSet();
    for (Map.Entry<Object, Object> entry : properties.entrySet())
    {
      String username = ((String)entry.getKey()).trim();
      String credentials = ((String)entry.getValue()).trim();
      String roles = null;
      int c = credentials.indexOf(',');
      if (c > 0)
      {
        roles = credentials.substring(c + 1).trim();
        credentials = credentials.substring(0, c).trim();
      }
      if ((username != null) && (username.length() > 0) && (credentials != null) && (credentials.length() > 0))
      {
        String[] roleArray = IdentityService.NO_ROLES;
        if ((roles != null) && (roles.length() > 0)) {
          roleArray = roles.split(",");
        }
        known.add(username);
        Credential credential = Credential.getCredential(credentials);
        
        Principal userPrincipal = new MappedLoginService.KnownUser(username, credential);
        Subject subject = new Subject();
        subject.getPrincipals().add(userPrincipal);
        subject.getPrivateCredentials().add(credential);
        if (roles != null) {
          for (String role : roleArray) {
            subject.getPrincipals().add(new MappedLoginService.RolePrincipal(role));
          }
        }
        subject.setReadOnly();
        
        _knownUserIdentities.put(username, _identityService.newUserIdentity(subject, userPrincipal, roleArray));
        notifyUpdate(username, credential, roleArray);
      }
    }
    synchronized (_knownUsers)
    {
      if (!_firstLoad)
      {
        Iterator<String> users = _knownUsers.iterator();
        while (users.hasNext())
        {
          String user = (String)users.next();
          if (!known.contains(user))
          {
            _knownUserIdentities.remove(user);
            notifyRemove(user);
          }
        }
      }
      _knownUsers.clear();
      _knownUsers.addAll(known);
    }
    _firstLoad = false;
  }
  
  protected void doStart()
    throws Exception
  {
    super.doStart();
    if (getRefreshInterval() > 0)
    {
      _scanner = new Scanner();
      _scanner.setScanInterval(getRefreshInterval());
      List<File> dirList = new ArrayList(1);
      dirList.add(getConfigResource().getFile().getParentFile());
      _scanner.setScanDirs(dirList);
      _scanner.setFilenameFilter(new FilenameFilter()
      {
        public boolean accept(File dir, String name)
        {
          File f = new File(dir, name);
          try
          {
            if (f.compareTo(getConfigResource().getFile()) == 0) {
              return true;
            }
          }
          catch (IOException e)
          {
            return false;
          }
          return false;
        }
      });
      _scanner.addListener(new Scanner.BulkListener()
      {
        public void filesChanged(List<String> filenames)
          throws Exception
        {
          if (filenames == null) {
            return;
          }
          if (filenames.isEmpty()) {
            return;
          }
          if (filenames.size() == 1)
          {
            Resource r = Resource.newResource((String)filenames.get(0));
            if (r.getFile().equals(_configResource.getFile())) {
              PropertyUserStore.this.loadUsers();
            }
          }
        }
        
        public String toString()
        {
          return "PropertyUserStore$Scanner";
        }
      });
      _scanner.setReportExistingFilesOnStartup(true);
      _scanner.setRecursive(false);
      _scanner.start();
    }
    else
    {
      loadUsers();
    }
  }
  
  protected void doStop()
    throws Exception
  {
    super.doStop();
    if (_scanner != null) {
      _scanner.stop();
    }
    _scanner = null;
  }
  
  private void notifyUpdate(String username, Credential credential, String[] roleArray)
  {
    Iterator<UserListener> i;
    if (_listeners != null) {
      for (i = _listeners.iterator(); i.hasNext();) {
        ((UserListener)i.next()).update(username, credential, roleArray);
      }
    }
  }
  
  private void notifyRemove(String username)
  {
    Iterator<UserListener> i;
    if (_listeners != null) {
      for (i = _listeners.iterator(); i.hasNext();) {
        ((UserListener)i.next()).remove(username);
      }
    }
  }
  
  public void registerUserListener(UserListener listener)
  {
    if (_listeners == null) {
      _listeners = new ArrayList();
    }
    _listeners.add(listener);
  }
  
  public static abstract interface UserListener
  {
    public abstract void update(String paramString, Credential paramCredential, String[] paramArrayOfString);
    
    public abstract void remove(String paramString);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.PropertyUserStore
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.IOException;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.security.Credential;

public class HashLoginService
  extends MappedLoginService
  implements PropertyUserStore.UserListener
{
  private static final Logger LOG = Log.getLogger(HashLoginService.class);
  private PropertyUserStore _propertyUserStore;
  private String _config;
  private Resource _configResource;
  private Scanner _scanner;
  private int _refreshInterval = 0;
  
  public HashLoginService() {}
  
  public HashLoginService(String name)
  {
    setName(name);
  }
  
  public HashLoginService(String name, String config)
  {
    setName(name);
    setConfig(config);
  }
  
  public String getConfig()
  {
    return _config;
  }
  
  public void getConfig(String config)
  {
    _config = config;
  }
  
  public Resource getConfigResource()
  {
    return _configResource;
  }
  
  public void setConfig(String config)
  {
    _config = config;
  }
  
  public void setRefreshInterval(int msec)
  {
    _refreshInterval = msec;
  }
  
  public int getRefreshInterval()
  {
    return _refreshInterval;
  }
  
  protected UserIdentity loadUser(String username)
  {
    return null;
  }
  
  public void loadUsers()
    throws IOException
  {}
  
  protected void doStart()
    throws Exception
  {
    super.doStart();
    if (_propertyUserStore == null)
    {
      if (LOG.isDebugEnabled()) {
        LOG.debug("doStart: Starting new PropertyUserStore. PropertiesFile: " + _config + " refreshInterval: " + _refreshInterval, new Object[0]);
      }
      _propertyUserStore = new PropertyUserStore();
      _propertyUserStore.setRefreshInterval(_refreshInterval);
      _propertyUserStore.setConfig(_config);
      _propertyUserStore.registerUserListener(this);
      _propertyUserStore.start();
    }
  }
  
  protected void doStop()
    throws Exception
  {
    super.doStop();
    if (_scanner != null) {
      _scanner.stop();
    }
    _scanner = null;
  }
  
  public void update(String userName, Credential credential, String[] roleArray)
  {
    if (LOG.isDebugEnabled()) {
      LOG.debug("update: " + userName + " Roles: " + roleArray.length, new Object[0]);
    }
    putUser(userName, credential, roleArray);
  }
  
  public void remove(String userName)
  {
    if (LOG.isDebugEnabled()) {
      LOG.debug("remove: " + userName, new Object[0]);
    }
    removeUser(userName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.HashLoginService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HashCrossContextPsuedoSession<T>
  implements CrossContextPsuedoSession<T>
{
  private final String _cookieName;
  private final String _cookiePath;
  private final Random _random = new SecureRandom();
  private final Map<String, T> _data = new HashMap();
  
  public HashCrossContextPsuedoSession(String cookieName, String cookiePath)
  {
    _cookieName = cookieName;
    _cookiePath = (cookiePath == null ? "/" : cookiePath);
  }
  
  public T fetch(HttpServletRequest request)
  {
    for (Cookie cookie : request.getCookies()) {
      if (_cookieName.equals(cookie.getName()))
      {
        String key = cookie.getValue();
        return (T)_data.get(key);
      }
    }
    return null;
  }
  
  public void store(T datum, HttpServletResponse response)
  {
    String key;
    synchronized (_data)
    {
      for (;;)
      {
        key = Long.toString(Math.abs(_random.nextLong()), 30 + (int)(System.currentTimeMillis() % 7L));
        if (!_data.containsKey(key)) {
          break;
        }
      }
      _data.put(key, datum);
    }
    Cookie cookie = new Cookie(_cookieName, key);
    cookie.setPath(_cookiePath);
    response.addCookie(cookie);
  }
  
  public void clear(HttpServletRequest request)
  {
    for (Cookie cookie : request.getCookies()) {
      if (_cookieName.equals(cookie.getName()))
      {
        String key = cookie.getValue();
        _data.remove(key);
        break;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.HashCrossContextPsuedoSession
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.Principal;
import java.util.Map;
import javax.security.auth.Subject;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.server.UserIdentity.Scope;

public class DefaultUserIdentity
  implements UserIdentity
{
  private final Subject _subject;
  private final Principal _userPrincipal;
  private final String[] _roles;
  
  public DefaultUserIdentity(Subject subject, Principal userPrincipal, String[] roles)
  {
    _subject = subject;
    _userPrincipal = userPrincipal;
    _roles = roles;
  }
  
  public Subject getSubject()
  {
    return _subject;
  }
  
  public Principal getUserPrincipal()
  {
    return _userPrincipal;
  }
  
  public boolean isUserInRole(String role, UserIdentity.Scope scope)
  {
    if ((scope != null) && (scope.getRoleRefMap() != null)) {
      role = (String)scope.getRoleRefMap().get(role);
    }
    for (String r : _roles) {
      if (r.equals(role)) {
        return true;
      }
    }
    return false;
  }
  
  public String toString()
  {
    return DefaultUserIdentity.class.getSimpleName() + "('" + _userPrincipal + "')";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.DefaultUserIdentity
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.Principal;
import org.eclipse.jetty.util.security.B64Code;

public class SpnegoUserPrincipal
  implements Principal
{
  private final String _name;
  private byte[] _token;
  private String _encodedToken;
  
  public SpnegoUserPrincipal(String name, String encodedToken)
  {
    _name = name;
    _encodedToken = encodedToken;
  }
  
  public SpnegoUserPrincipal(String name, byte[] token)
  {
    _name = name;
    _token = token;
  }
  
  public String getName()
  {
    return _name;
  }
  
  public byte[] getToken()
  {
    if (_token == null) {
      _token = B64Code.decode(_encodedToken);
    }
    return _token;
  }
  
  public String getEncodedToken()
  {
    if (_encodedToken == null) {
      _encodedToken = new String(B64Code.encode(_token, true));
    }
    return _encodedToken;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.SpnegoUserPrincipal
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import org.eclipse.jetty.util.security.Constraint;

public class ConstraintMapping
{
  String _method;
  String[] _methodOmissions;
  String _pathSpec;
  Constraint _constraint;
  
  public Constraint getConstraint()
  {
    return _constraint;
  }
  
  public void setConstraint(Constraint constraint)
  {
    _constraint = constraint;
  }
  
  public String getMethod()
  {
    return _method;
  }
  
  public void setMethod(String method)
  {
    _method = method;
  }
  
  public String getPathSpec()
  {
    return _pathSpec;
  }
  
  public void setPathSpec(String pathSpec)
  {
    _pathSpec = pathSpec;
  }
  
  public void setMethodOmissions(String[] omissions)
  {
    _methodOmissions = omissions;
  }
  
  public String[] getMethodOmissions()
  {
    return _methodOmissions;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.ConstraintMapping
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

public class RoleInfo
{
  private boolean _isAnyRole;
  private boolean _checked;
  private boolean _forbidden;
  private UserDataConstraint _userDataConstraint;
  private final Set<String> _roles = new CopyOnWriteArraySet();
  
  public boolean isChecked()
  {
    return _checked;
  }
  
  public void setChecked(boolean checked)
  {
    _checked = checked;
    if (!checked)
    {
      _forbidden = false;
      _roles.clear();
      _isAnyRole = false;
    }
  }
  
  public boolean isForbidden()
  {
    return _forbidden;
  }
  
  public void setForbidden(boolean forbidden)
  {
    _forbidden = forbidden;
    if (forbidden)
    {
      _checked = true;
      _userDataConstraint = null;
      _isAnyRole = false;
      _roles.clear();
    }
  }
  
  public boolean isAnyRole()
  {
    return _isAnyRole;
  }
  
  public void setAnyRole(boolean anyRole)
  {
    _isAnyRole = anyRole;
    if (anyRole)
    {
      _checked = true;
      _roles.clear();
    }
  }
  
  public UserDataConstraint getUserDataConstraint()
  {
    return _userDataConstraint;
  }
  
  public void setUserDataConstraint(UserDataConstraint userDataConstraint)
  {
    if (userDataConstraint == null) {
      throw new NullPointerException("Null UserDataConstraint");
    }
    if (_userDataConstraint == null) {
      _userDataConstraint = userDataConstraint;
    } else {
      _userDataConstraint = _userDataConstraint.combine(userDataConstraint);
    }
  }
  
  public Set<String> getRoles()
  {
    return _roles;
  }
  
  public void addRole(String role)
  {
    _roles.add(role);
  }
  
  public void combine(RoleInfo other)
  {
    if (_forbidden) {
      setForbidden(true);
    } else if (!_checked) {
      setChecked(true);
    } else if (_isAnyRole) {
      setAnyRole(true);
    } else if (!_isAnyRole) {
      for (String r : _roles) {
        _roles.add(r);
      }
    }
    setUserDataConstraint(_userDataConstraint);
  }
  
  public String toString()
  {
    return "{RoleInfo" + (_forbidden ? ",F" : "") + (_checked ? ",C" : "") + (_isAnyRole ? ",*" : _roles) + "}";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.RoleInfo
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import org.eclipse.jetty.server.Authentication;
import org.eclipse.jetty.server.Authentication.User;
import org.eclipse.jetty.server.Server;

public abstract interface Authenticator
{
  public abstract void setConfiguration(AuthConfiguration paramAuthConfiguration);
  
  public abstract String getAuthMethod();
  
  public abstract Authentication validateRequest(ServletRequest paramServletRequest, ServletResponse paramServletResponse, boolean paramBoolean)
    throws ServerAuthException;
  
  public abstract boolean secureResponse(ServletRequest paramServletRequest, ServletResponse paramServletResponse, boolean paramBoolean, Authentication.User paramUser)
    throws ServerAuthException;
  
  public static abstract interface AuthConfiguration
  {
    public abstract String getAuthMethod();
    
    public abstract String getRealmName();
    
    public abstract String getInitParameter(String paramString);
    
    public abstract Set<String> getInitParameterNames();
    
    public abstract LoginService getLoginService();
    
    public abstract IdentityService getIdentityService();
    
    public abstract boolean isSessionRenewedOnAuthentication();
  }
  
  public static abstract interface Factory
  {
    public abstract Authenticator getAuthenticator(Server paramServer, ServletContext paramServletContext, Authenticator.AuthConfiguration paramAuthConfiguration, IdentityService paramIdentityService, LoginService paramLoginService);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.Authenticator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.security.Principal;
import javax.security.auth.Subject;
import org.eclipse.jetty.server.UserIdentity;

public class DefaultIdentityService
  implements IdentityService
{
  public Object associate(UserIdentity user)
  {
    return null;
  }
  
  public void disassociate(Object previous) {}
  
  public Object setRunAs(UserIdentity user, RunAsToken token)
  {
    return token;
  }
  
  public void unsetRunAs(Object lastToken) {}
  
  public RunAsToken newRunAsToken(String runAsName)
  {
    return new RoleRunAsToken(runAsName);
  }
  
  public UserIdentity getSystemUserIdentity()
  {
    return null;
  }
  
  public UserIdentity newUserIdentity(Subject subject, Principal userPrincipal, String[] roles)
  {
    return new DefaultUserIdentity(subject, userPrincipal, roles);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.DefaultIdentityService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import org.eclipse.jetty.server.UserIdentity;

public abstract interface LoginService
{
  public abstract String getName();
  
  public abstract UserIdentity login(String paramString, Object paramObject);
  
  public abstract boolean validate(UserIdentity paramUserIdentity);
  
  public abstract IdentityService getIdentityService();
  
  public abstract void setIdentityService(IdentityService paramIdentityService);
  
  public abstract void logout(UserIdentity paramUserIdentity);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.LoginService
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

public abstract interface RunAsToken {}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.RunAsToken
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.Serializable;
import java.security.Principal;

public abstract interface MappedLoginService$UserPrincipal
  extends Principal, Serializable
{
  public abstract boolean authenticate(Object paramObject);
  
  public abstract boolean isAuthenticated();
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.MappedLoginService.UserPrincipal
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import org.eclipse.jetty.server.Authentication.User;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.server.UserIdentity.Scope;

public class UserAuthentication
  implements Authentication.User
{
  private final String _method;
  private final UserIdentity _userIdentity;
  
  public UserAuthentication(String method, UserIdentity userIdentity)
  {
    _method = method;
    _userIdentity = userIdentity;
  }
  
  public String getAuthMethod()
  {
    return _method;
  }
  
  public UserIdentity getUserIdentity()
  {
    return _userIdentity;
  }
  
  public boolean isUserInRole(UserIdentity.Scope scope, String role)
  {
    return _userIdentity.isUserInRole(role, scope);
  }
  
  public String toString()
  {
    return "{User," + getAuthMethod() + "," + _userIdentity + "}";
  }
  
  public void logout()
  {
    SecurityHandler security = SecurityHandler.getCurrentSecurityHandler();
    if (security != null) {
      security.logout(this);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.UserAuthentication
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.util.Set;

public abstract interface Authenticator$AuthConfiguration
{
  public abstract String getAuthMethod();
  
  public abstract String getRealmName();
  
  public abstract String getInitParameter(String paramString);
  
  public abstract Set<String> getInitParameterNames();
  
  public abstract LoginService getLoginService();
  
  public abstract IdentityService getIdentityService();
  
  public abstract boolean isSessionRenewedOnAuthentication();
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.Authenticator.AuthConfiguration
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import javax.servlet.ServletContext;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.security.authentication.ClientCertAuthenticator;
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
import org.eclipse.jetty.security.authentication.FormAuthenticator;
import org.eclipse.jetty.security.authentication.SpnegoAuthenticator;
import org.eclipse.jetty.server.Server;

public class DefaultAuthenticatorFactory
  implements Authenticator.Factory
{
  LoginService _loginService;
  
  public Authenticator getAuthenticator(Server server, ServletContext context, Authenticator.AuthConfiguration configuration, IdentityService identityService, LoginService loginService)
  {
    String auth = configuration.getAuthMethod();
    Authenticator authenticator = null;
    if ((auth == null) || ("BASIC".equalsIgnoreCase(auth))) {
      authenticator = new BasicAuthenticator();
    } else if ("DIGEST".equalsIgnoreCase(auth)) {
      authenticator = new DigestAuthenticator();
    } else if ("FORM".equalsIgnoreCase(auth)) {
      authenticator = new FormAuthenticator();
    } else if ("SPNEGO".equalsIgnoreCase(auth)) {
      authenticator = new SpnegoAuthenticator();
    }
    if (("CLIENT_CERT".equalsIgnoreCase(auth)) || ("CLIENT-CERT".equalsIgnoreCase(auth))) {
      authenticator = new ClientCertAuthenticator();
    }
    return authenticator;
  }
  
  public LoginService getLoginService()
  {
    return _loginService;
  }
  
  public void setLoginService(LoginService loginService)
  {
    _loginService = loginService;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.DefaultAuthenticatorFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import org.eclipse.jetty.util.resource.Resource;

class PropertyUserStore$1
  implements FilenameFilter
{
  PropertyUserStore$1(PropertyUserStore paramPropertyUserStore) {}
  
  public boolean accept(File dir, String name)
  {
    File f = new File(dir, name);
    try
    {
      if (f.compareTo(this$0.getConfigResource().getFile()) == 0) {
        return true;
      }
    }
    catch (IOException e)
    {
      return false;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.PropertyUserStore.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security;

import javax.servlet.ServletContext;
import org.eclipse.jetty.server.Server;

public abstract interface Authenticator$Factory
{
  public abstract Authenticator getAuthenticator(Server paramServer, ServletContext paramServletContext, Authenticator.AuthConfiguration paramAuthConfiguration, IdentityService paramIdentityService, LoginService paramLoginService);
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.Authenticator.Factory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jetty.security.authentication;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.util.IO;

final class DeferredAuthentication$1
  implements HttpServletResponse
{
  public void addCookie(Cookie cookie) {}
  
  public void addDateHeader(String name, long date) {}
  
  public void addHeader(String name, String value) {}
  
  public void addIntHeader(String name, int value) {}
  
  public boolean containsHeader(String name)
  {
    return false;
  }
  
  public String encodeRedirectURL(String url)
  {
    return null;
  }
  
  public String encodeRedirectUrl(String url)
  {
    return null;
  }
  
  public String encodeURL(String url)
  {
    return null;
  }
  
  public String encodeUrl(String url)
  {
    return null;
  }
  
  public void sendError(int sc)
    throws IOException
  {}
  
  public void sendError(int sc, String msg)
    throws IOException
  {}
  
  public void sendRedirect(String location)
    throws IOException
  {}
  
  public void setDateHeader(String name, long date) {}
  
  public void setHeader(String name, String value) {}
  
  public void setIntHeader(String name, int value) {}
  
  public void setStatus(int sc) {}
  
  public void setStatus(int sc, String sm) {}
  
  public void flushBuffer()
    throws IOException
  {}
  
  public int getBufferSize()
  {
    return 1024;
  }
  
  public String getCharacterEncoding()
  {
    return null;
  }
  
  public String getContentType()
  {
    return null;
  }
  
  public Locale getLocale()
  {
    return null;
  }
  
  public ServletOutputStream getOutputStream()
    throws IOException
  {
    return DeferredAuthentication.access$000();
  }
  
  public PrintWriter getWriter()
    throws IOException
  {
    return IO.getNullPrintWriter();
  }
  
  public boolean isCommitted()
  {
    return true;
  }
  
  public void reset() {}
  
  public void resetBuffer() {}
  
  public void setBufferSize(int size) {}
  
  public void setCharacterEncoding(String charset) {}
  
  public void setContentLength(int len) {}
  
  public void setContentType(String type) {}
  
  public void setLocale(Locale loc) {}
  
  public Collection<String> getHeaderNames()
  {
    return Collections.emptyList();
  }
  
  public String getHeader(String arg0)
  {
    return null;
  }
  
  public Collection<String> getHeaders(String arg0)
  {
    return Collections.emptyList();
  }
  
  public int getStatus()
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jetty.security.authentication.DeferredAuthentication.1
 * Java Class Versi
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd