diff --git a/core/src/main/java/org/springframework/security/adapters/AbstractAdapterAuthenticationToken.java b/core/src/main/java/org/springframework/security/adapters/AbstractAdapterAuthenticationToken.java
deleted file mode 100644
index 2dd0e6d21e..0000000000
--- a/core/src/main/java/org/springframework/security/adapters/AbstractAdapterAuthenticationToken.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.adapters;
-
-import org.springframework.security.GrantedAuthority;
-
-import org.springframework.security.providers.AbstractAuthenticationToken;
-
-
-/**
- * Convenience superclass for {@link AuthByAdapter} implementations.
- *
- * @author Ben Alex
- * @version $Id$
- */
-public abstract class AbstractAdapterAuthenticationToken extends AbstractAuthenticationToken implements AuthByAdapter {
- //~ Instance fields ================================================================================================
-
- private int keyHash;
-
- //~ Constructors ===================================================================================================
-
- protected AbstractAdapterAuthenticationToken() {
- super(null);
- }
-
-/**
- * The only way an AbstractAdapterAuthentication should be
- * constructed.
- *
- * @param key the key that is hashed and made available via {@link
- * #getKeyHash()}
- * @param authorities the authorities granted to this principal
- */
- protected AbstractAdapterAuthenticationToken(String key, GrantedAuthority[] authorities) {
- super(authorities);
- this.keyHash = key.hashCode();
- }
-
- //~ Methods ========================================================================================================
-
- public boolean equals(Object obj) {
- if (obj instanceof AbstractAdapterAuthenticationToken) {
- if (!super.equals(obj)) {
- return false;
- }
-
- AbstractAdapterAuthenticationToken test = (AbstractAdapterAuthenticationToken) obj;
-
- return (this.getKeyHash() == test.getKeyHash());
- }
-
- return false;
- }
-
- public int getKeyHash() {
- return this.keyHash;
- }
-
- /**
- * Always returns true.
- *
- * @return DOCUMENT ME!
- */
- public boolean isAuthenticated() {
- return true;
- }
-
- /**
- * Iterates the granted authorities and indicates whether or not the specified role is held.
Comparison
- * is based on the String returned by {@link GrantedAuthority#getAuthority}.
true if the granted authority is held, or false otherwise
- */
- public boolean isUserInRole(String role) {
- GrantedAuthority[] authorities = super.getAuthorities();
-
- for (int i = 0; i < authorities.length; i++) {
- if (role.equals(authorities[i].getAuthority())) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Setting is ignored. Always considered authenticated.
- *
- * @param ignored DOCUMENT ME!
- */
- public void setAuthenticated(boolean ignored) {
- // ignored
- }
-}
diff --git a/core/src/main/java/org/springframework/security/adapters/AuthByAdapter.java b/core/src/main/java/org/springframework/security/adapters/AuthByAdapter.java
deleted file mode 100644
index 4b3f8c01e2..0000000000
--- a/core/src/main/java/org/springframework/security/adapters/AuthByAdapter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.adapters;
-
-import org.springframework.security.Authentication;
-
-
-/**
- * Indicates a specialized, immutable, server-side only {@link Authentication}
- * class.
- *
- *
- * Automatically considered valid by the {@link AuthByAdapterProvider},
- * provided the hash code presented by the implementation objects matches that
- * expected by the AuthByAdapterProvider.
- *
AuthByAdapter
- * implementation. The implementation should convert the value to a hash code at construction time, rather than
- * storing the key itself.
- *
- * @return the hash code of the key used when the object was created.
- */
- int getKeyHash();
-}
diff --git a/core/src/main/java/org/springframework/security/adapters/AuthByAdapterProvider.java b/core/src/main/java/org/springframework/security/adapters/AuthByAdapterProvider.java
deleted file mode 100644
index 29879bb78b..0000000000
--- a/core/src/main/java/org/springframework/security/adapters/AuthByAdapterProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.security.adapters;
-
-import org.springframework.security.SpringSecurityMessageSource;
-import org.springframework.security.Authentication;
-import org.springframework.security.AuthenticationException;
-import org.springframework.security.BadCredentialsException;
-
-import org.springframework.security.providers.AuthenticationProvider;
-
-import org.springframework.beans.factory.InitializingBean;
-
-import org.springframework.context.MessageSource;
-import org.springframework.context.MessageSourceAware;
-import org.springframework.context.support.MessageSourceAccessor;
-
-import org.springframework.util.Assert;
-
-
-/**
- * An {@link AuthenticationProvider} implementation that can authenticate an {@link AuthByAdapter}.Configured in
- * the bean context with a key that should match the key used by adapters to generate AuthByAdapter
- * instances. It treats as valid any such instance presenting a hash code that matches the
- * AuthByAdapterProvider-configured key.
If the key does not match, a BadCredentialsException is thrown.
SecurityContext with the Authentication obtained from the container's
- * HttpServletRequest.getUserPrincipal().Use this filter with container adapters only.
- *This filter never preserves the Authentication on the SecurityContext - it
- * is replaced every request.
See {@link org.springframework.security.context.HttpSessionContextIntegrationFilter} for further information.
- * - * @author Ben Alex - * @version $Id$ - */ -public class HttpRequestIntegrationFilter implements Filter { - //~ Static fields/initializers ===================================================================================== - - private static final Log logger = LogFactory.getLog(HttpRequestIntegrationFilter.class); - - //~ Methods ======================================================================================================== - - /** - * Does nothing. We use IoC container lifecycle services instead. - */ - public void destroy() {} - - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - if (request instanceof HttpServletRequest) { - Principal principal = ((HttpServletRequest) request).getUserPrincipal(); - - if ((principal != null) && principal instanceof Authentication) { - SecurityContextHolder.getContext().setAuthentication((Authentication) principal); - - if (logger.isDebugEnabled()) { - logger.debug("SecurityContextHolder updated with Authentication from container: '" + principal - + "'"); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("SecurityContextHolder not set with new Authentication as Principal was: '" - + principal + "'"); - } - } - } else { - throw new IllegalArgumentException("Only HttpServletRequest is acceptable"); - } - - chain.doFilter(request, response); - } - - /** - * Does nothing. We use IoC container lifecycle services instead. - * - * @param arg0 ignored - * - * @throws ServletException ignored - */ - public void init(FilterConfig arg0) throws ServletException {} -} diff --git a/core/src/main/java/org/springframework/security/adapters/PrincipalSpringSecurityUserToken.java b/core/src/main/java/org/springframework/security/adapters/PrincipalSpringSecurityUserToken.java deleted file mode 100644 index 0b1af281e7..0000000000 --- a/core/src/main/java/org/springframework/security/adapters/PrincipalSpringSecurityUserToken.java +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.security.adapters; - -import org.springframework.security.GrantedAuthority; - -import java.security.Principal; - - -/** - * A {@link Principal} compatible {@link org.springframework.security.Authentication} object. - * - * @author Ben Alex - * @version $Id$ - */ -public class PrincipalSpringSecurityUserToken extends AbstractAdapterAuthenticationToken implements Principal { - //~ Instance fields ================================================================================================ - - private static final long serialVersionUID = 1L; - private Object principal; - private String password; - private String username; - - //~ Constructors =================================================================================================== - - public PrincipalSpringSecurityUserToken(String key, String username, String password, GrantedAuthority[] authorities, - Object principal) { - super(key, authorities); - this.username = username; - this.password = password; - this.principal = principal; - } - - //~ Methods ======================================================================================================== - - public Object getCredentials() { - return this.password; - } - - public String getName() { - return this.username; - } - - public Object getPrincipal() { - if (this.principal == null) { - return this.username; - } - - return this.principal; - } -} diff --git a/core/src/main/java/org/springframework/security/adapters/package.html b/core/src/main/java/org/springframework/security/adapters/package.html deleted file mode 100644 index b2e14dfc56..0000000000 --- a/core/src/main/java/org/springframework/security/adapters/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - -Allows external containers to obtain authentication information from the -system. - -It is recommended to use the org.springframework.security.ui.webapp
-package for standard web applications, as it has much lower configuration
-complexity.