You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/04/06 11:59:32 UTC
svn commit: r1310268 [3/42] - in /archiva/redback/redback-core/trunk: ./
redback-authentication/ redback-authentication/redback-authentication-api/
redback-authentication/redback-authentication-api/src/
redback-authentication/redback-authentication-api...
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-providers</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authentication-ldap</artifactId>
+ <name>Redback :: Authentication Provider :: Ldap</name>
+ <properties>
+ <apacheds.version>1.5.1</apacheds.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-common-ldap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-policy</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-users-ldap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.directory.server</groupId>
+ <artifactId>apacheds-core</artifactId>
+ <version>${apacheds.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.redback.components</groupId>
+ <artifactId>spring-apacheds</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>port-allocator-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>allocate-ldap-port</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>allocate-ports</goal>
+ </goals>
+ <configuration>
+ <ports>
+ <port>
+ <name>ldapPort</name>
+ <portNumber>10390</portNumber>
+ </port>
+ </ports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <ldapPort>${ldapPort}</ldapPort>
+ <basedir>${basedir}</basedir>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,201 @@
+package org.codehaus.plexus.redback.authentication.ldap;
+
+/*
+ * 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.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
+import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authentication.Authenticator;
+import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.codehaus.plexus.redback.common.ldap.UserMapper;
+import org.codehaus.plexus.redback.common.ldap.connection.LdapConnection;
+import org.codehaus.plexus.redback.common.ldap.connection.LdapConnectionFactory;
+import org.codehaus.plexus.redback.common.ldap.connection.LdapException;
+import org.codehaus.plexus.redback.configuration.UserConfiguration;
+import org.codehaus.plexus.redback.users.ldap.service.LdapCacheService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
+/**
+ * LdapBindAuthenticator:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ */
+@Service( "authenticator#ldap" )
+public class LdapBindAuthenticator
+ implements Authenticator
+{
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ @Named( value = "userMapper#ldap" )
+ private UserMapper mapper;
+
+ @Inject
+ @Named( value = "ldapConnectionFactory#configurable" )
+ private LdapConnectionFactory connectionFactory;
+
+ @Inject
+ @Named( value = "userConfiguration" )
+ private UserConfiguration config;
+
+ @Inject
+ private LdapCacheService ldapCacheService;
+
+ public String getId()
+ {
+ return "LdapBindAuthenticator";
+ }
+
+ public AuthenticationResult authenticate( AuthenticationDataSource s )
+ throws AuthenticationException
+ {
+ PasswordBasedAuthenticationDataSource source = (PasswordBasedAuthenticationDataSource) s;
+
+ if ( !config.getBoolean( "ldap.bind.authenticator.enabled" ) || (
+ !config.getBoolean( "ldap.bind.authenticator.allowEmptyPasswords", false ) && StringUtils.isEmpty(
+ source.getPassword() ) ) )
+ {
+ return new AuthenticationResult( false, source.getPrincipal(), null );
+ }
+
+ SearchControls ctls = new SearchControls();
+
+ ctls.setCountLimit( 1 );
+
+ ctls.setDerefLinkFlag( true );
+ ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+
+ String filter = "(&(objectClass=" + mapper.getUserObjectClass() + ")"
+ + ( mapper.getUserFilter() != null ? mapper.getUserFilter() : "" ) + "(" + mapper.getUserIdAttribute() + "="
+ + source.getPrincipal() + "))";
+
+ log.info( "Searching for users with filter: \'{}\'" + " from base dn: {}", filter, mapper.getUserBaseDn() );
+
+ LdapConnection ldapConnection = getLdapConnection();
+ LdapConnection authLdapConnection = null;
+ NamingEnumeration<SearchResult> results = null;
+ try
+ {
+ // check the cache for user's userDn in the ldap server
+ String userDn = ldapCacheService.getLdapUserDn( source.getPrincipal() );
+
+ if( userDn == null )
+ {
+ log.debug( "userDn for user {} not found in cache. Retrieving from ldap server..", source.getPrincipal() );
+
+ DirContext context = ldapConnection.getDirContext();
+
+ results = context.search( mapper.getUserBaseDn(), filter, ctls );
+
+ log.info( "Found user?: {}", results.hasMoreElements() );
+
+ if ( results.hasMoreElements() )
+ {
+ SearchResult result = results.nextElement();
+
+ userDn = result.getNameInNamespace();
+
+ log.debug( "Adding userDn {} for user {} to the cache..", userDn, source.getPrincipal() );
+
+ // REDBACK-289/MRM-1488 cache the ldap user's userDn to lessen calls to ldap server
+ ldapCacheService.addLdapUserDn( source.getPrincipal(), userDn );
+ }
+ else
+ {
+ return new AuthenticationResult( false, source.getPrincipal(), null );
+ }
+ }
+
+ log.info( "Attempting Authenication: + {}", userDn );
+
+ authLdapConnection = connectionFactory.getConnection( userDn, source.getPassword() );
+
+ return new AuthenticationResult( true, source.getPrincipal(), null );
+ }
+ catch ( LdapException e )
+ {
+ return new AuthenticationResult( false, source.getPrincipal(), e );
+ }
+ catch ( NamingException e )
+ {
+ return new AuthenticationResult( false, source.getPrincipal(), e );
+ }
+ finally
+ {
+ closeNamingEnumeration( results );
+ closeLdapConnection( ldapConnection );
+ if ( authLdapConnection != null )
+ {
+ closeLdapConnection( authLdapConnection );
+ }
+ }
+ }
+
+ public boolean supportsDataSource( AuthenticationDataSource source )
+ {
+ return ( source instanceof PasswordBasedAuthenticationDataSource );
+ }
+
+ private LdapConnection getLdapConnection()
+ {
+ try
+ {
+ return connectionFactory.getConnection();
+ }
+ catch ( LdapException e )
+ {
+ log.warn( "failed to get a ldap connection " + e.getMessage(), e );
+ throw new RuntimeException( "failed to get a ldap connection " + e.getMessage(), e );
+ }
+ }
+
+ private void closeLdapConnection( LdapConnection ldapConnection )
+ {
+ if ( ldapConnection != null )
+ {
+ ldapConnection.close();
+ }
+ }
+
+ private void closeNamingEnumeration( NamingEnumeration<SearchResult> results )
+ {
+ try
+ {
+ if ( results != null )
+ {
+ results.close();
+ }
+ }
+ catch ( NamingException e )
+ {
+ log.warn( "skip exception closing naming search result " + e.getMessage() );
+ }
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,34 @@
+<?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-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config />
+ <context:component-scan
+ base-package="org.codehaus.plexus.redback.authentication.ldap"/>
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,210 @@
+package org.codehaus.plexus.redback.authentication.ldap;
+
+/*
+ * 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 junit.framework.TestCase;
+import org.codehaus.plexus.cache.builder.CacheBuilder;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.codehaus.plexus.redback.common.ldap.LdapUser;
+import org.codehaus.plexus.redback.common.ldap.connection.LdapConnection;
+import org.codehaus.plexus.redback.policy.PasswordEncoder;
+import org.codehaus.plexus.redback.policy.encoders.SHA1PasswordEncoder;
+import org.codehaus.plexus.redback.users.ldap.service.LdapCacheService;
+import org.codehaus.redback.components.apacheds.ApacheDs;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import java.util.Calendar;
+import java.util.Date;
+
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = "classpath*:/META-INF/spring-context.xml" )
+public class LdapBindAuthenticatorTest
+ extends TestCase
+{
+
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ @Named( value = "apacheDS#test" )
+ private ApacheDs apacheDs;
+
+ @Inject
+ private LdapBindAuthenticator authnr;
+
+ private String suffix;
+
+ private PasswordEncoder passwordEncoder;
+
+ @Inject
+ private LdapCacheService ldapCacheService;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ passwordEncoder = new SHA1PasswordEncoder();
+
+ suffix =
+ apacheDs.addSimplePartition( "test", new String[]{ "redback", "plexus", "codehaus", "org" } ).getSuffix();
+
+ log.info( "DN Suffix: " + suffix );
+
+ apacheDs.startServer();
+
+ makeUsers();
+
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ // clear the cache
+ ldapCacheService.removeAllLdapUserDn();
+
+ InitialDirContext context = apacheDs.getAdminContext();
+
+ context.unbind( createDn( "jesse" ) );
+
+ context.unbind( createDn( "joakim" ) );
+
+ context.unbind( createDn( "brent" ) );
+
+ if ( !apacheDs.isStopped() )
+ {
+ apacheDs.stopServer();
+ }
+
+ super.tearDown();
+ }
+
+ @Test
+ public void testAuthenticationEmptyPassword()
+ throws Exception
+ {
+ PasswordBasedAuthenticationDataSource authDs = new PasswordBasedAuthenticationDataSource();
+
+ // Would throw NPE if attempting to bind, this hack tests bind prevention
+ authDs.setPrincipal( "brent" );
+ authDs.setPassword( null );
+ AuthenticationResult result = authnr.authenticate( authDs );
+ assertFalse( result.isAuthenticated() );
+
+ // This passes anyway on ApacheDS, but not true for AD or Novel eDir
+ authDs.setPassword( "" );
+ result = authnr.authenticate( authDs );
+ assertFalse( result.isAuthenticated() );
+ }
+
+ @Test
+ public void testAuthentication()
+ throws Exception
+ {
+ PasswordBasedAuthenticationDataSource authDs = new PasswordBasedAuthenticationDataSource();
+ authDs.setPrincipal( "jesse" );
+ authDs.setPassword( passwordEncoder.encodePassword( "foo" ) );
+ AuthenticationResult result = authnr.authenticate( authDs );
+ assertTrue( result.isAuthenticated() );
+ }
+
+ // REDBACK-289/MRM-1488
+ @Test
+ public void testAuthenticationFromCache()
+ throws Exception
+ {
+ PasswordBasedAuthenticationDataSource authDs = new PasswordBasedAuthenticationDataSource();
+ authDs.setPrincipal( "jesse" );
+ authDs.setPassword( passwordEncoder.encodePassword( "foo" ) );
+
+ // user shouldn't be in the cache yet
+ assertNull( ldapCacheService.getLdapUserDn( "jesse" ) );
+
+ long startTime = Calendar.getInstance().getTimeInMillis();
+ AuthenticationResult result = authnr.authenticate( authDs );
+ long endTime = Calendar.getInstance().getTimeInMillis();
+
+ assertTrue( result.isAuthenticated() );
+
+ long firstAuth = endTime - startTime;
+
+ // user should be in the cache now
+ assertNotNull( ldapCacheService.getLdapUserDn( "jesse" ) );
+
+ startTime = Calendar.getInstance().getTimeInMillis();
+ result = authnr.authenticate( authDs );
+ endTime = Calendar.getInstance().getTimeInMillis();
+
+ long secondAuth = endTime - startTime;
+
+ assertTrue( "Second authn should be quicker!", secondAuth < firstAuth );
+ }
+
+ private void makeUsers()
+ throws Exception
+ {
+ InitialDirContext context = apacheDs.getAdminContext();
+
+ String cn = "jesse";
+ bindUserObject( context, cn, createDn( cn ) );
+
+ cn = "joakim";
+ bindUserObject( context, cn, createDn( cn ) );
+
+ cn = "brent";
+ bindUserObject( context, cn, createDn( cn ) );
+ }
+
+ private void bindUserObject( DirContext context, String cn, String dn )
+ throws Exception
+ {
+ Attributes attributes = new BasicAttributes( true );
+ BasicAttribute objectClass = new BasicAttribute( "objectClass" );
+ objectClass.add( "top" );
+ objectClass.add( "inetOrgPerson" );
+ objectClass.add( "person" );
+ objectClass.add( "organizationalperson" );
+ attributes.put( objectClass );
+ attributes.put( "cn", cn );
+ attributes.put( "sn", "foo" );
+ attributes.put( "mail", "foo" );
+ attributes.put( "userPassword", passwordEncoder.encodePassword( "foo" ) );
+ attributes.put( "givenName", "foo" );
+ context.createSubcontext( dn, attributes );
+ }
+
+ private String createDn( String cn )
+ {
+ return "cn=" + cn + "," + suffix;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/java/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,76 @@
+<?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">
+
+ <context:property-placeholder system-properties-mode="OVERRIDE"/>
+
+ <bean name="apacheDS#test" class="org.codehaus.redback.components.apacheds.DefaultApacheDs"
+ scope="prototype">
+ <property name="basedir" value="${basedir}/target/apacheds"/>
+ <property name="port" value="${ldapPort}"/>
+ <property name="enableNetworking" value="true"/>
+ <property name="password" value="secret"/>
+ </bean>
+
+ <bean name="ldapConnectionFactory#configurable" class="org.codehaus.plexus.redback.common.ldap.connection.ConfigurableLdapConnectionFactory">
+ <property name="hostname" value="localhost"/>
+ <property name="port" value="${ldapPort}"/>
+ <property name="baseDn" value="dc=redback,dc=plexus,dc=codehaus,dc=org"/>
+ <property name="contextFactory" value="com.sun.jndi.ldap.LdapCtxFactory"/>
+ <property name="password" value="secret"/>
+ <property name="bindDn" value="uid=admin,ou=system"/>
+ <property name="userConf" ref="userConfiguration"/>
+ </bean>
+
+ <bean name="userMapper#ldap" class="org.codehaus.plexus.redback.common.ldap.LdapUserMapper">
+ <property name="emailAttribute" value="mail"/>
+ <property name="fullNameAttribute" value="givenName"/>
+ <property name="passwordAttribute" value="userPassword"/>
+ <property name="userIdAttribute" value="cn"/>
+ <property name="userBaseDn" value="dc=redback,dc=plexus,dc=codehaus,dc=org"/>
+ <property name="userObjectClass" value="inetOrgPerson"/>
+ <property name="userConf" ref="userConfiguration"/>
+ </bean>
+
+ <bean name="userConfiguration" class="org.codehaus.plexus.redback.configuration.UserConfiguration"
+ init-method="initialize">
+ <property name="configs">
+ <list>
+ <value>src/test/resources/security.properties</value>
+ </list>
+ </property>
+
+ <property name="registry" ref="registry#commons-configuration"/>
+
+ </bean>
+
+ <bean name="registry#commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry"
+ init-method="initialize">
+
+ </bean>
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.xml?rev=1310268&view=auto
==============================================================================
(empty)
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.xml
------------------------------------------------------------------------------
svn:executable =
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/org/codehaus/plexus/redback/authentication/ldap/LdapBindAuthenticatorTest.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties Fri Apr 6 09:58:14 2012
@@ -0,0 +1,6 @@
+user.manager.impl=ldap
+ldap.bind.authenticator.enabled=true
+redback.default.admin=adminuser
+security.policy.password.expiration.enabled=false
+user.manager.impl=cached
+ldap.bind.authenticator.enabled=true
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/test/resources/security.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-providers</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authentication-memory</artifactId>
+ <name>Redback :: Authentication Provider :: Memory</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,85 @@
+package org.codehaus.plexus.redback.authentication.memory;
+
+/*
+ * 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.AuthenticationResult;
+import org.codehaus.plexus.redback.authentication.Authenticator;
+import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.springframework.stereotype.Service;
+
+/**
+ * MemoryAuthenticator:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ */
+@Service("authenticator#memory")
+public class MemoryAuthenticator
+ implements Authenticator
+{
+ private String login;
+
+ private String password;
+
+ public String getId()
+ {
+ return "MemoryAuthenticator";
+ }
+
+ public AuthenticationResult authenticate( AuthenticationDataSource s )
+ throws AuthenticationException
+ {
+ PasswordBasedAuthenticationDataSource source = (PasswordBasedAuthenticationDataSource) s;
+
+ login = source.getPrincipal();
+ password = source.getPassword();
+
+ if ( source.getPassword().equals( password ) )
+ {
+ return new AuthenticationResult( true, login, null );
+ }
+
+ return new AuthenticationResult( false, null, null );
+ }
+
+ public boolean supportsDataSource( AuthenticationDataSource source )
+ {
+ return ( source instanceof PasswordBasedAuthenticationDataSource );
+ }
+
+ public String getLogin()
+ {
+ return login;
+ }
+
+ public void setLogin( String login )
+ {
+ this.login = login;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,34 @@
+<?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-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config />
+ <context:component-scan
+ base-package="org.codehaus.plexus.redback.authentication.memory"/>
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,62 @@
+package org.codehaus.plexus.redback.authentication.memory;
+
+/*
+ * 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 junit.framework.TestCase;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authentication.Authenticator;
+import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+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;
+import javax.inject.Named;
+
+/**
+ * MemoryAuthenticatorTest:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class MemoryAuthenticatorTest
+ extends TestCase
+{
+ @Inject
+ @Named(value = "authenticator#memory")
+ Authenticator authenticator;
+
+ @Test
+ public void testSimpleAuthentication()
+ throws Exception
+ {
+ assertNotNull( authenticator );
+
+ PasswordBasedAuthenticationDataSource ds = new PasswordBasedAuthenticationDataSource();
+ ds.setPrincipal( "jason" );
+ ds.setPassword( "kungfu" );
+
+ AuthenticationResult ar = authenticator.authenticate( ds );
+
+ assertTrue( ar.isAuthenticated() );
+
+ assertEquals( "jason", ar.getPrincipal() );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/java/org/codehaus/plexus/redback/authentication/memory/MemoryAuthenticatorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -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">
+
+ <bean name="memory" class="org.codehaus.plexus.redback.authentication.memory.MemoryAuthenticator">
+ <property name="login" value="jason"/>
+ <property name="password" value="kungfu"/>
+ </bean>
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-memory/src/test/resources/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-providers</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authentication-open</artifactId>
+ <name>Redback :: Authentication Provider :: Open</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,56 @@
+package org.codehaus.plexus.redback.authentication.open;
+
+/*
+ * 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.AuthenticationDataSource;
+import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authentication.Authenticator;
+import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.springframework.stereotype.Service;
+
+/**
+ * OpenAuthenticator - Does not test user / password.
+ * All attempts result in access.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ */
+@Service("authenticator#open")
+public class OpenAuthenticator
+ implements Authenticator
+{
+
+ public AuthenticationResult authenticate( AuthenticationDataSource s )
+ throws AccountLockedException, AuthenticationException
+ {
+ PasswordBasedAuthenticationDataSource source = (PasswordBasedAuthenticationDataSource) s;
+ return new AuthenticationResult( true, source.getPrincipal(), null );
+ }
+
+ public String getId()
+ {
+ return "Open Authenticator";
+ }
+
+ public boolean supportsDataSource( AuthenticationDataSource source )
+ {
+ return ( source instanceof PasswordBasedAuthenticationDataSource );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/java/org/codehaus/plexus/redback/authentication/open/OpenAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,34 @@
+<?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-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config />
+ <context:component-scan
+ base-package="org.codehaus.plexus.redback.authentication.open"/>
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authentication/redback-authentication-providers/redback-authentication-open/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authorization</artifactId>
+ <name>Redback :: Authorization</name>
+ <packaging>pom</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-users-api</artifactId>
+ </dependency>
+ </dependencies>
+ <modules>
+ <module>redback-authorization-api</module>
+ <module>redback-authorization-providers</module>
+ </modules>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authorization/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authorization</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authorization-api</artifactId>
+ <name>Redback :: Authorization API</name>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,72 @@
+package org.codehaus.plexus.redback.authorization;
+
+import org.codehaus.plexus.redback.users.User;
+
+/**
+ * @author Jason van Zyl
+ */
+public class AuthorizationDataSource
+{
+ Object principal;
+
+ User user;
+
+ Object permission;
+
+ Object resource;
+
+ public AuthorizationDataSource( Object principal, User user, Object permission )
+ {
+ this.principal = principal;
+ this.user = user;
+ this.permission = permission;
+ }
+
+ public AuthorizationDataSource( Object principal, User user, Object permission, Object resource )
+ {
+ this.principal = principal;
+ this.user = user;
+ this.permission = permission;
+ this.resource = resource;
+ }
+
+ public Object getPrincipal()
+ {
+ return principal;
+ }
+
+ public void setPrincipal( String principal )
+ {
+ this.principal = principal;
+ }
+
+ public User getUser()
+ {
+ return user;
+ }
+
+ public void setUser( User user )
+ {
+ this.user = user;
+ }
+
+ public Object getPermission()
+ {
+ return permission;
+ }
+
+ public void setPermission( Object permission )
+ {
+ this.permission = permission;
+ }
+
+ public Object getResource()
+ {
+ return resource;
+ }
+
+ public void setResource( Object resource )
+ {
+ this.resource = resource;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationDataSource.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,46 @@
+package org.codehaus.plexus.redback.authorization;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * EntityAuthenticationException.java
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $ID:$
+ */
+public class AuthorizationException
+ extends Exception
+{
+ /**
+ *
+ * @param message
+ */
+ public AuthorizationException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public AuthorizationException( String message, Exception cause )
+ {
+ super( message, cause );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,56 @@
+package org.codehaus.plexus.redback.authorization;
+/*
+ * 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.
+ */
+
+/**
+ * AuthorizationResult: wrapper object for results from the authorization system
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $ID:$
+ */
+public class AuthorizationResult
+{
+ private boolean isAuthorized;
+
+ private Object principal;
+
+ private Exception exception;
+
+
+ public AuthorizationResult( boolean authorized,
+ Object principal,
+ Exception exception )
+ {
+ isAuthorized = authorized;
+ this.principal = principal;
+ this.exception = exception;
+ }
+
+ public boolean isAuthorized()
+ {
+ return isAuthorized;
+ }
+
+ public Object getPrincipal()
+ {
+ return principal;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/AuthorizationResult.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,32 @@
+package org.codehaus.plexus.redback.authorization;
+
+/*
+ * 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.
+ */
+
+/**
+ * Authorizer:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $ID:$
+ * @todo chain of command rule processing
+ */
+public interface Authorizer
+{
+ String getId();
+
+ AuthorizationResult isAuthorized( AuthorizationDataSource source )
+ throws AuthorizationException;
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/Authorizer.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,51 @@
+package org.codehaus.plexus.redback.authorization;
+/*
+ * 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.
+ */
+
+/**
+ * EntityAuthenticationException.java
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $ID:$
+ */
+public class NotAuthorizedException
+ extends Exception
+{
+ /**
+ *
+ */
+ public NotAuthorizedException()
+ {
+ }
+
+ /**
+ *
+ * @param message
+ */
+ public NotAuthorizedException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public NotAuthorizedException( String message, Exception cause )
+ {
+ super( message, cause );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/NotAuthorizedException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,57 @@
+package org.codehaus.plexus.redback.authorization;
+
+/*
+* Copyright 2011 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 java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.3
+ */
+@Target( ElementType.METHOD )
+@Retention( RetentionPolicy.RUNTIME )
+public @interface RedbackAuthorization
+{
+
+ /**
+ * @return at least one of those redback roles is needed
+ */
+ String[] permissions() default ( "" );
+
+ /**
+ * @return the redback ressource karma needed
+ */
+ String resource() default ( "" );
+
+ /**
+ * @return doc
+ */
+ String description() default ( "" );
+
+ /**
+ * @return <code>true</code> if doesn't need any special permission
+ */
+ boolean noRestriction() default false;
+
+ /**
+ * @return if this service need only authentication and not special karma
+ */
+ boolean noPermission() default false;
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/RedbackAuthorization.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,34 @@
+package org.codehaus.plexus.redback.authorization;
+/*
+ * 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.
+ */
+
+/**
+ * The exception thrown if an entity is unauthorized to access a resource.
+ *
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ * @since Mar 1, 2003
+ */
+public class UnauthorizedException
+ extends Exception
+{
+ /**
+ * @param message
+ */
+ public UnauthorizedException( String message )
+ {
+ super( message );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java
------------------------------------------------------------------------------
svn:executable =
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-api/src/main/java/org/codehaus/plexus/redback/authorization/UnauthorizedException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authorization</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authorization-providers</artifactId>
+ <name>Redback :: Authorization Providers</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>redback-authorization-open</module>
+ </modules>
+</project>
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/redback-authorization-open/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/redback-authorization-open/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/redback-authorization-open/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-authorization/redback-authorization-providers/redback-authorization-open/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authorization-providers</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-authorization-open</artifactId>
+ <name>Redback :: Authorization Provider :: Open</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authorization-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>