--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+/**
+ * Contants class used for authentication
+ * @version $Id$
+ */
+public class AuthenticationConstants
+{
+
+ // for User Manager Authenticator
+ public static final String AUTHN_NO_SUCH_USER = "1";
+
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+/**
+ * Just a tag to indicate that the implementing class is an AuthenticationDataSource.
+ * <p/>
+ * todo which this back to an interface and use the mojo style expression evaluation to populate the particular required fields
+ *
+ * @version $Id$
+ * @see PasswordBasedAuthenticationDataSource
+ * @see TokenBasedAuthenticationDataSource
+ */
+public interface AuthenticationDataSource
+{
+ public String ROLE = AuthenticationDataSource.class.getName();
+
+ String getPrincipal();
+
+ boolean isEnforcePasswordChange();
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+/**
+ * AuthenticationException.java
+ *
+ * @author Jesse McConnell
+ * @version $Id$
+ */
+public class AuthenticationException
+ extends Exception
+{
+ /**
+ * Constructor AuthenticationException.
+ */
+ public AuthenticationException()
+ {
+ }
+
+ /**
+ * Constructor AuthenticationException.
+ *
+ * @param message
+ */
+ public AuthenticationException( String message )
+ {
+ super( message );
+ }
+
+ public AuthenticationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public AuthenticationException( Throwable cause )
+ {
+ super( cause );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+
+import java.util.List;
+
+/**
+ * AuthenticationManager:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+public interface AuthenticationManager
+{
+ String getId();
+
+ List<Authenticator> getAuthenticators();
+
+ AuthenticationResult authenticate( AuthenticationDataSource source )
+ throws AccountLockedException, AuthenticationException, MustChangePasswordException;
+}
\ No newline at end of file
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * AuthenticationResult: wrapper object for information that comes back from the authentication system
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class AuthenticationResult
+ implements Serializable
+{
+ private boolean isAuthenticated;
+
+ /**
+ * FIXME olamy this Object is a pain !!!
+ */
+ private Object principal;
+
+ // TODO: why aren't these just thrown from the authenticate() method?
+ private Exception exception;
+
+ private Map<String,String> exceptionsMap;
+
+ public AuthenticationResult()
+ {
+ this.isAuthenticated = false;
+ this.principal = null;
+ this.exception = null;
+ }
+
+ public AuthenticationResult( boolean authenticated, Object principal, Exception exception )
+ {
+ isAuthenticated = authenticated;
+ this.principal = principal;
+ this.exception = exception;
+ }
+
+ public AuthenticationResult( boolean authenticated, Object principal, Exception exception, Map<String,String> exceptionsMap )
+ {
+ isAuthenticated = authenticated;
+ this.principal = principal;
+ this.exception = exception;
+ this.exceptionsMap = exceptionsMap;
+ }
+
+ public boolean isAuthenticated()
+ {
+ return isAuthenticated;
+ }
+
+ public Object getPrincipal()
+ {
+ return principal;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ public Map<String,String> getExceptionsMap()
+ {
+ return exceptionsMap;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "AuthenticationResult[" );
+ sb.append( "principal=" ).append( principal );
+ sb.append( ",isAuthenticated=" ).append( Boolean.toString( isAuthenticated ) );
+ sb.append( ",exception=" );
+ if ( exception != null )
+ {
+ sb.append( exception.getClass().getName() );
+ sb.append( " : " ).append( exception.getMessage() );
+ }
+ else
+ {
+ sb.append( "<null>" );
+ }
+ sb.append( ']' );
+ return sb.toString();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+
+/**
+ * Authenticator:
+ *
+ * @author Jesse McConnell
+ * @version $Id$
+ */
+public interface Authenticator
+{
+ String getId();
+
+ boolean supportsDataSource( AuthenticationDataSource source );
+
+ AuthenticationResult authenticate( AuthenticationDataSource source )
+ throws AccountLockedException, AuthenticationException, MustChangePasswordException;
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationManager;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * DefaultAuthenticationManager: the goal of the authentication manager is to act as a conduit for
+ * authentication requests into different authentication schemes
+ * <p/>
+ * For example, the default implementation can be configured with any number of authenticators and will
+ * sequentially try them for an authenticated result. This allows you to have the standard user/pass
+ * auth procedure followed by authentication based on a known key for 'remember me' type functionality.
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service("authenticationManager")
+public class DefaultAuthenticationManager
+ implements AuthenticationManager
+{
+
+ private List<Authenticator> authenticators;
+
+ @Inject
+ private ApplicationContext applicationContext;
+
+ @SuppressWarnings("unchecked")
+ @PostConstruct
+ public void initialize()
+ {
+ this.authenticators = new ArrayList<Authenticator>
+ ( applicationContext.getBeansOfType( Authenticator.class ).values() );
+ }
+
+
+ public String getId()
+ {
+ return "Default Authentication Manager - " + this.getClass().getName() + " : managed authenticators - " +
+ knownAuthenticators();
+ }
+
+ public AuthenticationResult authenticate( AuthenticationDataSource source )
+ throws AccountLockedException, AuthenticationException, MustChangePasswordException
+ {
+ if ( authenticators == null || authenticators.size() == 0 )
+ {
+ return ( new AuthenticationResult( false, null, new AuthenticationException(
+ "no valid authenticators, can't authenticate" ) ) );
+ }
+
+ // put AuthenticationResult exceptions in a map
+ Map<String,String> authnResultExceptionsMap = new HashMap<String,String>();
+ for ( Authenticator authenticator : authenticators )
+ {
+ if ( authenticator.supportsDataSource( source ) )
+ {
+ AuthenticationResult authResult = authenticator.authenticate( source );
+ Map<String,String> exceptionsMap = authResult.getExceptionsMap();
+
+ if ( authResult.isAuthenticated() )
+ {
+ return authResult;
+ }
+
+ if ( exceptionsMap != null )
+ {
+ authnResultExceptionsMap.putAll( exceptionsMap );
+ }
+ }
+ }
+
+ return ( new AuthenticationResult( false, null, new AuthenticationException(
+ "authentication failed on authenticators: " + knownAuthenticators() ), authnResultExceptionsMap ) );
+ }
+
+ public List<Authenticator> getAuthenticators()
+ {
+ return authenticators;
+ }
+
+ private String knownAuthenticators()
+ {
+ StringBuffer strbuf = new StringBuffer();
+
+ for ( Authenticator authenticator : authenticators )
+ {
+ strbuf.append( '(' ).append( authenticator.getId() ).append( ") " );
+ }
+
+ return strbuf.toString();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+/**
+ * EntityAuthenticationException.java
+ *
+ * @author Dan Diephouse
+ * @since $Id$
+ */
+public class NotAuthenticatedException
+ extends Exception
+{
+ /**
+ * Constructor EntityAuthenticationException.
+ */
+ public NotAuthenticatedException()
+ {
+ }
+
+ /**
+ * Constructor EntityAuthenticationException.
+ *
+ * @param message
+ */
+ public NotAuthenticatedException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * Constructor EntityAuthenticationException.
+ *
+ * @param message
+ * @param cause
+ */
+ public NotAuthenticatedException( String message, Exception cause )
+ {
+ super( message, cause );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+/**
+ * PasswordBasedAuthenticationDataSource: the username is considered the principal with this data source
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ *
+ */
+@Service("authenticationDataSource#password")
+@Scope("prototype")
+public class PasswordBasedAuthenticationDataSource
+ implements AuthenticationDataSource
+{
+ private String password;
+
+ private String principal;
+
+ public PasswordBasedAuthenticationDataSource()
+ {
+
+ }
+
+ public PasswordBasedAuthenticationDataSource( String principal, String password )
+ {
+ this.principal = principal;
+ this.password = password;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public String getPrincipal()
+ {
+ return principal;
+ }
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+
+ public void setPrincipal( String principal )
+ {
+ this.principal = principal;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "PasswordBasedAuthenticationDataSource[" );
+ sb.append( "principal=" ).append( principal );
+ sb.append( ",password=" );
+ if ( StringUtils.isNotEmpty( password ) )
+ {
+ // Intentionally not showing real password
+ sb.append( "***" );
+ }
+ sb.append( ']' );
+ return sb.toString();
+ }
+
+ public boolean isEnforcePasswordChange()
+ {
+ return true;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.authentication;
+
+/*
+ * 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.
+ */
+
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * TokenBasedAuthenticationDataSource
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "authenticationDataSource#token" )
+@Scope( "prototype" )
+public class TokenBasedAuthenticationDataSource
+ implements AuthenticationDataSource
+{
+ private String token;
+
+ private String principal;
+
+ private boolean enforcePasswordChange = true;
+
+ public TokenBasedAuthenticationDataSource( String principal )
+ {
+ this.principal = principal;
+ }
+
+ public TokenBasedAuthenticationDataSource()
+ {
+ }
+
+ public String getPrincipal()
+ {
+ return principal;
+ }
+
+ public String getToken()
+ {
+ return token;
+ }
+
+ public void setPrincipal( String principal )
+ {
+ this.principal = principal;
+ }
+
+ public void setToken( String token )
+ {
+ this.token = token;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append( "TokenBasedAuthenticationDataSource[" );
+ sb.append( "principal=" ).append( principal );
+ sb.append( ",token=" ).append( token );
+ sb.append( ']' );
+ return sb.toString();
+ }
+
+ public void setEnforcePasswordChange( boolean enforcePasswordChange )
+ {
+ this.enforcePasswordChange = enforcePasswordChange;
+ }
+
+ public boolean isEnforcePasswordChange()
+ {
+ return enforcePasswordChange;
+ }
+}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-/**
- * Contants class used for authentication
- * @version $Id$
- */
-public class AuthenticationConstants
-{
-
- // for User Manager Authenticator
- public static final String AUTHN_NO_SUCH_USER = "1";
-
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-/**
- * Just a tag to indicate that the implementing class is an AuthenticationDataSource.
- * <p/>
- * todo which this back to an interface and use the mojo style expression evaluation to populate the particular required fields
- *
- * @version $Id$
- * @see PasswordBasedAuthenticationDataSource
- * @see TokenBasedAuthenticationDataSource
- */
-public interface AuthenticationDataSource
-{
- public String ROLE = AuthenticationDataSource.class.getName();
-
- String getPrincipal();
-
- boolean isEnforcePasswordChange();
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-/**
- * AuthenticationException.java
- *
- * @author Jesse McConnell
- * @version $Id$
- */
-public class AuthenticationException
- extends Exception
-{
- /**
- * Constructor AuthenticationException.
- */
- public AuthenticationException()
- {
- }
-
- /**
- * Constructor AuthenticationException.
- *
- * @param message
- */
- public AuthenticationException( String message )
- {
- super( message );
- }
-
- public AuthenticationException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public AuthenticationException( Throwable cause )
- {
- super( cause );
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-
-import java.util.List;
-
-/**
- * AuthenticationManager:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-public interface AuthenticationManager
-{
- String getId();
-
- List<Authenticator> getAuthenticators();
-
- AuthenticationResult authenticate( AuthenticationDataSource source )
- throws AccountLockedException, AuthenticationException, MustChangePasswordException;
-}
\ No newline at end of file
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import java.io.Serializable;
-import java.util.Map;
-
-/**
- * AuthenticationResult: wrapper object for information that comes back from the authentication system
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class AuthenticationResult
- implements Serializable
-{
- private boolean isAuthenticated;
-
- /**
- * FIXME olamy this Object is a pain !!!
- */
- private Object principal;
-
- // TODO: why aren't these just thrown from the authenticate() method?
- private Exception exception;
-
- private Map<String,String> exceptionsMap;
-
- public AuthenticationResult()
- {
- this.isAuthenticated = false;
- this.principal = null;
- this.exception = null;
- }
-
- public AuthenticationResult( boolean authenticated, Object principal, Exception exception )
- {
- isAuthenticated = authenticated;
- this.principal = principal;
- this.exception = exception;
- }
-
- public AuthenticationResult( boolean authenticated, Object principal, Exception exception, Map<String,String> exceptionsMap )
- {
- isAuthenticated = authenticated;
- this.principal = principal;
- this.exception = exception;
- this.exceptionsMap = exceptionsMap;
- }
-
- public boolean isAuthenticated()
- {
- return isAuthenticated;
- }
-
- public Object getPrincipal()
- {
- return principal;
- }
-
- public Exception getException()
- {
- return exception;
- }
-
- public Map<String,String> getExceptionsMap()
- {
- return exceptionsMap;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "AuthenticationResult[" );
- sb.append( "principal=" ).append( principal );
- sb.append( ",isAuthenticated=" ).append( Boolean.toString( isAuthenticated ) );
- sb.append( ",exception=" );
- if ( exception != null )
- {
- sb.append( exception.getClass().getName() );
- sb.append( " : " ).append( exception.getMessage() );
- }
- else
- {
- sb.append( "<null>" );
- }
- sb.append( ']' );
- return sb.toString();
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-
-/**
- * Authenticator:
- *
- * @author Jesse McConnell
- * @version $Id$
- */
-public interface Authenticator
-{
- String getId();
-
- boolean supportsDataSource( AuthenticationDataSource source );
-
- AuthenticationResult authenticate( AuthenticationDataSource source )
- throws AccountLockedException, AuthenticationException, MustChangePasswordException;
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * DefaultAuthenticationManager: the goal of the authentication manager is to act as a conduit for
- * authentication requests into different authentication schemes
- * <p/>
- * For example, the default implementation can be configured with any number of authenticators and will
- * sequentially try them for an authenticated result. This allows you to have the standard user/pass
- * auth procedure followed by authentication based on a known key for 'remember me' type functionality.
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-@Service("authenticationManager")
-public class DefaultAuthenticationManager
- implements AuthenticationManager
-{
-
- private List<Authenticator> authenticators;
-
- @Inject
- private ApplicationContext applicationContext;
-
- @SuppressWarnings("unchecked")
- @PostConstruct
- public void initialize()
- {
- this.authenticators = new ArrayList<Authenticator>
- ( applicationContext.getBeansOfType( Authenticator.class ).values() );
- }
-
-
- public String getId()
- {
- return "Default Authentication Manager - " + this.getClass().getName() + " : managed authenticators - " +
- knownAuthenticators();
- }
-
- public AuthenticationResult authenticate( AuthenticationDataSource source )
- throws AccountLockedException, AuthenticationException, MustChangePasswordException
- {
- if ( authenticators == null || authenticators.size() == 0 )
- {
- return ( new AuthenticationResult( false, null, new AuthenticationException(
- "no valid authenticators, can't authenticate" ) ) );
- }
-
- // put AuthenticationResult exceptions in a map
- Map<String,String> authnResultExceptionsMap = new HashMap<String,String>();
- for ( Authenticator authenticator : authenticators )
- {
- if ( authenticator.supportsDataSource( source ) )
- {
- AuthenticationResult authResult = authenticator.authenticate( source );
- Map<String,String> exceptionsMap = authResult.getExceptionsMap();
-
- if ( authResult.isAuthenticated() )
- {
- return authResult;
- }
-
- if ( exceptionsMap != null )
- {
- authnResultExceptionsMap.putAll( exceptionsMap );
- }
- }
- }
-
- return ( new AuthenticationResult( false, null, new AuthenticationException(
- "authentication failed on authenticators: " + knownAuthenticators() ), authnResultExceptionsMap ) );
- }
-
- public List<Authenticator> getAuthenticators()
- {
- return authenticators;
- }
-
- private String knownAuthenticators()
- {
- StringBuffer strbuf = new StringBuffer();
-
- for ( Authenticator authenticator : authenticators )
- {
- strbuf.append( '(' ).append( authenticator.getId() ).append( ") " );
- }
-
- return strbuf.toString();
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-/**
- * EntityAuthenticationException.java
- *
- * @author Dan Diephouse
- * @since $Id$
- */
-public class NotAuthenticatedException
- extends Exception
-{
- /**
- * Constructor EntityAuthenticationException.
- */
- public NotAuthenticatedException()
- {
- }
-
- /**
- * Constructor EntityAuthenticationException.
- *
- * @param message
- */
- public NotAuthenticatedException( String message )
- {
- super( message );
- }
-
- /**
- * Constructor EntityAuthenticationException.
- *
- * @param message
- * @param cause
- */
- public NotAuthenticatedException( String message, Exception cause )
- {
- super( message, cause );
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import org.apache.commons.lang.StringUtils;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-/**
- * PasswordBasedAuthenticationDataSource: the username is considered the principal with this data source
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- *
- */
-@Service("authenticationDataSource#password")
-@Scope("prototype")
-public class PasswordBasedAuthenticationDataSource
- implements AuthenticationDataSource
-{
- private String password;
-
- private String principal;
-
- public PasswordBasedAuthenticationDataSource()
- {
-
- }
-
- public PasswordBasedAuthenticationDataSource( String principal, String password )
- {
- this.principal = principal;
- this.password = password;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public String getPrincipal()
- {
- return principal;
- }
-
- public void setPassword( String password )
- {
- this.password = password;
- }
-
- public void setPrincipal( String principal )
- {
- this.principal = principal;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "PasswordBasedAuthenticationDataSource[" );
- sb.append( "principal=" ).append( principal );
- sb.append( ",password=" );
- if ( StringUtils.isNotEmpty( password ) )
- {
- // Intentionally not showing real password
- sb.append( "***" );
- }
- sb.append( ']' );
- return sb.toString();
- }
-
- public boolean isEnforcePasswordChange()
- {
- return true;
- }
-}
+++ /dev/null
-package org.codehaus.plexus.redback.authentication;
-
-/*
- * 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.
- */
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-
-/**
- * TokenBasedAuthenticationDataSource
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "authenticationDataSource#token" )
-@Scope( "prototype" )
-public class TokenBasedAuthenticationDataSource
- implements AuthenticationDataSource
-{
- private String token;
-
- private String principal;
-
- private boolean enforcePasswordChange = true;
-
- public TokenBasedAuthenticationDataSource( String principal )
- {
- this.principal = principal;
- }
-
- public TokenBasedAuthenticationDataSource()
- {
- }
-
- public String getPrincipal()
- {
- return principal;
- }
-
- public String getToken()
- {
- return token;
- }
-
- public void setPrincipal( String principal )
- {
- this.principal = principal;
- }
-
- public void setToken( String token )
- {
- this.token = token;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
- sb.append( "TokenBasedAuthenticationDataSource[" );
- sb.append( "principal=" ).append( principal );
- sb.append( ",token=" ).append( token );
- sb.append( ']' );
- return sb.toString();
- }
-
- public void setEnforcePasswordChange( boolean enforcePasswordChange )
- {
- this.enforcePasswordChange = enforcePasswordChange;
- }
-
- public boolean isEnforcePasswordChange()
- {
- return enforcePasswordChange;
- }
-}
<context:annotation-config />
<context:component-scan
- base-package="org.codehaus.plexus.redback.authentication"/>
+ base-package="org.apache.archiva.redback.authentication"/>
</beans>
\ No newline at end of file
*/
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.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.apache.archiva.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 junit.framework.TestCase;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.PasswordEncoder;
import org.codehaus.plexus.redback.policy.encoders.SHA1PasswordEncoder;
import org.apache.archiva.redback.users.ldap.service.LdapCacheService;
* 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.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.springframework.stereotype.Service;
/**
*/
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.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
* 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.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.springframework.stereotype.Service;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.commons.lang.StringUtils;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.configuration.UserConfiguration;
import org.codehaus.plexus.redback.rbac.RBACManager;
import org.codehaus.plexus.redback.rbac.RbacManagerException;
* under the License.
*/
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationException;
/**
* HttpAuthenticationException
* under the License.
*/
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.system.SecuritySession;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.commons.codec.binary.Base64;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.system.SecuritySession;
* under the License.
*/
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.codehaus.redback.integration.filter.authentication.AbstractHttpAuthenticationFilter;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
* under the License.
*/
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.User;
import org.apache.commons.codec.binary.Base64;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authentication.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.apache.archiva.redback.users.UserManager;
* under the License.
*/
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.codehaus.redback.integration.filter.authentication.AbstractHttpAuthenticationFilter;
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
* specific language governing permissions and limitations
* under the License.
*/
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.keys.AuthenticationKey;
import org.codehaus.plexus.redback.keys.KeyManager;
import org.codehaus.plexus.redback.keys.jdo.JdoAuthenticationKey;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.cache.Cache;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.configuration.UserConfiguration;
import org.codehaus.plexus.redback.keys.AuthenticationKey;
import org.codehaus.plexus.redback.keys.KeyManager;
import org.apache.cxf.jaxrs.ext.RequestHandler;
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
import org.apache.cxf.message.Message;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.apache.cxf.jaxrs.ext.RequestHandler;
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
import org.apache.cxf.message.Message;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.AuthorizationException;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
import org.codehaus.plexus.redback.system.SecuritySession;
import org.apache.archiva.redback.users.User;
import org.apache.struts2.ServletActionContext;
-import org.codehaus.plexus.redback.authentication.AuthenticationConstants;
-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.PasswordBasedAuthenticationDataSource;
-import org.codehaus.plexus.redback.authentication.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationConstants;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.configuration.UserConfiguration;
import org.codehaus.plexus.redback.keys.AuthenticationKey;
import org.codehaus.plexus.redback.keys.KeyManagerException;
* under the License.
*/
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.UserManager;
import org.apache.struts2.ServletActionContext;
-import org.codehaus.plexus.redback.authentication.AuthenticationConstants;
-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.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationConstants;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.configuration.UserConfiguration;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import org.apache.struts2.ServletActionContext;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authentication.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.keys.AuthenticationKey;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.configuration.UserConfiguration;
import org.codehaus.plexus.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.RoleManagerException;
import java.util.HashMap;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.DefaultUserSecurityPolicy;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import net.sf.ehcache.CacheManager;
import org.apache.archiva.redback.users.UserManager;
import org.apache.struts2.StrutsSpringTestCase;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.rbac.RBACManager;
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionProxy;
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
import org.codehaus.plexus.redback.authorization.AuthorizationResult;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
*/
import com.opensymphony.xwork2.Action;
+import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.rbac.RbacManagerException;
* 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.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.keys.AuthenticationKey;
import org.codehaus.plexus.redback.keys.KeyManager;
import org.codehaus.plexus.redback.keys.KeyManagerException;
*/
import org.apache.archiva.redback.users.User;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.springframework.stereotype.Service;
import java.io.Serializable;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
-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.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationManager;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.codehaus.plexus.redback.authorization.AuthorizationDataSource;
import org.codehaus.plexus.redback.authorization.AuthorizationException;
import org.codehaus.plexus.redback.authorization.AuthorizationResult;
* under the License.
*/
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.users.User;
import java.io.Serializable;
*/
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationDataSource;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.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 junit.framework.TestCase;
-import org.codehaus.plexus.redback.authentication.AuthenticationManager;
+import org.apache.archiva.redback.authentication.AuthenticationManager;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
* under the License.
*/
+import org.apache.archiva.redback.authentication.Authenticator;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.authentication.AuthenticationConstants;
-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.apache.archiva.redback.authentication.AuthenticationConstants;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.policy.PasswordEncoder;
* @throws MustChangePasswordException
* @throws MustChangePasswordException
* @throws PolicyViolationException
- * @see org.codehaus.plexus.redback.authentication.Authenticator#authenticate(org.codehaus.plexus.redback.authentication.AuthenticationDataSource)
+ * @see org.apache.archiva.redback.authentication.Authenticator#authenticate(org.apache.archiva.redback.authentication.AuthenticationDataSource)
*/
public AuthenticationResult authenticate( AuthenticationDataSource ds )
throws AuthenticationException, AccountLockedException, MustChangePasswordException
}
/**
- * Returns the wrapped {@link UserManager} used by this {@link Authenticator}
+ * Returns the wrapped {@link UserManager} used by this {@link org.apache.archiva.redback.authentication.Authenticator}
* implementation for authentication.
*
* @return the userManager
*/
import junit.framework.TestCase;
-import org.apache.archiva.redback.authentication.users.UserManagerAuthenticator;
+import org.apache.archiva.redback.authentication.Authenticator;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
-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.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.codehaus.plexus.redback.policy.AccountLockedException;
import org.codehaus.plexus.redback.policy.MustChangePasswordException;
import org.codehaus.plexus.redback.policy.UserSecurityPolicy;