Merge branch 'master' into jetty-9.4.x-Feature
This commit is contained in:
commit
6c5b95d6b8
|
@ -2,7 +2,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-project</artifactId>
|
<artifactId>jetty-project</artifactId>
|
||||||
<version>9.1.0-SNAPSHOT</version>
|
<version>9.1.3-SNAPSHOT</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>**/MANIFEST.MF</excludes>
|
<excludes>**/MANIFEST.MF</excludes>
|
||||||
<excludeGroupIds>org.slf4j,org.eclipse.jetty.orbit,org.mortbay.jetty.alpn</excludeGroupIds>
|
<excludeGroupIds>javax.annotations,org.objectweb.asm,javax.servlet,org.slf4j,org.eclipse.jetty.orbit,org.mortbay.jetty.npn</excludeGroupIds>
|
||||||
<outputDirectory>${project.build.directory}/classes</outputDirectory>
|
<outputDirectory>${project.build.directory}/classes</outputDirectory>
|
||||||
<overWriteReleases>false</overWriteReleases>
|
<overWriteReleases>false</overWriteReleases>
|
||||||
<overWriteSnapshots>true</overWriteSnapshots>
|
<overWriteSnapshots>true</overWriteSnapshots>
|
||||||
|
|
|
@ -19,7 +19,7 @@ cpt=application/mac-compactpro
|
||||||
crt=application/x-x509-ca-cert
|
crt=application/x-x509-ca-cert
|
||||||
csh=application/x-csh
|
csh=application/x-csh
|
||||||
css=text/css
|
css=text/css
|
||||||
csv=text/comma-separated-values
|
csv=text/csv
|
||||||
dcr=application/x-director
|
dcr=application/x-director
|
||||||
dir=application/x-director
|
dir=application/x-director
|
||||||
dll=application/x-msdownload
|
dll=application/x-msdownload
|
||||||
|
|
|
@ -73,17 +73,11 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DBUser
|
* DBUser
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DBUserPrincipal extends UserPrincipal
|
public class DBUserPrincipal extends UserPrincipal
|
||||||
{
|
{
|
||||||
private int _key;
|
private int _key;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* @param credential
|
|
||||||
*/
|
|
||||||
public DBUserPrincipal(String name, Credential credential, int key)
|
public DBUserPrincipal(String name, Credential credential, int key)
|
||||||
{
|
{
|
||||||
super(name, credential);
|
super(name, credential);
|
||||||
|
@ -291,10 +285,6 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.security.MappedLoginService#loadUserInfo(java.lang.String)
|
|
||||||
* @Override
|
|
||||||
*/
|
|
||||||
public UserPrincipal loadUserInfo (String username)
|
public UserPrincipal loadUserInfo (String username)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -328,10 +318,6 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.security.MappedLoginService#loadRoleInfo(org.eclipse.jetty.security.UserPrincipal.KnownUser)
|
|
||||||
* @Override
|
|
||||||
*/
|
|
||||||
public String[] loadRoleInfo (UserPrincipal user)
|
public String[] loadRoleInfo (UserPrincipal user)
|
||||||
{
|
{
|
||||||
DBUserPrincipal dbuser = (DBUserPrincipal)user;
|
DBUserPrincipal dbuser = (DBUserPrincipal)user;
|
||||||
|
@ -367,10 +353,6 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -426,8 +408,6 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
prepareTables();
|
prepareTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @throws NamingException
|
* @throws NamingException
|
||||||
|
@ -533,7 +513,6 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
|
@ -546,5 +525,4 @@ public class DataSourceLoginService extends AbstractLoginService
|
||||||
initDb();
|
initDb();
|
||||||
return _datasource.getConnection();
|
return _datasource.getConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,6 @@ import org.eclipse.jetty.util.security.Credential;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractLoginService
|
* AbstractLoginService
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLoginService extends AbstractLifeCycle implements LoginService
|
public abstract class AbstractLoginService extends AbstractLifeCycle implements LoginService
|
||||||
{
|
{
|
||||||
|
@ -46,14 +44,9 @@ public abstract class AbstractLoginService extends AbstractLifeCycle implements
|
||||||
protected boolean _fullValidate = false;
|
protected boolean _fullValidate = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* RolePrincipal
|
* RolePrincipal
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static class RolePrincipal implements Principal,Serializable
|
public static class RolePrincipal implements Principal,Serializable
|
||||||
{
|
{
|
||||||
|
@ -73,8 +66,6 @@ public abstract class AbstractLoginService extends AbstractLifeCycle implements
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* UserPrincipal
|
* UserPrincipal
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static class UserPrincipal implements Principal,Serializable
|
public static class UserPrincipal implements Principal,Serializable
|
||||||
{
|
{
|
||||||
|
@ -118,19 +109,12 @@ public abstract class AbstractLoginService extends AbstractLifeCycle implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected abstract String[] loadRoleInfo (UserPrincipal user);
|
protected abstract String[] loadRoleInfo (UserPrincipal user);
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected abstract UserPrincipal loadUserInfo (String username);
|
protected abstract UserPrincipal loadUserInfo (String username);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jetty.security.LoginService#getName()
|
* @see org.eclipse.jetty.security.LoginService#getName()
|
||||||
|
@ -250,18 +234,12 @@ public abstract class AbstractLoginService extends AbstractLifeCycle implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isFullValidate()
|
public boolean isFullValidate()
|
||||||
{
|
{
|
||||||
return _fullValidate;
|
return _fullValidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @param fullValidate
|
|
||||||
*/
|
|
||||||
public void setFullValidate(boolean fullValidate)
|
public void setFullValidate(boolean fullValidate)
|
||||||
{
|
{
|
||||||
_fullValidate = fullValidate;
|
_fullValidate = fullValidate;
|
||||||
|
|
|
@ -43,7 +43,8 @@ public interface Authenticator
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* Configure the Authenticator
|
* Configure the Authenticator
|
||||||
* @param configuration
|
*
|
||||||
|
* @param configuration the configuration
|
||||||
*/
|
*/
|
||||||
void setConfiguration(AuthConfiguration configuration);
|
void setConfiguration(AuthConfiguration configuration);
|
||||||
|
|
||||||
|
@ -64,13 +65,16 @@ public interface Authenticator
|
||||||
* where the http method of the original request causing authentication
|
* where the http method of the original request causing authentication
|
||||||
* is not the same as the http method resulting from the redirect
|
* is not the same as the http method resulting from the redirect
|
||||||
* after authentication.
|
* after authentication.
|
||||||
* @param request
|
*
|
||||||
|
* @param request the request to manipulate
|
||||||
*/
|
*/
|
||||||
void prepareRequest(ServletRequest request);
|
void prepareRequest(ServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Validate a request
|
/**
|
||||||
|
* Validate a request
|
||||||
|
*
|
||||||
* @param request The request
|
* @param request The request
|
||||||
* @param response The response
|
* @param response The response
|
||||||
* @param mandatory True if authentication is mandatory.
|
* @param mandatory True if authentication is mandatory.
|
||||||
|
@ -79,18 +83,20 @@ public interface Authenticator
|
||||||
* implement {@link org.eclipse.jetty.server.Authentication.ResponseSent}. If Authentication is not manditory, then a
|
* implement {@link org.eclipse.jetty.server.Authentication.ResponseSent}. If Authentication is not manditory, then a
|
||||||
* {@link org.eclipse.jetty.server.Authentication.Deferred} may be returned.
|
* {@link org.eclipse.jetty.server.Authentication.Deferred} may be returned.
|
||||||
*
|
*
|
||||||
* @throws ServerAuthException
|
* @throws ServerAuthException if unable to validate request
|
||||||
*/
|
*/
|
||||||
Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException;
|
Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @param request
|
* is response secure
|
||||||
* @param response
|
*
|
||||||
* @param mandatory
|
* @param request the request
|
||||||
* @param validatedUser
|
* @param response the response
|
||||||
|
* @param mandatory if security is mandator
|
||||||
|
* @param validatedUser the user that was validated
|
||||||
* @return true if response is secure
|
* @return true if response is secure
|
||||||
* @throws ServerAuthException
|
* @throws ServerAuthException if unable to test response
|
||||||
*/
|
*/
|
||||||
boolean secureResponse(ServletRequest request, ServletResponse response, boolean mandatory, User validatedUser) throws ServerAuthException;
|
boolean secureResponse(ServletRequest request, ServletResponse response, boolean mandatory, User validatedUser) throws ServerAuthException;
|
||||||
|
|
||||||
|
@ -106,7 +112,8 @@ public interface Authenticator
|
||||||
String getAuthMethod();
|
String getAuthMethod();
|
||||||
String getRealmName();
|
String getRealmName();
|
||||||
|
|
||||||
/** Get a SecurityHandler init parameter
|
/**
|
||||||
|
* Get a SecurityHandler init parameter
|
||||||
* @see SecurityHandler#getInitParameter(String)
|
* @see SecurityHandler#getInitParameter(String)
|
||||||
* @param param parameter name
|
* @param param parameter name
|
||||||
* @return Parameter value or null
|
* @return Parameter value or null
|
||||||
|
|
|
@ -29,15 +29,15 @@ public interface ConstraintAware
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Set Constraint Mappings and roles.
|
/** Set Constraint Mappings and roles.
|
||||||
* Can only be called during initialization.
|
* Can only be called during initialization.
|
||||||
* @param constraintMappings
|
* @param constraintMappings the mappings
|
||||||
* @param roles
|
* @param roles the roles
|
||||||
*/
|
*/
|
||||||
void setConstraintMappings(List<ConstraintMapping> constraintMappings, Set<String> roles);
|
void setConstraintMappings(List<ConstraintMapping> constraintMappings, Set<String> roles);
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Add a Constraint Mapping.
|
/** Add a Constraint Mapping.
|
||||||
* May be called for running webapplication as an annotated servlet is instantiated.
|
* May be called for running webapplication as an annotated servlet is instantiated.
|
||||||
* @param mapping
|
* @param mapping the mapping
|
||||||
*/
|
*/
|
||||||
void addConstraintMapping(ConstraintMapping mapping);
|
void addConstraintMapping(ConstraintMapping mapping);
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public interface ConstraintAware
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Add a Role definition.
|
/** Add a Role definition.
|
||||||
* May be called on running webapplication as an annotated servlet is instantiated.
|
* May be called on running webapplication as an annotated servlet is instantiated.
|
||||||
* @param role
|
* @param role the role
|
||||||
*/
|
*/
|
||||||
void addRole(String role);
|
void addRole(String role);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public interface ConstraintAware
|
||||||
* See Servlet Spec 31, sec 13.8.4, pg 145
|
* See Servlet Spec 31, sec 13.8.4, pg 145
|
||||||
* When true, requests with http methods not explicitly covered either by inclusion or omissions
|
* When true, requests with http methods not explicitly covered either by inclusion or omissions
|
||||||
* in constraints, will have access denied.
|
* in constraints, will have access denied.
|
||||||
* @param deny
|
* @param deny true for denied method access
|
||||||
*/
|
*/
|
||||||
void setDenyUncoveredHttpMethods(boolean deny);
|
void setDenyUncoveredHttpMethods(boolean deny);
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,6 @@ public class HashLoginService extends AbstractLoginService
|
||||||
protected Resource _configResource;
|
protected Resource _configResource;
|
||||||
protected boolean hotReload = false; // default is not to reload
|
protected boolean hotReload = false; // default is not to reload
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public HashLoginService()
|
public HashLoginService()
|
||||||
|
|
|
@ -41,24 +41,17 @@ import org.eclipse.jetty.util.security.Credential;
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* HashMapped User Realm with JDBC as data source.
|
* HashMapped User Realm with JDBC as data source.
|
||||||
* The login() method checks the inherited Map for the user. If the user is not
|
* The {@link #login(String, Object, ServletRequest)} method checks the inherited Map for the user. If the user is not
|
||||||
* found, it will fetch details from the database and populate the inherited
|
* found, it will fetch details from the database and populate the inherited
|
||||||
* Map. It then calls the superclass login() method to perform the actual
|
* Map. It then calls the superclass {@link #login(String, Object, ServletRequest)} method to perform the actual
|
||||||
* authentication. Periodically (controlled by configuration parameter),
|
* authentication. Periodically (controlled by configuration parameter),
|
||||||
* internal hashes are cleared. Caching can be disabled by setting cache refresh
|
* internal hashes are cleared. Caching can be disabled by setting cache refresh
|
||||||
* interval to zero. Uses one database connection that is initialized at
|
* interval to zero. Uses one database connection that is initialized at
|
||||||
* startup. Reconnect on failures. authenticate() is 'synchronized'.
|
* startup. Reconnect on failures.
|
||||||
*
|
* <p>
|
||||||
* An example properties file for configuration is in
|
* An example properties file for configuration is in
|
||||||
* $JETTY_HOME/etc/jdbcRealm.properties
|
* <code>${jetty.home}/etc/jdbcRealm.properties</code>
|
||||||
*
|
|
||||||
* @version $Id: JDBCLoginService.java 4792 2009-03-18 21:55:52Z gregw $
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class JDBCLoginService extends AbstractLoginService
|
public class JDBCLoginService extends AbstractLoginService
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(JDBCLoginService.class);
|
private static final Logger LOG = Log.getLogger(JDBCLoginService.class);
|
||||||
|
@ -78,17 +71,11 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JDBCKnownUser
|
* JDBCKnownUser
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class JDBCUserPrincipal extends UserPrincipal
|
public class JDBCUserPrincipal extends UserPrincipal
|
||||||
{
|
{
|
||||||
int _userKey;
|
int _userKey;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* @param credential
|
|
||||||
*/
|
|
||||||
public JDBCUserPrincipal(String name, Credential credential, int key)
|
public JDBCUserPrincipal(String name, Credential credential, int key)
|
||||||
{
|
{
|
||||||
super(name, credential);
|
super(name, credential);
|
||||||
|
@ -134,9 +121,6 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.security.MappedLoginService#doStart()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws Exception
|
protected void doStart() throws Exception
|
||||||
{
|
{
|
||||||
|
@ -235,10 +219,6 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.security.MappedLoginService#loadUserInfo(java.lang.String)
|
|
||||||
* @Override
|
|
||||||
*/
|
|
||||||
public UserPrincipal loadUserInfo (String username)
|
public UserPrincipal loadUserInfo (String username)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -275,10 +255,6 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
|
||||||
* @see org.eclipse.jetty.security.MappedLoginService#loadRoleInfo(org.eclipse.jetty.security.UserPrincipal.KnownUser)
|
|
||||||
* @Override
|
|
||||||
*/
|
|
||||||
public String[] loadRoleInfo (UserPrincipal user)
|
public String[] loadRoleInfo (UserPrincipal user)
|
||||||
{
|
{
|
||||||
JDBCUserPrincipal jdbcUser = (JDBCUserPrincipal)user;
|
JDBCUserPrincipal jdbcUser = (JDBCUserPrincipal)user;
|
||||||
|
@ -314,9 +290,7 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
|
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
|
||||||
|
@ -341,5 +315,4 @@ public class JDBCLoginService extends AbstractLoginService
|
||||||
}
|
}
|
||||||
_con = null;
|
_con = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue