aboutsummaryrefslogtreecommitdiffstats
path: root/redback-system/src
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2012-04-06 09:58:14 +0000
committerOlivier Lamy <olamy@apache.org>2012-04-06 09:58:14 +0000
commit5b06b6673ee8eaed4b46ad8e847e98fe4c90319d (patch)
treee184a7512cd005f5baaf82a94e13fd67646cc2ea /redback-system/src
parentbe9e1800fdcb3c37c566220c1b2b79650d375000 (diff)
downloadarchiva-5b06b6673ee8eaed4b46ad8e847e98fe4c90319d.tar.gz
archiva-5b06b6673ee8eaed4b46ad8e847e98fe4c90319d.zip
import of redback core sources
http://svn.codehaus.org/redback/redback/trunk/ r1724 git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1310268 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'redback-system/src')
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySession.java74
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySystem.java279
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySession.java40
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystem.java96
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystemConstants.java36
-rw-r--r--redback-system/src/main/java/org/codehaus/plexus/redback/system/check/EnvironmentCheck.java36
-rw-r--r--redback-system/src/main/resources/META-INF/spring-context.xml33
-rw-r--r--redback-system/src/test/java/org/codehaus/plexus/redback/system/DefaultSecureApplication.java9
-rw-r--r--redback-system/src/test/java/org/codehaus/plexus/redback/system/SecureApplication.java9
-rw-r--r--redback-system/src/test/java/org/codehaus/plexus/redback/system/TestAuthenticationManager.java49
-rw-r--r--redback-system/src/test/resources/spring-context.xml51
11 files changed, 712 insertions, 0 deletions
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySession.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySession.java
new file mode 100644
index 000000000..c420bcc27
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySession.java
@@ -0,0 +1,74 @@
+package org.codehaus.plexus.redback.system;
+
+/*
+ * Copyright 2005 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.users.User;
+import org.springframework.stereotype.Service;
+
+import java.io.Serializable;
+
+/**
+ * @author Jason van Zyl
+ */
+@Service( "securitySession" )
+public class DefaultSecuritySession
+ implements SecuritySession, Serializable
+{
+ private AuthenticationResult authenticationResult;
+
+ private User user;
+
+ // TODO: ambiguity between this authenticated and authentication result's authenticated is dangerous
+ private boolean authenticated;
+
+ public DefaultSecuritySession()
+ {
+ this.authenticationResult = new AuthenticationResult();
+ this.user = null;
+ this.authenticated = false;
+ }
+
+ public DefaultSecuritySession( AuthenticationResult authResult )
+ {
+ this.authenticationResult = authResult;
+ this.user = null;
+ this.authenticated = false;
+ }
+
+ public DefaultSecuritySession( AuthenticationResult authenticationResult, User user )
+ {
+ this.authenticationResult = authenticationResult;
+ this.user = user;
+ this.authenticated = true;
+ }
+
+ public AuthenticationResult getAuthenticationResult()
+ {
+ return authenticationResult;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return ( ( user != null ) && authenticated );
+ }
+}
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySystem.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySystem.java
new file mode 100644
index 000000000..e12207094
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/DefaultSecuritySystem.java
@@ -0,0 +1,279 @@
+package org.codehaus.plexus.redback.system;
+
+/*
+ * Copyright 2005 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
+import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.codehaus.plexus.redback.authentication.AuthenticationManager;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authorization.AuthorizationDataSource;
+import org.codehaus.plexus.redback.authorization.AuthorizationException;
+import org.codehaus.plexus.redback.authorization.AuthorizationResult;
+import org.codehaus.plexus.redback.authorization.Authorizer;
+import org.codehaus.plexus.redback.keys.KeyManager;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * DefaultSecuritySystem:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service( "securitySystem" )
+public class DefaultSecuritySystem
+ implements SecuritySystem
+{
+ private Logger log = LoggerFactory.getLogger( DefaultSecuritySystem.class );
+
+ @Inject
+ private AuthenticationManager authnManager;
+
+ @Inject
+ @Named( value = "authorizer#rbac" )
+ private Authorizer authorizer;
+
+ @Inject
+ @Named( value = "userManager#configurable" )
+ private UserManager userManager;
+
+ @Inject
+ @Named( value = "keyManager#cached" )
+ private KeyManager keyManager;
+
+ @Inject
+ private UserSecurityPolicy policy;
+
+ // ----------------------------------------------------------------------------
+ // Authentication: delegate to the authnManager
+ // ----------------------------------------------------------------------------
+
+ /**
+ * delegate to the authentication system for boolean authentication checks,
+ * if the result is authentic then pull the user object from the user
+ * manager and add it to the session. If the result is false return the result in
+ * an authenticated session and a null user object.
+ * <p/>
+ * in the event of a successful authentication and a lack of corresponding user in the
+ * usermanager return a null user as well
+ * <p/>
+ * //todo should this last case create a user in the usermanager?
+ *
+ * @param source
+ * @return
+ * @throws AuthenticationException
+ * @throws UserNotFoundException
+ * @throws MustChangePasswordException
+ * @throws AccountLockedException
+ * @throws MustChangePasswordException
+ */
+ public SecuritySession authenticate( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
+ {
+ // Perform Authentication.
+ AuthenticationResult result = authnManager.authenticate( source );
+
+ log.debug( "authnManager.authenticate() result: {}", result );
+
+ // Process Results.
+ if ( result.isAuthenticated() )
+ {
+ log.debug( "User '{}' authenticated.", result.getPrincipal());
+ User user = userManager.findUser( result.getPrincipal() );
+ if ( user != null )
+ {
+ log.debug( "User '{}' exists.", result.getPrincipal() );
+ log.debug( "User: {}", user );
+ return new DefaultSecuritySession( result, user );
+ }
+ else
+ {
+ log.debug( "User '{}' DOES NOT exist.", result.getPrincipal() );
+ return new DefaultSecuritySession( result );
+ }
+ }
+ else
+ {
+ log.debug( "User '{}' IS NOT authenticated.", result.getPrincipal() );
+ return new DefaultSecuritySession( result );
+ }
+ }
+
+ public boolean isAuthenticated( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException
+ {
+ return authenticate( source ).getAuthenticationResult().isAuthenticated();
+ }
+
+ public String getAuthenticatorId()
+ {
+ if ( authnManager == null )
+ {
+ return "<null>";
+ }
+ return authnManager.getId();
+ }
+
+ // ----------------------------------------------------------------------------
+ // Authorization: delegate to the authorizer
+ // ----------------------------------------------------------------------------
+
+ public AuthorizationResult authorize( SecuritySession session, Object permission )
+ throws AuthorizationException
+ {
+ return authorize( session, permission, null );
+ }
+
+ public AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException
+ {
+ AuthorizationDataSource source = null;
+
+ if ( session != null )
+ {
+ User user = session.getUser();
+ if ( user != null )
+ {
+ source = new AuthorizationDataSource( user.getPrincipal(), user, permission, resource );
+ }
+ }
+
+ if ( source == null )
+ {
+ source = new AuthorizationDataSource( null, null, permission, resource );
+ }
+
+ return authorizer.isAuthorized( source );
+ }
+
+ public boolean isAuthorized( SecuritySession session, Object permission )
+ throws AuthorizationException
+ {
+ return isAuthorized( session, permission, null );
+ }
+
+ public boolean isAuthorized( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException
+ {
+ return authorize( session, permission, resource ).isAuthorized();
+ }
+
+ public String getAuthorizerId()
+ {
+ if ( authorizer == null )
+ {
+ return "<null>";
+ }
+ return authorizer.getId();
+ }
+
+ // ----------------------------------------------------------------------------
+ // User Management: delegate to the user manager
+ // ----------------------------------------------------------------------------
+
+ public UserManager getUserManager()
+ {
+ return userManager;
+ }
+
+ public String getUserManagementId()
+ {
+ if ( userManager == null )
+ {
+ return "<null>";
+ }
+ return userManager.getId();
+ }
+
+ public KeyManager getKeyManager()
+ {
+ return keyManager;
+ }
+
+ public String getKeyManagementId()
+ {
+ if ( keyManager == null )
+ {
+ return "<null>";
+ }
+ return keyManager.getId();
+ }
+
+ public UserSecurityPolicy getPolicy()
+ {
+ return policy;
+ }
+
+ public String getPolicyId()
+ {
+ if ( policy == null )
+ {
+ return "<null>";
+ }
+ return policy.getId();
+ }
+
+ public AuthenticationManager getAuthenticationManager()
+ {
+ return authnManager;
+ }
+
+ public Authorizer getAuthorizer()
+ {
+ return authorizer;
+ }
+
+ public AuthenticationManager getAuthnManager()
+ {
+ return authnManager;
+ }
+
+ public void setAuthnManager( AuthenticationManager authnManager )
+ {
+ this.authnManager = authnManager;
+ }
+
+ public void setAuthorizer( Authorizer authorizer )
+ {
+ this.authorizer = authorizer;
+ }
+
+ public void setUserManager( UserManager userManager )
+ {
+ this.userManager = userManager;
+ }
+
+ public void setKeyManager( KeyManager keyManager )
+ {
+ this.keyManager = keyManager;
+ }
+
+ public void setPolicy( UserSecurityPolicy policy )
+ {
+ this.policy = policy;
+ }
+}
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySession.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySession.java
new file mode 100644
index 000000000..f1cb298dd
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySession.java
@@ -0,0 +1,40 @@
+package org.codehaus.plexus.redback.system;
+
+/*
+ * Copyright 2001-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.users.User;
+
+import java.io.Serializable;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface SecuritySession
+ extends Serializable
+{
+
+ static final String SESSION_KEY = SecuritySession.class.getName();
+
+ static final String USERKEY = "SecuritySessionUser";
+
+ AuthenticationResult getAuthenticationResult();
+
+ User getUser();
+
+ boolean isAuthenticated();
+}
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystem.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystem.java
new file mode 100644
index 000000000..c76992df7
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystem.java
@@ -0,0 +1,96 @@
+package org.codehaus.plexus.redback.system;
+
+/*
+ * Copyright 2005 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
+import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.codehaus.plexus.redback.authorization.AuthorizationException;
+import org.codehaus.plexus.redback.authorization.AuthorizationResult;
+import org.codehaus.plexus.redback.keys.KeyManager;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+
+/**
+ * SecuritySystem:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $ID:$
+ *
+ */
+public interface SecuritySystem
+{
+
+ // ----------------------------------------------------------------------------
+ // Authentication
+ // ----------------------------------------------------------------------------
+
+ SecuritySession authenticate( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
+
+ boolean isAuthenticated( AuthenticationDataSource source )
+ throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException;
+
+ // ----------------------------------------------------------------------------
+ // Authorization
+ // ----------------------------------------------------------------------------
+
+ AuthorizationResult authorize( SecuritySession session, Object permission )
+ throws AuthorizationException;
+
+ boolean isAuthorized( SecuritySession session, Object permission )
+ throws AuthorizationException;
+
+ /**
+ * return AuthorizationResult without changing authorization
+ * @param session
+ * @param permission
+ * @param resource
+ * @return
+ * @throws AuthorizationException
+ */
+ AuthorizationResult authorize( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException;
+
+ boolean isAuthorized( SecuritySession session, Object permission, Object resource )
+ throws AuthorizationException;
+
+ // ----------------------------------------------------------------------------
+ // User Management
+ // ----------------------------------------------------------------------------
+
+ UserManager getUserManager();
+
+ // ----------------------------------------------------------------------------
+ // Key Management
+ // ----------------------------------------------------------------------------
+
+ KeyManager getKeyManager();
+
+ // ----------------------------------------------------------------------------
+ // Policy Management
+ // ----------------------------------------------------------------------------
+
+ UserSecurityPolicy getPolicy();
+
+ String getUserManagementId();
+ String getAuthenticatorId();
+ String getAuthorizerId();
+}
+
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystemConstants.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystemConstants.java
new file mode 100644
index 000000000..acebd7177
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/SecuritySystemConstants.java
@@ -0,0 +1,36 @@
+package org.codehaus.plexus.redback.system;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+/**
+ * SecuritySystemConstants - constants for use with contexts that use plexus-security.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SecuritySystemConstants
+{
+ /**
+ * Key in the sessionScope for the {@link SecuritySession} object.
+ */
+ public static final String SECURITY_SESSION_KEY = "securitySession";
+
+ private SecuritySystemConstants()
+ {
+ // no op
+ }
+}
diff --git a/redback-system/src/main/java/org/codehaus/plexus/redback/system/check/EnvironmentCheck.java b/redback-system/src/main/java/org/codehaus/plexus/redback/system/check/EnvironmentCheck.java
new file mode 100644
index 000000000..d31640735
--- /dev/null
+++ b/redback-system/src/main/java/org/codehaus/plexus/redback/system/check/EnvironmentCheck.java
@@ -0,0 +1,36 @@
+package org.codehaus.plexus.redback.system.check;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+import java.util.List;
+
+/**
+ * EnvironmentCheck - Perform an Environment Check.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface EnvironmentCheck
+{
+
+ /**
+ * Validate the environment.
+ *
+ * @param violations list to populate with environment violations.
+ */
+ void validateEnvironment( List<String> violations );
+}
diff --git a/redback-system/src/main/resources/META-INF/spring-context.xml b/redback-system/src/main/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..44f80402a
--- /dev/null
+++ b/redback-system/src/main/resources/META-INF/spring-context.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config />
+ <context:component-scan base-package="org.codehaus.plexus.redback.system"/>
+
+</beans> \ No newline at end of file
diff --git a/redback-system/src/test/java/org/codehaus/plexus/redback/system/DefaultSecureApplication.java b/redback-system/src/test/java/org/codehaus/plexus/redback/system/DefaultSecureApplication.java
new file mode 100644
index 000000000..6cc1f8f64
--- /dev/null
+++ b/redback-system/src/test/java/org/codehaus/plexus/redback/system/DefaultSecureApplication.java
@@ -0,0 +1,9 @@
+package org.codehaus.plexus.redback.system;
+
+/**
+ * @author Jason van Zyl
+ */
+public class DefaultSecureApplication
+ implements SecureApplication
+{
+}
diff --git a/redback-system/src/test/java/org/codehaus/plexus/redback/system/SecureApplication.java b/redback-system/src/test/java/org/codehaus/plexus/redback/system/SecureApplication.java
new file mode 100644
index 000000000..67d37e9c5
--- /dev/null
+++ b/redback-system/src/test/java/org/codehaus/plexus/redback/system/SecureApplication.java
@@ -0,0 +1,9 @@
+package org.codehaus.plexus.redback.system;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface SecureApplication
+{
+ String ROLE = SecureApplication.class.getName();
+}
diff --git a/redback-system/src/test/java/org/codehaus/plexus/redback/system/TestAuthenticationManager.java b/redback-system/src/test/java/org/codehaus/plexus/redback/system/TestAuthenticationManager.java
new file mode 100644
index 000000000..fc92180b5
--- /dev/null
+++ b/redback-system/src/test/java/org/codehaus/plexus/redback/system/TestAuthenticationManager.java
@@ -0,0 +1,49 @@
+package org.codehaus.plexus.redback.system;
+
+import junit.framework.TestCase;
+import org.codehaus.plexus.redback.authentication.AuthenticationManager;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * 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.
+ */
+
+/**
+ * TestAuthenticationManager:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $ID:$
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class TestAuthenticationManager
+ extends TestCase
+{
+
+ @Inject
+ AuthenticationManager authManager;
+
+ @Test
+ public void testAuthenticatorPopulation()
+ throws Exception
+ {
+ assertEquals( 1, authManager.getAuthenticators().size() );
+ }
+
+}
diff --git a/redback-system/src/test/resources/spring-context.xml b/redback-system/src/test/resources/spring-context.xml
new file mode 100644
index 000000000..4f9e407bb
--- /dev/null
+++ b/redback-system/src/test/resources/spring-context.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+ <bean name="jdoFactory#users" class="org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory">
+ <property name="driverName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:mem:redback-users-tests" />
+ <property name="userName" value="sa"/>
+ <property name="password" value=""/>
+ <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
+ <property name="otherProperties">
+ <props>
+ <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean name="userConfiguration" class="org.codehaus.plexus.redback.configuration.UserConfiguration">
+ <property name="registry" ref="test-conf"/>
+ </bean>
+
+ <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+ </bean>
+
+ <alias name="commons-configuration" alias="test-conf"/>
+
+</beans> \ No newline at end of file