Removed web dependency on core-tests
This commit is contained in:
@@ -14,10 +14,6 @@
|
||||
*/
|
||||
package org.springframework.security.access.vote;
|
||||
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
@@ -29,32 +25,12 @@ import java.util.Vector;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SampleServiceImpl implements SampleService {
|
||||
//~ Instance fields ================================================================================================
|
||||
|
||||
Logger logger = Logger.getLogger(SampleServiceImpl.class);
|
||||
|
||||
//~ Methods ========================================================================================================
|
||||
|
||||
public void doSomethingOnThis(SampleBlockOfData block1, SampleBlockOfData block2) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("You made it! Your context is " + SecurityContextHolder.getContext().getAuthentication());
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Block1 is " + block1);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Block2 is " + block2);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SampleBlockOfData> getTheSampleData() {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(SecurityContextHolder.getContext().getAuthentication().getName()
|
||||
+ " is requesting some sample data.");
|
||||
}
|
||||
|
||||
List<SampleBlockOfData> dataList = new Vector<SampleBlockOfData>();
|
||||
SampleBlockOfData block;
|
||||
|
||||
|
||||
-7
@@ -8,8 +8,6 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
@@ -23,11 +21,6 @@ import org.springframework.security.core.authority.mapping.MapBasedAttributes2Gr
|
||||
@SuppressWarnings("unchecked")
|
||||
public class MapBasedAttributes2GrantedAuthoritiesMapperTest {
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
// Set Log4j loglevel to debug to include all logstatements in tests
|
||||
Logger.getRootLogger().setLevel(Level.DEBUG);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testAfterPropertiesSetNoMap() throws Exception {
|
||||
MapBasedAttributes2GrantedAuthoritiesMapper mapper = new MapBasedAttributes2GrantedAuthoritiesMapper();
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package org.springframework.security.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
public class AuthenticationMatcher extends TypeSafeMatcher<Authentication> {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(Authentication auth) {
|
||||
if (!username.equals(auth.getName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (password != null && !password.equals(auth.getCredentials())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void describeTo(Description d) {
|
||||
d.appendText("an authentication object with username = '" + username + "'");
|
||||
if (password != null) {
|
||||
d.appendText(", password = '" + password + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Authentication> anAuthenticationWithUsername(String name) {
|
||||
AuthenticationMatcher matcher = new AuthenticationMatcher();
|
||||
matcher.username = name;
|
||||
return matcher;
|
||||
}
|
||||
|
||||
@Factory
|
||||
public static Matcher<Authentication> anAuthenticationWithUsernameAndPassword(String name, String password) {
|
||||
AuthenticationMatcher matcher = new AuthenticationMatcher();
|
||||
matcher.username = name;
|
||||
matcher.password = password;
|
||||
return matcher;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
<web-app id="WebApp">
|
||||
<display-name>poc-acegi-web</display-name>
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:j2ee-acegi-security.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>log4jConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/classes/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
|
||||
</listener>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dispatch</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatch</servlet-name>
|
||||
<url-pattern>*.form</url-pattern>
|
||||
</servlet-mapping>
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
<welcome-file>index.htm</welcome-file>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
<welcome-file>default.html</welcome-file>
|
||||
<welcome-file>default.htm</welcome-file>
|
||||
<welcome-file>default.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
</web-app>
|
||||
@@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
<web-app id="WebApp">
|
||||
<display-name>poc-acegi-web</display-name>
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>classpath:j2ee-acegi-security.xml</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>log4jConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/classes/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
<filter>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
<listener>
|
||||
<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
|
||||
</listener>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dispatch</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatch</servlet-name>
|
||||
<url-pattern>*.form</url-pattern>
|
||||
</servlet-mapping>
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
<welcome-file>index.htm</welcome-file>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
<welcome-file>default.html</welcome-file>
|
||||
<welcome-file>default.htm</welcome-file>
|
||||
<welcome-file>default.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
<resource-ref id="ResourceRef_1185189465160">
|
||||
<res-ref-name>jms/testQueue</res-ref-name>
|
||||
<res-type>javax.jms.Queue</res-type>
|
||||
<res-auth>Container</res-auth>
|
||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||
</resource-ref>
|
||||
<resource-ref id="ResourceRef_1185189465170">
|
||||
<res-ref-name>jms/testQCF</res-ref-name>
|
||||
<res-type>javax.jms.QueueConnectionFactory</res-type>
|
||||
<res-auth>Container</res-auth>
|
||||
<res-sharing-scope>Shareable</res-sharing-scope>
|
||||
</resource-ref>
|
||||
<security-constraint>
|
||||
<web-resource-collection>
|
||||
<web-resource-name>Default</web-resource-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</web-resource-collection>
|
||||
<auth-constraint>
|
||||
<role-name>*</role-name>
|
||||
</auth-constraint>
|
||||
</security-constraint>
|
||||
<security-role>
|
||||
<description></description>
|
||||
<role-name>Role1</role-name>
|
||||
</security-role>
|
||||
<security-role>
|
||||
<description></description>
|
||||
<role-name>Role2</role-name>
|
||||
</security-role>
|
||||
<security-role>
|
||||
<description></description>
|
||||
<role-name>Role3</role-name>
|
||||
</security-role>
|
||||
<security-role>
|
||||
<description></description>
|
||||
<role-name>Role4</role-name>
|
||||
</security-role>
|
||||
</web-app>
|
||||
Reference in New Issue
Block a user