--- /dev/null
+package org.apache.archiva.redback.integration;
+
+/*
+ * 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.util.Properties;
+
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Collection of Utility methods useful in an Http environment.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * @todo should move this to plexus-utils or plexus-utils-web
+ */
+public class HttpUtils
+{
+ /**
+ * Convert typical complex header into properties.
+ * <p/>
+ * <p/>
+ * Example:
+ * </p>
+ * <p/>
+ * <code>
+ * realm="Somewhere Over The Rainbow", domain="kansas.co.us", nonce="65743ABCF"
+ * </code>
+ * <p/>
+ * <p>becomes</p>
+ * <p/>
+ * <code>
+ * Map ( "realm", "Somewhere Over The Rainbox" )
+ * Map ( "domain", "kansas.co.us" )
+ * Map ( "nonce", "65743ABCF" )
+ * </code>
+ *
+ * @param rawheader
+ * @param majorDelim
+ * @param subDelim
+ * @return
+ */
+ public static Properties complexHeaderToProperties( String rawheader, String majorDelim, String subDelim )
+ {
+ Properties ret = new Properties();
+
+ if ( StringUtils.isEmpty( rawheader ) )
+ {
+ return ret;
+ }
+
+ String array[] = StringUtils.split( rawheader, majorDelim );
+ for ( int i = 0; i < array.length; i++ )
+ {
+ // String quotes.
+ String rawelem = StringUtils.replace( array[i], "\"", "" );
+ String parts[] = StringUtils.split( rawelem, subDelim, 2 );
+
+ ret.setProperty( StringUtils.trim( parts[0] ), StringUtils.trim( parts[1] ) );
+ }
+
+ return ret;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks;
+
+/*
+ * 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.util.List;
+
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
+import org.springframework.stereotype.Service;
+
+/**
+ * ExpectedJsps
+ * @FIXME the jsp list is not correct
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("environmentCheck#ExpectedJsps")
+public class ExpectedJsps
+ implements EnvironmentCheck
+{
+ public void validateEnvironment( List<String> violations )
+ {
+ String redback = "/WEB-INF/jsp/redback";
+ String resources[] = new String[]{"/admin/userCreate.jspf", "/admin/userList.jspf", "/admin/userEdit.jspf",
+ "/admin/userFind.jspf", "/userCredentials.jspf", "/account.jspf", "/login.jspf", "/passwordChange.jspf",
+ "/register.jspf"};
+
+ int missingCount = 0;
+ String jspPath;
+
+ for ( int i = 0; i >= resources.length; i++ )
+ {
+ jspPath = redback + resources[i];
+ if ( !jspExists( jspPath ) )
+ {
+ violations.add( "Missing JSP " + quote( jspPath ) + "." );
+ missingCount++;
+ }
+ }
+
+ if ( missingCount > 0 )
+ {
+ violations.add( "Missing " + missingCount + " JSP(s)." );
+ }
+ }
+
+ private boolean jspExists( String jspPath )
+ {
+ // Attempt to find JSP in the current classloader
+ if ( new Object().getClass().getResource( jspPath ) == null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ private String quote( Object o )
+ {
+ if ( o == null )
+ {
+ return "<null>";
+ }
+ return "\"" + o.toString() + "\"";
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.security;
+
+/*
+ * 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.rbac.RBACManager;
+import org.apache.archiva.redback.role.RoleManagerException;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.commons.lang.StringUtils;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.configuration.UserConfiguration;
+import org.apache.archiva.redback.rbac.RbacManagerException;
+import org.apache.archiva.redback.rbac.Role;
+import org.apache.archiva.redback.role.RoleManager;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.codehaus.plexus.util.IOUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.5
+ */
+@Service( "AdminAutoCreateCheck" )
+public class AdminAutoCreateCheck
+ implements EnvironmentCheck
+{
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ public static final String FORCE_ADMIN_FILE_PATH = "redback.admin.creation.file";
+
+ public static final String ADMIN_FULL_NAME_KEY = "redback.admin.fullname";
+
+ public static final String ADMIN_EMAIL_KEY = "redback.admin.email";
+
+ public static final String ADMIN_PASSWORD_KEY = "redback.admin.password";
+
+ @Inject
+ @Named( value = "userManager#configurable" )
+ private UserManager userManager;
+
+ @Inject
+ private UserConfiguration config;
+
+ @Inject
+ protected SecuritySystem securitySystem;
+
+ @Inject
+ private RoleManager roleManager;
+
+ @Inject
+ @Named( value = "rBACManager#cached" )
+ private RBACManager rbacManager;
+
+ public void validateEnvironment( List<String> violations )
+ {
+ try
+ {
+ User user = userManager.findUser( getAdminUid() );
+ if ( user == null )
+ {
+ useForceAdminCreationFile();
+ }
+
+
+ }
+ catch ( UserNotFoundException e )
+ {
+ useForceAdminCreationFile();
+ }
+ }
+
+ private void checkAdminKarma( User u )
+ {
+ try
+ {
+ Collection<Role> roles = rbacManager.getEffectivelyAssignedRoles( getAdminUid() );
+ boolean adminRole = false;
+ for ( Role role : roles )
+ {
+ if ( StringUtils.equals( "system-administrator", role.getName() ) )
+ {
+ adminRole = true;
+ }
+ }
+ if ( !adminRole )
+ {
+ assignAdminRole( u );
+ }
+ }
+ catch ( RbacManagerException e )
+ {
+ log.warn( "fail to checkAdminKarma {}", e, e.getMessage() );
+ }
+ catch ( RoleManagerException e )
+ {
+ log.warn( "fail to assignAdmin role {}", e, e.getMessage() );
+ }
+ }
+
+ private void useForceAdminCreationFile()
+ {
+ try
+ {
+ String forceAdminFilePath = System.getProperty( FORCE_ADMIN_FILE_PATH );
+ if ( StringUtils.isBlank( forceAdminFilePath ) )
+ {
+ log.info( FORCE_ADMIN_FILE_PATH + " system props is empty don't use an auto creation admin " );
+ return;
+ }
+ File file = new File( forceAdminFilePath );
+ if ( !file.exists() )
+ {
+ log.warn( "file set in sysprops " + FORCE_ADMIN_FILE_PATH + " not exists skip admin auto creation" );
+ return;
+ }
+ log.debug( "user {} not found try auto creation" );
+ Properties properties = new Properties();
+ FileInputStream fis = new FileInputStream( file );
+ try
+ {
+ properties.load( fis );
+ }
+ catch ( Exception e )
+ {
+ log.warn( "error loading properties from file " + forceAdminFilePath + " skip admin auto creation" );
+ return;
+ }
+ finally
+ {
+ IOUtil.close( fis );
+ }
+
+ // ensure we have all properties
+ String password = properties.getProperty( ADMIN_PASSWORD_KEY );
+ String email = properties.getProperty( ADMIN_EMAIL_KEY );
+ String fullName = properties.getProperty( ADMIN_FULL_NAME_KEY );
+
+ if ( StringUtils.isBlank( password ) )
+ {
+ log.warn( "property " + ADMIN_PASSWORD_KEY + " not set skip auto admin creation" );
+ return;
+ }
+
+ if ( StringUtils.isBlank( email ) )
+ {
+ log.warn( "property " + ADMIN_EMAIL_KEY + " not set skip auto admin creation" );
+ return;
+ }
+
+ if ( StringUtils.isBlank( fullName ) )
+ {
+ log.warn( "property " + ADMIN_FULL_NAME_KEY + " not set skip auto admin creation" );
+ return;
+ }
+
+ User u = userManager.createUser( getAdminUid(), fullName, email );
+
+ u.setPassword( password );
+ u.setLocked( false );
+ u.setPasswordChangeRequired( false );
+ u.setPermanent( true );
+ u.setValidated( true );
+
+ u = userManager.addUser( u );
+ u.setPassword( password );
+
+ PasswordBasedAuthenticationDataSource authdatasource = new PasswordBasedAuthenticationDataSource();
+ authdatasource.setPrincipal( u.getUsername() );
+ authdatasource.setPassword( u.getPassword() );
+ SecuritySession securitySession = securitySystem.authenticate( authdatasource );
+ if ( securitySession.getAuthenticationResult().isAuthenticated() )
+ {
+ // good add various tokens.
+ u = securitySession.getUser();
+ u.setLastLoginDate( new Date() );
+ securitySystem.getUserManager().updateUser( u );
+ }
+ assignAdminRole( u );
+
+ }
+ catch ( Exception e )
+ {
+ log.warn( "failed to automatically create an admin account " + e.getMessage(), e );
+ }
+ }
+
+ private void assignAdminRole( User user )
+ throws RoleManagerException
+ {
+ roleManager.assignRole( "system-administrator", user.getPrincipal().toString() );
+ }
+
+ private String getAdminUid()
+ {
+ return config.getString( "redback.default.admin" );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.security;
+
+/*
+ * 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.policy.UserSecurityPolicy;
+import org.apache.archiva.redback.role.RoleManagerException;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.role.RoleManager;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.users.UserManager;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.util.List;
+
+/**
+ * RequiredRolesEnvironmentCheck:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service( "environmentCheck#guest-user-check" )
+public class GuestUserEnvironmentCheck
+ implements EnvironmentCheck
+{
+
+ @Inject
+ private RoleManager roleManager;
+
+ @Inject
+ private SecuritySystem securitySystem;
+
+ /**
+ * boolean detailing if this environment check has been executed
+ */
+ private boolean checked = false;
+
+ /**
+ * @param violations
+ */
+ public void validateEnvironment( List<String> violations )
+ {
+ if ( !checked )
+ {
+ UserManager userManager = securitySystem.getUserManager();
+ UserSecurityPolicy policy = securitySystem.getPolicy();
+
+ User guest;
+ try
+ {
+ guest = userManager.getGuestUser();
+ }
+ catch ( UserNotFoundException e )
+ {
+ policy.setEnabled( false );
+ guest = userManager.createGuestUser();
+ policy.setEnabled( true );
+ }
+
+ try
+ {
+ roleManager.assignRole( "guest", guest.getPrincipal().toString() );
+ }
+ catch ( RoleManagerException rpe )
+ {
+ violations.add( "unable to initialize guest user properly: " + rpe.getMessage() );
+ }
+
+ checked = true;
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.security;
+
+/*
+ * 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.rbac.RbacManagerException;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.rbac.RBACManager;
+import org.apache.archiva.redback.rbac.UserAssignment;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.integration.role.RoleConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * LockedAdminEnvironmentCheck: checks if accounts marked as system administrator are locked
+ * and unlocks them on startup.
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service( "environmentCheck#locked-admin-check" )
+public class LockedAdminEnvironmentCheck
+ implements EnvironmentCheck
+{
+
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ @Named( value = "userManager#configurable" )
+ private UserManager userManager;
+
+ @Inject
+ @Named( value = "rBACManager#cached" )
+ private RBACManager rbacManager;
+
+ /**
+ * boolean detailing if this environment check has been executed
+ */
+ private boolean checked = false;
+
+ /**
+ * This environment check will unlock system administrator accounts that are locked on the restart of the
+ * application when the environment checks are processed.
+ *
+ * @param violations
+ */
+ public void validateEnvironment( List<String> violations )
+ {
+ if ( !checked && !userManager.isReadOnly() )
+ {
+ List<String> roles = new ArrayList<String>();
+ roles.add( RoleConstants.SYSTEM_ADMINISTRATOR_ROLE );
+
+ List<UserAssignment> systemAdminstrators;
+ try
+ {
+ systemAdminstrators = rbacManager.getUserAssignmentsForRoles( roles );
+
+ for ( UserAssignment userAssignment : systemAdminstrators )
+ {
+ try
+ {
+ User admin = userManager.findUser( userAssignment.getPrincipal() );
+
+ if ( admin.isLocked() )
+ {
+ log.info( "Unlocking system administrator: {}", admin.getUsername() );
+ admin.setLocked( false );
+ userManager.updateUser( admin );
+ }
+ }
+ catch ( UserNotFoundException ne )
+ {
+ log.warn( "Dangling UserAssignment -> {}", userAssignment.getPrincipal() );
+ }
+ }
+ }
+ catch ( RbacManagerException e )
+ {
+ log.warn( "Exception when checking for locked admin user: " + e.getMessage(), e );
+ }
+
+ checked = true;
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.security;
+
+/*
+ * 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.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.archiva.redback.role.RoleManager;
+import org.apache.archiva.redback.role.RoleManagerException;
+import org.apache.archiva.redback.system.check.EnvironmentCheck;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * RequiredRolesEnvironmentCheck: this environment check will check that the
+ * required roles of the redback-xwork-integration artifact exist to be
+ * assigned.
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+@Service("environmentCheck#required-roles")
+public class RequiredRolesEnvironmentCheck
+ implements EnvironmentCheck
+{
+
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ private RoleManager roleManager;
+
+ /**
+ * boolean detailing if this environment check has been executed
+ */
+ private boolean checked = false;
+
+ /**
+ * @param violations
+ */
+ public void validateEnvironment( List<String> violations )
+ {
+ if ( !checked )
+ {
+ log.info( "Checking the existence of required roles." );
+
+ try
+ {
+ if ( !roleManager.roleExists( "registered-user" ) )
+ {
+ violations.add( "unable to validate existence of the registered-user role" );
+ }
+
+ if ( !roleManager.roleExists( "user-administrator" ) )
+ {
+ violations.add( "unable to validate existence of the user-administator role" );
+ }
+
+ if ( !roleManager.roleExists( "system-administrator" ) )
+ {
+ violations.add( "unable to validate existence of the system-administrator role" );
+ }
+ }
+ catch ( RoleManagerException e )
+ {
+ violations.add( "unable to check required roles: " + e.getMessage() );
+ }
+
+ checked = true;
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.xwork;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+/**
+ * XworkActionConfig
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class XworkActionConfig
+{
+ public String name;
+
+ public String clazz;
+
+ public String method;
+
+ public List<String> results = new ArrayList<String>();
+
+ public XworkActionConfig( String name, String className, String method )
+ {
+ this.name = name;
+ this.clazz = className;
+ this.method = method;
+ }
+
+ public XworkActionConfig addResult( String name )
+ {
+ results.add( name );
+ return this;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.checks.xwork;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+/**
+ * XworkPackageConfig
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class XworkPackageConfig
+{
+ public String name;
+
+ public List<XworkActionConfig> actions = new ArrayList<XworkActionConfig>();
+
+ public XworkPackageConfig( String name )
+ {
+ this.name = name;
+ }
+
+ public XworkActionConfig addAction( String name, String className, String method )
+ {
+ XworkActionConfig config = new XworkActionConfig( name, className, method );
+ actions.add( config );
+ return config;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc;
+
+/*
+ * 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.extremecomponents.table.bean.Column;
+import org.extremecomponents.table.cell.AbstractCell;
+import org.extremecomponents.table.core.TableModel;
+import org.extremecomponents.table.view.html.BuilderUtils;
+
+/**
+ * CheckboxImageCell
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CheckboxImageCell
+ extends AbstractCell
+{
+
+ private static final String CHECKBOX_TRUE = "icon_success_sml";
+
+ private static final String CHECKBOX_FALSE = "checkbox-false";
+
+ protected String getCellValue( TableModel model, Column column )
+ {
+ Object value = column.getPropertyValue();
+ if ( value == null )
+ {
+ return "";
+ }
+
+ Boolean bool = (Boolean) value;
+
+ String cellValue = "<img src=\"";
+
+ if ( bool.booleanValue() )
+ {
+ cellValue = cellValue + BuilderUtils.getImage( model, CHECKBOX_TRUE );
+ }
+ else
+ {
+ cellValue = cellValue + BuilderUtils.getImage( model, CHECKBOX_FALSE );
+ }
+
+ cellValue = cellValue + "\" alt=\"" + bool.toString() + "\"/>";
+
+ return cellValue;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc;
+
+/*
+ * 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.extremecomponents.table.bean.Column;
+import org.extremecomponents.table.cell.AbstractCell;
+import org.extremecomponents.table.core.TableModel;
+
+/**
+ * MailtoCell
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class MailtoCell
+ extends AbstractCell
+{
+
+ protected String getCellValue( TableModel model, Column column )
+ {
+ String value = column.getPropertyValueAsString();
+ if ( StringUtils.isBlank( value ) )
+ {
+ return "";
+ }
+
+ return "<a href=\"mailto:" + value + "\">" + value + "</a>";
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc;
+
+/*
+ * 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.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.archiva.redback.integration.util.UserComparator;
+import org.extremecomponents.table.callback.ProcessRowsCallback;
+import org.extremecomponents.table.core.TableConstants;
+import org.extremecomponents.table.core.TableModel;
+import org.extremecomponents.table.limit.Sort;
+
+/**
+ * ProcessUserRowsCallback - Efficient and safe sort callback for user manager provided user lists.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ProcessUserRowsCallback
+ extends ProcessRowsCallback
+{
+
+ @SuppressWarnings("unchecked")
+ public Collection sortRows( TableModel model, Collection rows )
+ throws Exception
+ {
+ boolean sorted = model.getLimit().isSorted();
+
+ if ( !sorted )
+ {
+ return rows;
+ }
+
+ Sort sort = model.getLimit().getSort();
+ String property = sort.getProperty();
+ String sortOrder = sort.getSortOrder();
+
+ System.out.println( "SORTING: " + property + " - " + sortOrder );
+
+ UserComparator comparator = new UserComparator( property, TableConstants.SORT_ASC.equals( sortOrder ) );
+ Collections.sort( (List) rows, comparator );
+
+ return rows;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc;
+
+/*
+ * 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.extremecomponents.table.bean.Column;
+import org.extremecomponents.table.cell.Cell;
+import org.extremecomponents.table.core.TableConstants;
+import org.extremecomponents.table.core.TableModel;
+import org.extremecomponents.table.view.html.TableActions;
+import org.extremecomponents.util.HtmlBuilder;
+
+/**
+ * SecurityFilterCell
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SecurityFilterCell
+ implements Cell
+{
+ public String getExportDisplay( TableModel model, Column column )
+ {
+ return null;
+ }
+
+ public String getHtmlDisplay( TableModel model, Column column )
+ {
+ HtmlBuilder html = new HtmlBuilder();
+
+ html.td( 2 );
+
+ if ( StringUtils.isNotEmpty( column.getFilterClass() ) )
+ {
+ html.styleClass( column.getFilterClass() );
+ }
+
+ if ( StringUtils.isNotEmpty( column.getFilterStyle() ) )
+ {
+ html.style( column.getFilterStyle() );
+ }
+
+ if ( StringUtils.isNotEmpty( column.getWidth() ) )
+ {
+ html.width( column.getWidth() );
+ }
+
+ html.close();
+
+ html.div();
+ html.styleClass( "filterInputGroup" );
+ html.close();
+
+ if ( !column.isFilterable() )
+ {
+ html.append( "" );
+ }
+ else
+ {
+ html.append( input( model, column ) );
+ }
+
+ html.divEnd();
+
+ html.tdEnd();
+
+ return html.toString();
+ }
+
+ /**
+ * If the filter is specified the default is to use a <input type=text> tag.
+ */
+ private String input( TableModel model, Column column )
+ {
+ HtmlBuilder html = new HtmlBuilder();
+
+ html.input( "text" );
+ html.name( model.getTableHandler().prefixWithTableId() + TableConstants.FILTER + column.getAlias() );
+
+ html.title( "Filter by " + column.getTitle() );
+
+ String value = column.getValueAsString();
+ if ( StringUtils.isNotBlank( value ) )
+ {
+ html.value( value );
+ }
+
+ StringBuffer onkeypress = new StringBuffer();
+ onkeypress.append( "if (event.keyCode == 13) {" );
+ onkeypress.append( new TableActions( model ).getFilterAction() );
+ onkeypress.append( "}" );
+ html.onkeypress( onkeypress.toString() );
+
+ html.xclose();
+
+ return html.toString();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc.views;
+
+/*
+ * 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.util.Iterator;
+
+import org.extremecomponents.table.bean.Export;
+import org.extremecomponents.table.core.TableModel;
+import org.extremecomponents.table.view.html.BuilderConstants;
+import org.extremecomponents.table.view.html.BuilderUtils;
+import org.extremecomponents.table.view.html.StatusBarBuilder;
+import org.extremecomponents.table.view.html.ToolbarBuilder;
+import org.extremecomponents.table.view.html.TwoColumnRowLayout;
+import org.extremecomponents.util.HtmlBuilder;
+
+/**
+ * SecurityToolbar
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SecurityToolbar
+ extends TwoColumnRowLayout
+{
+ public SecurityToolbar( HtmlBuilder html, TableModel model )
+ {
+ super( html, model );
+ }
+
+ protected boolean showLayout( TableModel model )
+ {
+ boolean showStatusBar = BuilderUtils.showStatusBar( model );
+ boolean filterable = BuilderUtils.filterable( model );
+ boolean showExports = BuilderUtils.showExports( model );
+ boolean showPagination = BuilderUtils.showPagination( model );
+ boolean showTitle = BuilderUtils.showTitle( model );
+ if ( !showStatusBar && !filterable && !showExports && !showPagination && !showTitle )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ protected void columnLeft( HtmlBuilder html, TableModel model )
+ {
+ boolean showStatusBar = BuilderUtils.showStatusBar( model );
+ if ( !showStatusBar )
+ {
+ return;
+ }
+
+ html.td( 4 ).styleClass( BuilderConstants.STATUS_BAR_CSS ).close();
+
+ new StatusBarBuilder( html, model ).statusMessage();
+
+ html.tdEnd();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void columnRight( HtmlBuilder html, TableModel model )
+ {
+ boolean filterable = BuilderUtils.filterable( model );
+ boolean showPagination = BuilderUtils.showPagination( model );
+ boolean showExports = BuilderUtils.showExports( model );
+
+ ToolbarBuilder toolbarBuilder = new ToolbarBuilder( html, model );
+
+ html.td( 4 ).styleClass( BuilderConstants.COMPACT_TOOLBAR_CSS ).align( "right" ).close();
+
+ html.table( 4 ).border( "0" ).cellPadding( "1" ).cellSpacing( "2" ).close();
+ html.tr( 5 ).close();
+
+ if ( showPagination )
+ {
+ html.td( 5 ).close();
+ html.append( "Navigation:" );
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.firstPageItemAsImage();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.prevPageItemAsImage();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.nextPageItemAsImage();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.lastPageItemAsImage();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.separator();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ html.append( "Display Rows:" );
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.rowsDisplayedDroplist();
+ html.tdEnd();
+
+ if ( showExports )
+ {
+ html.td( 5 ).close();
+ toolbarBuilder.separator();
+ html.tdEnd();
+ }
+ }
+
+ if ( showExports )
+ {
+ Iterator iterator = model.getExportHandler().getExports().iterator();
+ for ( Iterator iter = iterator; iter.hasNext(); )
+ {
+ html.td( 5 ).close();
+ Export export = (Export) iter.next();
+ toolbarBuilder.exportItemAsImage( export );
+ html.tdEnd();
+ }
+ }
+
+ if ( filterable )
+ {
+ if ( showExports || showPagination )
+ {
+ html.td( 5 ).close();
+ toolbarBuilder.separator();
+ html.tdEnd();
+ }
+
+ html.td( 5 ).close();
+ toolbarBuilder.filterItemAsButton();
+ html.tdEnd();
+
+ html.td( 5 ).close();
+ toolbarBuilder.clearItemAsButton();
+ html.tdEnd();
+ }
+
+ html.trEnd( 5 );
+
+ html.tableEnd( 4 );
+
+ html.tdEnd();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.eXc.views;
+
+/*
+ * 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.extremecomponents.table.core.TableModel;
+import org.extremecomponents.table.view.AbstractHtmlView;
+import org.extremecomponents.util.HtmlBuilder;
+
+/**
+ * SecurityView
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SecurityView
+ extends AbstractHtmlView
+{
+ protected void beforeBodyInternal( TableModel model )
+ {
+ getTableBuilder().tableStart();
+
+ getTableBuilder().theadStart();
+
+ getTableBuilder().titleRowSpanColumns();
+
+ navigationToolbar( getHtmlBuilder(), getTableModel() );
+
+ getTableBuilder().headerRow();
+
+ getTableBuilder().theadEnd();
+
+ getTableBuilder().filterRow();
+
+ getTableBuilder().tbodyStart();
+ }
+
+ protected void afterBodyInternal( TableModel model )
+ {
+ getCalcBuilder().defaultCalcLayout();
+
+ getTableBuilder().tbodyEnd();
+
+ getTableBuilder().tableEnd();
+ }
+
+ protected void navigationToolbar( HtmlBuilder html, TableModel model )
+ {
+ new SecurityToolbar( html, model ).layout();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter;
+
+/*
+ * 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.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+
+/**
+ * SpringServletFilter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class SpringServletFilter
+ implements Filter
+{
+ private ApplicationContext applicationContext;
+
+ public void destroy()
+ {
+ // Do nothing here.
+ }
+
+ protected ApplicationContext getApplicationContext()
+ {
+ return applicationContext;
+ }
+
+ public void init( FilterConfig filterConfig )
+ throws ServletException
+ {
+ applicationContext = WebApplicationContextUtils.getWebApplicationContext( filterConfig.getServletContext() );
+
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.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 javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+
+import org.apache.archiva.redback.integration.filter.SpringServletFilter;
+
+/**
+ * AbstractHttpAuthenticationFilter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class AbstractHttpAuthenticationFilter
+ extends SpringServletFilter
+{
+ private String realmName;
+
+ public void init( FilterConfig filterConfig )
+ throws ServletException
+ {
+ realmName = filterConfig.getInitParameter( "realm-name" );
+ }
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
+
+ public void setRealmName( String realmName )
+ {
+ this.realmName = realmName;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.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.AuthenticationException;
+
+/**
+ * HttpAuthenticationException
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HttpAuthenticationException
+ extends AuthenticationException
+{
+
+ public HttpAuthenticationException()
+ {
+ super();
+ }
+
+ public HttpAuthenticationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public HttpAuthenticationException( String message )
+ {
+ super( message );
+ }
+
+ public HttpAuthenticationException( Throwable cause )
+ {
+ super( cause );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.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.AuthenticationException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.apache.archiva.redback.authentication.AuthenticationDataSource;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * HttpAuthenticator
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class HttpAuthenticator
+{
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject
+ protected SecuritySystem securitySystem;
+
+ /**
+ * The Public Face of the Authenticator.
+ *
+ * @throws MustChangePasswordException
+ * @throws AccountLockedException
+ */
+ public AuthenticationResult authenticate( AuthenticationDataSource ds, HttpSession httpSession )
+ throws AuthenticationException, AccountLockedException, MustChangePasswordException
+ {
+ try
+ {
+ SecuritySession securitySession = securitySystem.authenticate( ds );
+
+ setSecuritySession( securitySession, httpSession );
+
+ return securitySession.getAuthenticationResult();
+ }
+ catch ( AuthenticationException e )
+ {
+ String msg = "Unable to authenticate user: " + ds;
+ log.info( msg, e );
+ throw new HttpAuthenticationException( msg, e );
+ }
+ catch ( UserNotFoundException e )
+ {
+ log.info( "Login attempt against unknown user: {}", ds );
+ throw new HttpAuthenticationException( "User name or password invalid." );
+ }
+ }
+
+ /**
+ * Entry point for a Filter.
+ *
+ * @param request
+ * @param response
+ * @throws AuthenticationException
+ */
+ public void authenticate( HttpServletRequest request, HttpServletResponse response )
+ throws AuthenticationException
+ {
+ try
+ {
+ AuthenticationResult result = getAuthenticationResult( request, response );
+
+ if ( ( result == null ) || ( !result.isAuthenticated() ) )
+ {
+ throw new HttpAuthenticationException( "You are not authenticated." );
+ }
+ }
+ catch ( AccountLockedException e )
+ {
+ throw new HttpAuthenticationException( "Your account is locked.", e );
+ }
+ catch ( MustChangePasswordException e )
+ {
+ throw new HttpAuthenticationException( "You must change your password.", e );
+ }
+
+ }
+
+ /**
+ * Issue a Challenge Response back to the HTTP Client.
+ *
+ * @param request
+ * @param response
+ * @param realmName
+ * @param exception
+ * @throws IOException
+ */
+ public abstract void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
+ AuthenticationException exception )
+ throws IOException;
+
+ /**
+ * Parse the incoming request and return an AuthenticationResult.
+ *
+ * @param request
+ * @param response
+ * @return null if no http auth credentials, or the actual authentication result based on the credentials.
+ * @throws AuthenticationException
+ * @throws MustChangePasswordException
+ * @throws AccountLockedException
+ */
+ public abstract AuthenticationResult getAuthenticationResult( HttpServletRequest request,
+ HttpServletResponse response )
+ throws AuthenticationException, AccountLockedException, MustChangePasswordException;
+
+
+ public User getSessionUser( HttpSession httpSession )
+ {
+ return (User) httpSession.getAttribute( SecuritySession.USERKEY );
+ }
+
+ public boolean isAlreadyAuthenticated( HttpSession httpSession )
+ {
+ User user = getSessionUser( httpSession );
+
+ return ( ( user != null ) && !user.isLocked() && !user.isPasswordChangeRequired() );
+ }
+
+ public SecuritySession getSecuritySession( HttpSession httpSession )
+ {
+ SecuritySession securitySession = (SecuritySession) httpSession.getAttribute( SecuritySession.SESSION_KEY );
+ if ( securitySession != null )
+ {
+ return securitySession;
+ }
+ return (SecuritySession) httpSession.getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
+
+ }
+
+
+ public void setSecuritySession( SecuritySession session, HttpSession httpSession )
+ {
+ httpSession.setAttribute( SecuritySession.SESSION_KEY, session );
+ httpSession.setAttribute( SecuritySession.USERKEY, session.getUser() );
+ }
+
+ public void setSessionUser( User user, HttpSession httpSession )
+ {
+ httpSession.setAttribute( SecuritySession.SESSION_KEY, null );
+ httpSession.setAttribute( SecuritySession.USERKEY, user );
+ }
+
+ public String storeDefaultUser( String principal, HttpSession httpSession )
+ {
+ httpSession.setAttribute( SecuritySession.SESSION_KEY, null );
+ httpSession.setAttribute( SecuritySession.USERKEY, null );
+
+ if ( StringUtils.isEmpty( principal ) )
+ {
+ return null;
+ }
+
+ try
+ {
+ User user = securitySystem.getUserManager().findUser( principal );
+ httpSession.setAttribute( SecuritySession.USERKEY, user );
+
+ return user.getPrincipal().toString();
+
+ }
+ catch ( UserNotFoundException e )
+ {
+ log.warn( "Default User '" + principal + "' not found.", e );
+ return null;
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.basic;
+
+/*
+ * 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.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.archiva.redback.authentication.AuthenticationException;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.codehaus.plexus.util.StringUtils;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.springframework.stereotype.Service;
+
+/**
+ * HttpBasicAuthentication
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("httpAuthenticator#basic")
+public class HttpBasicAuthentication
+ extends HttpAuthenticator
+{
+
+ public String getId()
+ {
+ return HttpBasicAuthentication.class.getName();
+ }
+
+ public AuthenticationResult getAuthenticationResult( HttpServletRequest request, HttpServletResponse response )
+ throws AuthenticationException, AccountLockedException, MustChangePasswordException
+ {
+ HttpSession httpSession = request.getSession( true );
+ SecuritySession securitySession = getSecuritySession( httpSession );
+ if ( securitySession != null )
+ {
+ return securitySession.getAuthenticationResult();
+ }
+
+ PasswordBasedAuthenticationDataSource authDataSource;
+ String header = request.getHeader( "Authorization" );
+
+ // in tomcat this is : authorization=Basic YWRtaW46TWFuYWdlMDc=
+ if ( header == null )
+ {
+ header = request.getHeader( "authorization" );
+ }
+
+ if ( ( header != null ) && header.startsWith( "Basic " ) )
+ {
+ String base64Token = header.substring( 6 );
+ String token = new String( Base64.decodeBase64( base64Token.getBytes() ) );
+
+ String username = "";
+ String password = "";
+ int delim = token.indexOf( ':' );
+
+ if ( delim != ( -1 ) )
+ {
+ username = token.substring( 0, delim );
+ password = token.substring( delim + 1 );
+ }
+
+ authDataSource = new PasswordBasedAuthenticationDataSource( username, password );
+ return super.authenticate( authDataSource, httpSession );
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Return a HTTP 403 - Access Denied response.
+ *
+ * @param request the request to use.
+ * @param response the response to use.
+ * @param realmName the realm name to state.
+ * @param exception the exception to base the message off of.
+ * @throws IOException if there was a problem with the {@link HttpServletResponse#sendError(int,String)} call.
+ */
+ public void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
+ AuthenticationException exception )
+ throws IOException
+ {
+ response.addHeader( "WWW-Authenticate", "Basic realm=\"" + realmName + "\"" );
+ String message = "You must provide a username and password to access this resource.";
+ if ( ( exception != null ) && StringUtils.isNotEmpty( exception.getMessage() ) )
+ {
+ message = exception.getMessage();
+ }
+ response.sendError( HttpServletResponse.SC_UNAUTHORIZED, message );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.basic;
+
+/*
+ * 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.AuthenticationException;
+import org.apache.archiva.redback.integration.filter.authentication.AbstractHttpAuthenticationFilter;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * HttpBasicAuthenticationFilter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HttpBasicAuthenticationFilter
+ extends AbstractHttpAuthenticationFilter
+{
+ private HttpAuthenticator httpAuthentication;
+
+ @Override
+ public void init( FilterConfig filterConfig )
+ throws ServletException
+ {
+ super.init( filterConfig );
+
+ httpAuthentication = getApplicationContext().getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
+ }
+
+ public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
+ throws IOException, ServletException
+ {
+ if ( !( request instanceof HttpServletRequest ) )
+ {
+ throw new ServletException( "Can only process HttpServletRequest" );
+ }
+
+ if ( !( response instanceof HttpServletResponse ) )
+ {
+ throw new ServletException( "Can only process HttpServletResponse" );
+ }
+
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ try
+ {
+ httpAuthentication.authenticate( httpRequest, httpResponse );
+ }
+ catch ( AuthenticationException e )
+ {
+ HttpAuthenticator httpauthn = new HttpBasicAuthentication();
+ httpauthn.challenge( httpRequest, httpResponse, getRealmName(), e );
+ return;
+ }
+
+ chain.doFilter( request, response );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Digest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * @todo move to plexus-utils in future
+ */
+public class Digest
+{
+ public static String md5Hex( String data )
+ {
+ MessageDigest digest = getDigest( "MD5" );
+ return Hex.encode( digest.digest( data.getBytes() ) );
+ }
+
+ public static MessageDigest getDigest( String algorithm )
+ {
+ try
+ {
+ return MessageDigest.getInstance( algorithm );
+ }
+ catch ( NoSuchAlgorithmException e )
+ {
+ throw new RuntimeException( "Error initializing MessageDigest: " + e.getMessage(), e );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.
+ */
+
+/**
+ * Hex
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ * @todo should probably move this to plexus-utils or plexus-security-common
+ */
+public class Hex
+{
+ private static final byte[] DIGITS = "0123456789abcdef".getBytes();
+
+ public static String encode( byte[] data )
+ {
+ int l = data.length;
+
+ byte[] raw = new byte[l * 2];
+
+ for ( int i = 0, j = 0; i < l; i++ )
+ {
+ raw[j++] = DIGITS[( 0xF0 & data[i] ) >>> 4];
+ raw[j++] = DIGITS[0x0F & data[i]];
+ }
+
+ return new String( raw );
+ }
+
+ public static String encode( String raw )
+ {
+ return encode( raw.getBytes() );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.AuthenticationException;
+import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.users.User;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
+import org.apache.archiva.redback.policy.AccountLockedException;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.users.UserNotFoundException;
+import org.codehaus.plexus.util.StringUtils;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticationException;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+
+/**
+ * HttpDigestAuthentication methods for working with <a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617 HTTP Authentication</a>.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("httpAuthenticator#digest")
+public class HttpDigestAuthentication
+ extends HttpAuthenticator
+{
+ @Inject
+ @Named(value="userManager#configurable")
+ private UserManager userManager;
+
+ /**
+ *
+ */
+ private int nonceLifetimeSeconds = 300;
+
+ /**
+ * NOTE: Must be alphanumeric.
+ *
+ *
+ */
+ private String digestKey ="OrycteropusAfer";
+
+ private String realm;
+
+ public String getId()
+ {
+ return HttpDigestAuthentication.class.getName();
+ }
+
+ public AuthenticationResult getAuthenticationResult( HttpServletRequest request, HttpServletResponse response )
+ throws AuthenticationException, AccountLockedException, MustChangePasswordException
+ {
+ HttpSession httpSession = request.getSession( true );
+ if ( isAlreadyAuthenticated( httpSession ) )
+ {
+ return getSecuritySession( httpSession ).getAuthenticationResult();
+ }
+
+ TokenBasedAuthenticationDataSource authDataSource = new TokenBasedAuthenticationDataSource();
+ String authHeader = request.getHeader( "Authorization" );
+
+ // in tomcat this is : authorization=Basic YWRtaW46TWFuYWdlMDc=
+ if ( authHeader == null )
+ {
+ authHeader = request.getHeader( "authorization" );
+ }
+
+ if ( ( authHeader != null ) && authHeader.startsWith( "Digest " ) )
+ {
+ String rawDigestHeader = authHeader.substring( 7 );
+
+ HttpDigestHeader digestHeader = new HttpDigestHeader();
+ digestHeader.parseClientHeader( rawDigestHeader, getRealm(), digestKey );
+
+ // Lookup password for presented username
+ User user = findUser( digestHeader.username );
+ authDataSource.setPrincipal( user.getPrincipal().toString() );
+
+ String serverSideHash = generateDigestHash( digestHeader, user.getPassword(), request.getMethod() );
+
+ if ( !StringUtils.equals( serverSideHash, digestHeader.response ) )
+ {
+ throw new HttpAuthenticationException( "Digest response was invalid." );
+ }
+ }
+
+ return super.authenticate( authDataSource, httpSession );
+ }
+
+ public User findUser( String username )
+ throws HttpAuthenticationException
+ {
+ try
+ {
+ return userManager.findUser( username );
+ }
+ catch ( UserNotFoundException e )
+ {
+ String msg = "Unable to find primary user '" + username + "'.";
+ log.error( msg, e );
+ throw new HttpAuthenticationException( msg, e );
+ }
+ }
+
+ /**
+ * Issue HTTP Digest Authentication Challenge
+ *
+ * @param request the request to use.
+ * @param response the response to use.
+ * @param realmName the realm name to state.
+ * @param exception the exception to base the message off of.
+ * @throws IOException if there was a problem with the {@link HttpServletResponse#sendError(int,String)} call.
+ */
+ public void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
+ AuthenticationException exception )
+ throws IOException
+ {
+ // The Challenge Header
+ StringBuilder authHeader = new StringBuilder();
+ authHeader.append( "Digest " );
+ // [REQUIRED] The name to appear in the dialog box to the user.
+ authHeader.append( "realm=\"" ).append( realmName ).append( "\"" );
+ // [OPTIONAL] We do not use the optional 'domain' header.
+ // authHeader.append( "domain=\"" ).append( domain ).append( "\"" );
+ // [REQUIRED] Nonce specification.
+ authHeader.append( ", nonce=\"" );
+ long timestamp = System.currentTimeMillis() + ( nonceLifetimeSeconds * 1000 );
+ // Not using ETag from RFC 2617 intentionally.
+ String hraw = String.valueOf( timestamp ) + ":" + digestKey;
+ String rawnonce = String.valueOf( timestamp ) + ":" + Digest.md5Hex( hraw );
+ authHeader.append( Base64.encodeBase64( rawnonce.getBytes() ) );
+ authHeader.append( "\"" );
+ // [REQUIRED] The RFC 2617 Quality of Protection.
+ // MSIE Appears to only support 'auth'
+ // Do not use 'opaque' here. (Your MSIE users will have issues)
+ authHeader.append( ", qop=\"auth\"" );
+ // [BROKEN] since we force the 'auth' qop we cannot use the opaque option.
+ // authHeader.append( ", opaque=\"").append(opaqueString).append("\"");
+
+ // [OPTIONAL] Use of the stale option is reserved for expired nonce strings.
+ if ( exception instanceof NonceExpirationException )
+ {
+ authHeader.append( ", stale=\"true\"" );
+ }
+
+ // [OPTIONAL] We do not use the optional Algorithm header.
+ // authHeader.append( ", algorithm=\"MD5\"");
+
+ response.addHeader( "WWW-Authenticate", authHeader.toString() );
+ response.sendError( HttpServletResponse.SC_UNAUTHORIZED, exception.getMessage() );
+ }
+
+ private String generateDigestHash( HttpDigestHeader digestHeader, String password, String httpMethod )
+ {
+ String a1 = Digest.md5Hex( digestHeader.username + ":" + realm + ":" + password );
+ String a2 = Digest.md5Hex( httpMethod + ":" + digestHeader.uri );
+
+ String digest;
+
+ if ( StringUtils.isEmpty( digestHeader.qop ) )
+ {
+ digest = a1 + ":" + digestHeader.nonce + ":" + a2;
+ }
+ else if ( StringUtils.equals( "auth", digestHeader.qop ) )
+ {
+ digest = a1 + ":" + digestHeader.nonce + ":" + digestHeader.nc + ":" + digestHeader.cnonce + ":"
+ + digestHeader.qop + ":" + a2;
+ }
+ else
+ {
+ throw new IllegalStateException( "Http Digest Parameter [qop] with value of [" + digestHeader.qop
+ + "] is unsupported." );
+ }
+
+ return Digest.md5Hex( digest );
+ }
+
+ public String getRealm()
+ {
+ return realm;
+ }
+
+ public void setRealm( String realm )
+ {
+ this.realm = realm;
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.AuthenticationException;
+import org.apache.archiva.redback.integration.filter.authentication.AbstractHttpAuthenticationFilter;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * HttpDigestAuthenticationFilter.
+ * <p/>
+ * Uses RFC 2617 and RFC 2069 to perform Digest authentication against the incoming client.
+ * <p/>
+ * <ul>
+ * <li><a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617</a> - HTTP Authentication: Basic and Digest Access Authentication</li>
+ * <li><a href="http://www.faqs.org/rfcs/rfc2069.html">RFC 2069</a> - An Extension to HTTP : Digest Access Authentication</li>
+ * </ul>
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HttpDigestAuthenticationFilter
+ extends AbstractHttpAuthenticationFilter
+{
+ private HttpDigestAuthentication httpAuthentication;
+
+ @Override
+ public void init( FilterConfig filterConfig )
+ throws ServletException
+ {
+ super.init( filterConfig );
+
+ httpAuthentication =
+ getApplicationContext().getBean( "httpAuthenticator#digest", HttpDigestAuthentication.class );
+
+ }
+
+ public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
+ throws IOException, ServletException
+ {
+ if ( !( request instanceof HttpServletRequest ) )
+ {
+ throw new ServletException( "Can only process HttpServletRequest" );
+ }
+
+ if ( !( response instanceof HttpServletResponse ) )
+ {
+ throw new ServletException( "Can only process HttpServletResponse" );
+ }
+
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ try
+ {
+ httpAuthentication.setRealm( getRealmName() );
+ httpAuthentication.authenticate( httpRequest, httpResponse );
+ }
+ catch ( AuthenticationException e )
+ {
+ HttpAuthenticator httpauthn = new HttpBasicAuthentication();
+ httpauthn.challenge( httpRequest, httpResponse, getRealmName(), e );
+ return;
+ }
+
+ chain.doFilter( request, response );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.codec.binary.Base64;
+import org.codehaus.plexus.util.StringUtils;
+import org.apache.archiva.redback.integration.HttpUtils;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.util.Properties;
+
+/**
+ * HttpDigestHeader
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "httpClientHeader" )
+@Scope( "prototype" )
+public class HttpDigestHeader
+{
+ private Logger log = LoggerFactory.getLogger( HttpDigestHeader.class );
+
+ public String username;
+
+ public String realm;
+
+ public String nonce;
+
+ public String uri;
+
+ public String response;
+
+ public String qop;
+
+ public String nc;
+
+ public String cnonce;
+
+ public void parseClientHeader( String rawHeader, String expectedRealm, String digestKey )
+ throws HttpAuthenticationException
+ {
+ Properties authHeaderProps = HttpUtils.complexHeaderToProperties( rawHeader, ",", "=" );
+
+ username = authHeaderProps.getProperty( "username" );
+ realm = authHeaderProps.getProperty( "realm" );
+ nonce = authHeaderProps.getProperty( "nonce" );
+ uri = authHeaderProps.getProperty( "uri" );
+ response = authHeaderProps.getProperty( "response" );
+ qop = authHeaderProps.getProperty( "qop" );
+ nc = authHeaderProps.getProperty( "nc" );
+ cnonce = authHeaderProps.getProperty( "cnonce" );
+
+ // [RFC 2067] Validate all required values
+ if ( StringUtils.isEmpty( username ) || StringUtils.isEmpty( realm ) || StringUtils.isEmpty( nonce )
+ || StringUtils.isEmpty( uri ) || StringUtils.isEmpty( response ) )
+ {
+ log.debug( "Missing mandatory fields: Raw Digest Header : [{}]", rawHeader );
+
+ throw new HttpAuthenticationException( "Missing mandatory digest fields per RFC2069." );
+ }
+
+ // [RFC 2617] Validate realm.
+ if ( !StringUtils.equals( expectedRealm, realm ) )
+ {
+ log.debug( "Realm name is invalid: expected [{}] but got [{}]", expectedRealm, realm );
+
+ throw new HttpAuthenticationException( "Response realm does not match expected realm." );
+ }
+
+ // [RFC 2617] Validate "auth" qop
+ if ( StringUtils.equals( "auth", qop ) )
+ {
+ if ( StringUtils.isEmpty( nc ) || StringUtils.isEmpty( cnonce ) )
+ {
+ log.debug( "Missing mandatory qop fields: nc [{}] cnonce [{}]", nc, cnonce );
+
+ throw new HttpAuthenticationException( "Missing mandatory qop digest fields per RFC2617." );
+ }
+ }
+
+ // [RFC 2617] Validate nonce
+ if ( !Base64.isArrayByteBase64( nonce.getBytes() ) )
+ {
+ log.debug( "Nonce is not encoded in Base64: nonce [{}]", nonce );
+
+ throw new HttpAuthenticationException( "Response nonce is not encoded in Base64." );
+ }
+
+ // Decode nonce
+ String decodedNonce = new String( Base64.decodeBase64( nonce.getBytes() ) );
+ String nonceTokens[] = StringUtils.split( decodedNonce, ":" );
+
+ // Validate nonce format
+ if ( nonceTokens.length != 2 )
+ {
+ log.debug( "Nonce format expected [2] elements, but got [{}] instead. Decoded nonce [{}]",
+ nonceTokens.length, decodedNonce );
+
+ throw new HttpAuthenticationException(
+ "Nonce format is invalid. " + "Received an unexpected number of sub elements." );
+ }
+
+ // Extract nonce timestamp
+ long nonceTimestamp = 0;
+
+ try
+ {
+ nonceTimestamp = Long.parseLong( nonceTokens[0] );
+ }
+ catch ( NumberFormatException e )
+ {
+ throw new HttpAuthenticationException( "Unexpected nonce timestamp." );
+ }
+
+ // Extract nonce signature
+ String expectedSignature = Digest.md5Hex( nonceTimestamp + ":" + digestKey );
+
+ if ( !StringUtils.equals( expectedSignature, nonceTokens[1] ) )
+ {
+ log.error( "Nonce parameter has been compromised." );
+
+ throw new HttpAuthenticationException( "Nonce parameter has been compromised." );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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.integration.filter.authentication.HttpAuthenticationException;
+
+/**
+ * NonceExpirationException
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class NonceExpirationException
+ extends HttpAuthenticationException
+{
+
+ public NonceExpirationException()
+ {
+ super();
+ }
+
+ public NonceExpirationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public NonceExpirationException( String message )
+ {
+ super( message );
+ }
+
+ public NonceExpirationException( Throwable cause )
+ {
+ super( cause );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authorization;
+
+/*
+ * 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.authorization.AuthorizationException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.codehaus.plexus.util.StringUtils;
+import org.apache.archiva.redback.integration.filter.SpringServletFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * SimpleAuthorizationFilter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SimpleAuthorizationFilter
+ extends SpringServletFilter
+{
+
+ private Logger logger = LoggerFactory.getLogger( getClass() );
+
+ private String permission;
+
+ private String resource;
+
+ private String accessDeniedLocation;
+
+ public void init( FilterConfig filterConfig )
+ throws ServletException
+ {
+ super.init( filterConfig );
+
+ permission = filterConfig.getInitParameter( "permission" );
+ resource = filterConfig.getInitParameter( "resource" );
+ accessDeniedLocation = filterConfig.getInitParameter( "accessDeniedLocation" );
+
+ if ( StringUtils.isEmpty( accessDeniedLocation ) )
+ {
+ throw new ServletException(
+ "Missing parameter 'accessDeniedLocation' from " + SimpleAuthorizationFilter.class.getName()
+ + " configuration." );
+ }
+ }
+
+ public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
+ throws IOException, ServletException
+ {
+ SecuritySession securitySession = getApplicationContext().getBean( "securitySession", SecuritySession.class );
+
+ if ( securitySession == null )
+ {
+ logger.warn( "Security Session is null." );
+ return;
+ }
+
+ SecuritySystem securitySystem = getApplicationContext().getBean( "securitySystem", SecuritySystem.class );
+
+ boolean isAuthorized = false;
+
+ try
+ {
+ if ( StringUtils.isEmpty( resource ) )
+ {
+ isAuthorized = securitySystem.isAuthorized( securitySession, permission );
+ }
+ else
+ {
+ isAuthorized = securitySystem.isAuthorized( securitySession, permission, resource );
+ }
+ if ( isAuthorized )
+ {
+ chain.doFilter( request, response );
+ }
+ else
+ {
+ accessDenied( response );
+ }
+ }
+ catch ( AuthorizationException e )
+ {
+ accessDenied( response );
+ }
+ }
+
+ protected void accessDenied( ServletResponse response )
+ throws IOException
+ {
+ String newlocation = accessDeniedLocation;
+
+ if ( newlocation.indexOf( '?' ) == ( -1 ) )
+ {
+ newlocation += "?";
+ }
+ else
+ {
+ newlocation += "&";
+ }
+ newlocation += "resource=" + resource;
+
+ ( (HttpServletResponse) response ).sendRedirect( newlocation );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.interceptor;
+
+/*
+ * 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.
+ */
+
+/**
+ * SecureAction
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface SecureAction
+{
+ /**
+ * get an authorization bundle to process for authn and authz
+ */
+ SecureActionBundle getSecureActionBundle()
+ throws SecureActionException;
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.interceptor;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import org.apache.archiva.redback.rbac.Resource;
+
+/**
+ * SecureActionBundle:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+public class SecureActionBundle
+{
+ private boolean requiresAuthentication = false;
+
+ private List<AuthorizationTuple> authorizationTuples = new ArrayList<AuthorizationTuple>();
+
+ public static final SecureActionBundle OPEN;
+
+ public static final SecureActionBundle AUTHONLY;
+
+ static
+ {
+ OPEN = new SecureActionBundle();
+ AUTHONLY = new SecureActionBundle();
+ AUTHONLY.setRequiresAuthentication( true );
+ }
+
+ /**
+ * Add an authorization tuple
+ *
+ * @param operation
+ * @param resource
+ * @throws SecureActionException
+ */
+ public void addRequiredAuthorization( String operation, String resource )
+ throws SecureActionException
+ {
+ if ( operation != null && resource != null )
+ {
+ authorizationTuples.add( new AuthorizationTuple( operation, resource ) );
+ }
+ else
+ {
+ throw new SecureActionException( "operation and resource are required to be non-null" );
+ }
+ }
+
+ /**
+ * add an authorization tuple, assuming the resource part of it is Resource.GLOBAL
+ *
+ * @param operation
+ * @throws SecureActionException
+ */
+ public void addRequiredAuthorization( String operation )
+ throws SecureActionException
+ {
+ if ( operation != null )
+ {
+ authorizationTuples.add( new AuthorizationTuple( operation, Resource.GLOBAL ) );
+ }
+ else
+ {
+ throw new SecureActionException( "operation is required to be non-null" );
+ }
+ }
+
+ public List<AuthorizationTuple> getAuthorizationTuples()
+ {
+ return authorizationTuples;
+ }
+
+ public boolean requiresAuthentication()
+ {
+ return requiresAuthentication;
+ }
+
+ public void setRequiresAuthentication( boolean requiresAuthentication )
+ {
+ this.requiresAuthentication = requiresAuthentication;
+ }
+
+ public static class AuthorizationTuple
+ {
+ private String operation;
+
+ private String resource;
+
+ public AuthorizationTuple( String operation, String resource )
+ {
+ this.operation = operation;
+ this.resource = resource;
+ }
+
+ public String getOperation()
+ {
+ return operation;
+ }
+
+ public String getResource()
+ {
+ return resource;
+ }
+
+
+ public String toString()
+ {
+ return "AuthorizationTuple[" + operation + "," + resource + "]";
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.interceptor;
+
+/*
+ * 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.
+ */
+
+/**
+ * SecureActionException:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ */
+public class SecureActionException
+ extends Exception
+{
+
+ public SecureActionException( String string )
+ {
+ super( string );
+ }
+
+ public SecureActionException( String string, Throwable throwable )
+ {
+ super( string, throwable );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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.keys.AuthenticationKey;
+
+/**
+ * Mail generator component.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public interface MailGenerator
+{
+ String ROLE = MailGenerator.class.getName();
+
+ String generateMail( String templateName, AuthenticationKey authkey, String baseUrl );
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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.keys.AuthenticationKey;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface Mailer
+{
+ void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
+
+ void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
+
+ void sendMessage( Collection<String> recipients, String subject, String content );
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.archiva.redback.configuration.UserConfiguration;
+import org.apache.archiva.redback.keys.AuthenticationKey;
+import org.apache.archiva.redback.policy.UserSecurityPolicy;
+import org.apache.archiva.redback.policy.UserValidationSettings;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.stereotype.Service;
+
+/**
+ * Mailer
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("mailer")
+public class MailerImpl
+ implements Mailer
+{
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Inject @Named(value="mailGenerator#velocity")
+ private MailGenerator generator;
+
+ @Inject @Named(value="mailSender")
+ private JavaMailSender javaMailSender;
+
+ @Inject
+ private SecuritySystem securitySystem;
+
+ @Inject @Named(value="userConfiguration")
+ private UserConfiguration config;
+
+ public void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
+ {
+ String content = generator.generateMail( "newAccountValidationEmail", authkey, baseUrl );
+
+ UserSecurityPolicy policy = securitySystem.getPolicy();
+ UserValidationSettings validation = policy.getUserValidationSettings();
+ sendMessage( recipients, validation.getEmailSubject(), content );
+ }
+
+ public void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
+ {
+ String content = generator.generateMail( "passwordResetEmail", authkey, baseUrl );
+
+ UserSecurityPolicy policy = securitySystem.getPolicy();
+ UserValidationSettings validation = policy.getUserValidationSettings();
+ sendMessage( recipients, validation.getEmailSubject(), content );
+ }
+
+ public void sendMessage( Collection<String> recipients, String subject, String content )
+ {
+ if ( recipients.isEmpty() )
+ {
+ log.warn( "Mail Not Sent - No mail recipients for email. subject [" + subject + "]" );
+ return;
+ }
+
+ String fromAddress = config.getString( "email.from.address" );
+ String fromName = config.getString( "email.from.name" );
+
+ if ( StringUtils.isEmpty( fromAddress ) )
+ {
+ fromAddress = System.getProperty( "user.name" ) + "@localhost";
+ }
+
+
+
+ // TODO: Allow for configurable message headers.
+
+ try
+ {
+
+ MimeMessage message = javaMailSender.createMimeMessage();
+
+ message.setSubject( subject );
+ message.setText( content );
+
+ InternetAddress from = new InternetAddress( fromAddress, fromName );
+
+ message.setFrom( from );
+
+ List<Address> tos = new ArrayList<Address>();
+
+ for ( String mailbox : recipients )
+ {
+ InternetAddress to = new InternetAddress( mailbox.trim() );
+
+ tos.add( to );
+ }
+
+ message.setRecipients(Message.RecipientType.TO, tos.toArray(new Address[tos.size()]));
+
+ log.debug("mail content {}", content );
+
+ javaMailSender.send( message );
+ }
+ catch ( AddressException e )
+ {
+ log.error( "Unable to send message, subject [" + subject + "]", e );
+ }
+ catch ( MessagingException e )
+ {
+ log.error( "Unable to send message, subject [" + subject + "]", e );
+ }
+ catch ( UnsupportedEncodingException e )
+ {
+ log.error( "Unable to send message, subject [" + subject + "]", e );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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.keys.AuthenticationKey;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.archiva.redback.configuration.UserConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+/**
+ * Mail generator component implementation using velocity.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+@Service( "mailGenerator#velocity" )
+public class VelocityMailGenerator
+ implements MailGenerator
+{
+ private Logger log = LoggerFactory.getLogger( VelocityMailGenerator.class );
+
+ @Inject
+ @Named( value = "userConfiguration" )
+ private UserConfiguration config;
+
+ // FIXME use the spring directly
+ @Inject
+ @Named( value = "velocityEngine#redback" )
+ private VelocityEngine velocityEngine;
+
+ public String generateMail( String templateName, AuthenticationKey authkey, String baseUrl )
+ {
+ VelocityContext context = createVelocityContext( authkey, baseUrl );
+
+ String packageName = getClass().getPackage().getName().replace( '.', '/' );
+ String templateFile = packageName + "/template/" + templateName + ".vm";
+
+ StringWriter writer = new StringWriter();
+
+ try
+ {
+ velocityEngine.mergeTemplate( templateFile, context, writer );
+ }
+ catch ( ResourceNotFoundException e )
+ {
+ log.error( "No such template: '{}'.", templateFile );
+ }
+ catch ( ParseErrorException e )
+ {
+ log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+ }
+ catch ( MethodInvocationException e )
+ {
+ log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+ }
+ catch ( Exception e )
+ {
+ log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+ }
+
+ return writer.getBuffer().toString();
+ }
+
+ private VelocityContext createVelocityContext( AuthenticationKey authkey, String appUrl )
+ {
+ VelocityContext context = new VelocityContext();
+
+ context.put( "applicationUrl", config.getString( "application.url", appUrl ) );
+
+ String feedback = config.getString( "email.feedback.path" );
+
+ if ( feedback != null )
+ {
+ if ( feedback.startsWith( "/" ) )
+ {
+ feedback = appUrl + feedback;
+ }
+
+ context.put( "feedback", feedback );
+ }
+
+ context.put( "urlPath", config.getString( "email.url.path", "security/login!login.action" ) );
+
+ context.put( "authkey", authkey.getKey() );
+
+ context.put( "accountId", authkey.getForPrincipal() );
+
+ SimpleDateFormat dateformatter = new SimpleDateFormat( config.getString( "application.timestamp" ), Locale.US );
+
+ context.put( "requestedOn", dateformatter.format( authkey.getDateCreated() ) );
+
+ if ( authkey.getDateExpires() != null )
+ {
+ context.put( "expiresOn", dateformatter.format( authkey.getDateExpires() ) );
+ }
+ else
+ {
+ context.put( "expiresOn", "(does not expire)" );
+ }
+ return context;
+ }
+
+
+ public UserConfiguration getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig( UserConfiguration config )
+ {
+ this.config = config;
+ }
+
+ public VelocityEngine getVelocityEngine()
+ {
+ return velocityEngine;
+ }
+
+ public void setVelocityEngine( VelocityEngine velocityEngine )
+ {
+ this.velocityEngine = velocityEngine;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.users.User;
+
+/**
+ * AdminEditUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AdminEditUserCredentials
+ extends EditUserCredentials
+{
+ private boolean locked;
+
+ private boolean passwordChangeRequired;
+
+ public AdminEditUserCredentials()
+ {
+ super();
+ }
+
+ public AdminEditUserCredentials( User user )
+ {
+ super( user );
+ this.locked = user.isLocked();
+ this.passwordChangeRequired = user.isPasswordChangeRequired();
+ }
+
+ public boolean isLocked()
+ {
+ return locked;
+ }
+
+ public void setLocked( boolean locked )
+ {
+ this.locked = locked;
+ }
+
+ public boolean isPasswordChangeRequired()
+ {
+ return passwordChangeRequired;
+ }
+
+ public void setPasswordChangeRequired( boolean passwordChangeRequired )
+ {
+ this.passwordChangeRequired = passwordChangeRequired;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.
+ */
+
+/**
+ * CreateRoleDetails
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CreateRoleDetails
+ extends RoleDetails
+{
+ public CreateRoleDetails()
+ {
+ super();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.
+ */
+
+/**
+ * CreateUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CreateUserCredentials
+ extends UserCredentials
+{
+ public CreateUserCredentials()
+ {
+ super();
+ }
+
+ public boolean isEdit()
+ {
+ return false;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.rbac.Permission;
+import org.apache.archiva.redback.rbac.Role;
+
+/**
+ * EditRoleDetails - Existing user Role Details.
+ * <p/>
+ * This is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class EditRoleDetails
+ extends RoleDetails
+{
+ public EditRoleDetails( Role role )
+ {
+ super.setName( role.getName() );
+ super.setDescription( role.getDescription() );
+
+ for ( String r : role.getChildRoleNames() )
+ {
+ super.addChildRoleName( r );
+ }
+
+ for ( Permission perm : role.getPermissions() )
+ {
+ super.addPermission( perm.getName(), perm.getOperation().getName(), perm.getResource().getIdentifier() );
+ }
+ }
+
+ public void setName( String name )
+ {
+ // Prevent Change (This is an edit after all)
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.users.User;
+import org.apache.archiva.redback.integration.util.DateUtils;
+
+/**
+ * EditUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class EditUserCredentials
+ extends UserCredentials
+{
+ public EditUserCredentials()
+ {
+ super();
+ }
+
+ public EditUserCredentials( String username )
+ {
+ super();
+ super.setUsername( username );
+ }
+
+ public EditUserCredentials( User user )
+ {
+ super();
+ super.setUsername( user.getUsername() );
+ super.setFullName( user.getFullName() );
+ super.setEmail( user.getEmail() );
+ super.setPassword( "" );
+ super.setConfirmPassword( "" );
+
+ super.setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
+ super.setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
+ super.setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
+ }
+
+ public boolean isEdit()
+ {
+ return true;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+/**
+ * RoleDetails - this is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class RoleDetails
+{
+ private String name;
+
+ private String description;
+
+ private boolean assignable;
+
+ private List<String> childRoleNames = new ArrayList<String>();
+
+ private List<SimplePermission> permissions = new ArrayList<SimplePermission>();
+
+ public void addChildRoleName( String name )
+ {
+ childRoleNames.add( name );
+ }
+
+ public void addPermission( String permissionName, String operationName, String resourceIdentifier )
+ {
+ SimplePermission permission = new SimplePermission();
+ permission.setName( permissionName );
+ permission.setOperationName( operationName );
+ permission.setResourceIdentifier( resourceIdentifier );
+
+ permissions.add( permission );
+ }
+
+ public List<String> getChildRoleNames()
+ {
+ return childRoleNames;
+ }
+
+ public boolean isAssignable()
+ {
+ return assignable;
+ }
+
+ public void setAssignable( boolean assignable )
+ {
+ this.assignable = assignable;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public List<SimplePermission> getPermissions()
+ {
+ return permissions;
+ }
+
+ public void setPermissions( List<SimplePermission> permissions )
+ {
+ this.permissions = permissions;
+ }
+
+ public void setChildRoleNames( List<String> childRoleNames )
+ {
+ this.childRoleNames = childRoleNames;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.
+ */
+
+/**
+ * SimplePermission - this is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SimplePermission
+{
+ private String name;
+
+ private String operationName;
+
+ private String resourceIdentifier;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getOperationName()
+ {
+ return operationName;
+ }
+
+ public void setOperationName( String operationName )
+ {
+ this.operationName = operationName;
+ }
+
+ public String getResourceIdentifier()
+ {
+ return resourceIdentifier;
+ }
+
+ public void setResourceIdentifier( String resourceIdentifier )
+ {
+ this.resourceIdentifier = resourceIdentifier;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.model;
+
+/*
+ * 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.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * UserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class UserCredentials
+ implements Serializable
+{
+ // Potentially Editable Field.
+ private String username;
+
+ // Editable Fields.
+ private String password;
+
+ private String confirmPassword;
+
+ private String fullName;
+
+ private String email;
+
+ // Display Only Fields.
+ private String timestampAccountCreation;
+
+ private String timestampLastLogin;
+
+ private String timestampLastPasswordChange;
+
+ public User createUser( UserManager um )
+ {
+ User user = um.createUser( username, fullName, email );
+
+ user.setPassword( password );
+
+ return user;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append( "UserCredentials[" );
+ sb.append( "username=" ).append( username );
+ sb.append( ",fullName=" ).append( fullName );
+ sb.append( ",email=" ).append( email );
+ sb.append( ",password=" );
+ if ( StringUtils.isNotEmpty( password ) )
+ {
+ sb.append( "<***>" );
+ }
+ else
+ {
+ sb.append( "<empty>" );
+ }
+ sb.append( ",confirmPassword=" );
+ if ( StringUtils.isNotEmpty( confirmPassword ) )
+ {
+ sb.append( "<***>" );
+ }
+ else
+ {
+ sb.append( "<empty>" );
+ }
+
+ return sb.append( "]" ).toString();
+ }
+
+ public String getConfirmPassword()
+ {
+ return confirmPassword;
+ }
+
+ public void setConfirmPassword( String confirmPassword )
+ {
+ this.confirmPassword = confirmPassword;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail( String email )
+ {
+ this.email = email;
+ }
+
+ public String getFullName()
+ {
+ return fullName;
+ }
+
+ public void setFullName( String fullName )
+ {
+ this.fullName = fullName;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword( String password )
+ {
+ this.password = password;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername( String username )
+ {
+ this.username = username;
+ }
+
+ public abstract boolean isEdit();
+
+ public String getTimestampAccountCreation()
+ {
+ return timestampAccountCreation;
+ }
+
+ public String getTimestampLastLogin()
+ {
+ return timestampLastLogin;
+ }
+
+ public String getTimestampLastPasswordChange()
+ {
+ return timestampLastPasswordChange;
+ }
+
+ public void setTimestampAccountCreation( String timestampAccountCreation )
+ {
+ this.timestampAccountCreation = timestampAccountCreation;
+ }
+
+ public void setTimestampLastLogin( String timestampLastLogin )
+ {
+ this.timestampLastLogin = timestampLastLogin;
+ }
+
+ public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
+ {
+ this.timestampLastPasswordChange = timestampLastPasswordChange;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.reports;
+
+/*
+ * 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.rbac.RBACManager;
+import org.apache.archiva.redback.rbac.RbacManagerException;
+import org.apache.archiva.redback.rbac.Role;
+import org.apache.archiva.redback.rbac.UserAssignment;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.integration.util.RoleSorter;
+import org.apache.archiva.redback.integration.util.UserComparator;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CsvRolesMatrix
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "report#rolesmatrix-csv" )
+public class CsvRolesMatrix
+ implements Report
+{
+ @Inject
+ private SecuritySystem securitySystem;
+
+ @Inject
+ @Named( value = "rBACManager#jdo" )
+ private RBACManager rbacManager;
+
+ public String getName()
+ {
+ return "Roles Matrix";
+ }
+
+ public String getType()
+ {
+ return "csv";
+ }
+
+ public void writeReport( OutputStream os )
+ throws ReportException
+ {
+ UserManager userManager = securitySystem.getUserManager();
+
+ List<User> allUsers = userManager.getUsers();
+ List<Role> allRoles;
+ Map<String, List<String>> assignmentsMap;
+
+ try
+ {
+ allRoles = rbacManager.getAllRoles();
+ Collections.sort( allRoles, new RoleSorter() );
+
+ assignmentsMap = new HashMap<String, List<String>>();
+
+ for ( UserAssignment assignment : rbacManager.getAllUserAssignments() )
+ {
+ assignmentsMap.put( assignment.getPrincipal(), assignment.getRoleNames() );
+ }
+ }
+ catch ( RbacManagerException e )
+ {
+ throw new ReportException( "Unable to obtain list of all roles.", e );
+ }
+
+ Collections.sort( allUsers, new UserComparator( "username", true ) );
+
+ PrintWriter out = new PrintWriter( os );
+
+ writeCsvHeader( out, allRoles );
+
+ for ( User user : allUsers )
+ {
+ writeCsvRow( out, user, assignmentsMap, allRoles );
+ }
+
+ out.flush();
+ }
+
+ private void writeCsvHeader( PrintWriter out, List<Role> allRoles )
+ {
+ out.print( "Username,Full Name,Email Address" );
+ for ( Role role : allRoles )
+ {
+ out.print( "," + escapeCell( role.getName() ) );
+ }
+ out.println();
+ }
+
+ private void writeCsvRow( PrintWriter out, User user, Map<String, List<String>> assignmentsMap,
+ List<Role> allRoles )
+ {
+ out.print( escapeCell( user.getUsername() ) );
+ out.print( "," + escapeCell( user.getFullName() ) );
+ out.print( "," + escapeCell( user.getEmail() ) );
+
+ List<String> assignedRoleNames = assignmentsMap.get( user.getPrincipal().toString() );
+ if ( assignedRoleNames == null )
+ {
+ assignedRoleNames = new ArrayList<String>();
+ }
+
+ for ( Role role : allRoles )
+ {
+ out.print( ',' );
+ if ( assignedRoleNames.contains( role.getName() ) )
+ {
+ out.print( 'Y' );
+ }
+ }
+ out.println();
+ }
+
+ private String escapeCell( String cell )
+ {
+ return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
+ }
+
+ public String getId()
+ {
+ return "rolesmatrix";
+ }
+
+ public String getMimeType()
+ {
+ return "text/csv";
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.reports;
+
+/*
+ * 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.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.integration.util.UserComparator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CsvUserList
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "report#userlist-csv" )
+public class CsvUserList
+ implements Report
+{
+ private Logger log = LoggerFactory.getLogger( CsvUserList.class );
+
+ @Inject
+ private SecuritySystem securitySystem;
+
+ private Map<String, String> fields;
+
+ public CsvUserList()
+ {
+ fields = new HashMap<String, String>();
+ fields.put( "username", "User Name" );
+ fields.put( "fullName", "Full Name" );
+ fields.put( "email", "Email Address" );
+ fields.put( "permanent", "Permanent User" );
+ fields.put( "locked", "Locked User" );
+ fields.put( "validated", "Validated User" );
+ fields.put( "passwordChangeRequired", "Must Change Password On Next Login" );
+ fields.put( "countFailedLoginAttempts", "Failed Login Attempts" );
+ fields.put( "lastPasswordChange", "Last Password Change" );
+ fields.put( "accountCreationDate", "Date Created" );
+ fields.put( "lastLoginDate", "Date Last Logged In" );
+ }
+
+ public String getId()
+ {
+ return "userlist";
+ }
+
+ public String getMimeType()
+ {
+ return "text/csv";
+ }
+
+ public String getName()
+ {
+ return "User List";
+ }
+
+ public String getType()
+ {
+ return "csv";
+ }
+
+ public void writeReport( OutputStream os )
+ throws ReportException
+ {
+ UserManager userManager = securitySystem.getUserManager();
+
+ List<User> allUsers = userManager.getUsers();
+
+ Collections.sort( allUsers, new UserComparator( "username", true ) );
+
+ PrintWriter out = new PrintWriter( os );
+
+ writeCsvHeader( out );
+
+ Iterator<User> itUsers = allUsers.iterator();
+ while ( itUsers.hasNext() )
+ {
+ User user = (User) itUsers.next();
+ writeCsvRow( out, user );
+ }
+
+ out.flush();
+ }
+
+ private void writeCsvHeader( PrintWriter out )
+ {
+ boolean hasPreviousField = false;
+ for ( String heading : fields.values() )
+ {
+ if ( hasPreviousField )
+ {
+ out.print( "," );
+ }
+ out.print( escapeCell( heading ) );
+ hasPreviousField = true;
+ }
+ out.println();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ private void writeCsvRow( PrintWriter out, User user )
+ throws ReportException
+ {
+ try
+ {
+ boolean hasPreviousField = false;
+ Map<String, Object> propMap = PropertyUtils.describe( user );
+ for ( String propName : fields.keySet() )
+ {
+ Object propValue = propMap.get( propName );
+
+ if ( hasPreviousField )
+ {
+ out.print( "," );
+ }
+
+ if ( propValue != null )
+ {
+ out.print( escapeCell( propValue.toString() ) );
+ }
+ hasPreviousField = true;
+ }
+ out.println();
+ }
+ catch ( IllegalAccessException e )
+ {
+ String emsg = "Unable to produce " + getName() + " report.";
+ log.error( emsg, e );
+ throw new ReportException( emsg, e );
+ }
+ catch ( InvocationTargetException e )
+ {
+ String emsg = "Unable to produce " + getName() + " report.";
+ log.error( emsg, e );
+ throw new ReportException( emsg, e );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ String emsg = "Unable to produce " + getName() + " report.";
+ log.error( emsg, e );
+ throw new ReportException( emsg, e );
+ }
+ }
+
+ private String escapeCell( String cell )
+ {
+ return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.reports;
+
+/*
+ * 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.OutputStream;
+
+/**
+ * Report
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface Report
+{
+ /**
+ * The Name of the Report (for display to the user)
+ *
+ * @return the name of the report.
+ */
+ String getName();
+
+ /**
+ * The type of report (example: 'csv', 'xls', 'pdf')
+ * Used in the display of the report links to the user.
+ *
+ * @return the type of report.
+ */
+ String getType();
+
+ /**
+ * The mimetype of the report. (used to set download content type correctly)
+ *
+ * @return the mimetype.
+ */
+ String getMimeType();
+
+ /**
+ * The ID for this report.
+ *
+ * @return the ID for this report.
+ */
+ String getId();
+
+ /**
+ * Write Report to provided outputstream.
+ *
+ * @param os the outputstream to write to.
+ * @throws ReportException if there was a problem in generating the report.
+ */
+ void writeReport( OutputStream os )
+ throws ReportException;
+}
--- /dev/null
+package org.apache.archiva.redback.integration.reports;
+
+/*
+ * 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.
+ */
+
+/**
+ * ReportException
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ReportException
+ extends Exception
+{
+
+ public ReportException()
+ {
+ super();
+ }
+
+ public ReportException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public ReportException( String message )
+ {
+ super( message );
+ }
+
+ public ReportException( Throwable cause )
+ {
+ super( cause );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.reports;
+
+/*
+ * 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.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ReportManager
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "reportManager" )
+public class ReportManager
+{
+
+ @Inject
+ private List<Report> availableReports;
+
+ @Inject
+ private ApplicationContext applicationContext;
+
+ private Map<String, Map<String, Report>> reportMap;
+
+ public Report findReport( String id, String type )
+ throws ReportException
+ {
+ if ( StringUtils.isBlank( id ) )
+ {
+ throw new ReportException( "Unable to generate report from empty report id." );
+ }
+
+ if ( StringUtils.isBlank( type ) )
+ {
+ throw new ReportException( "Unable to generate report from empty report type." );
+ }
+
+ Map<String, Report> typeMap = reportMap.get( id );
+ if ( typeMap == null )
+ {
+ throw new ReportException( "Unable to find report id [" + id + "]" );
+ }
+
+ Report requestedReport = typeMap.get( type );
+
+ if ( requestedReport == null )
+ {
+ throw new ReportException( "Unable to find report id [" + id + "] type [" + type + "]" );
+ }
+
+ return requestedReport;
+ }
+
+ public Map<String, Map<String, Report>> getReportMap()
+ {
+ return Collections.unmodifiableMap( reportMap );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ @PostConstruct
+ public void initialize()
+ {
+ reportMap = new HashMap<String, Map<String, Report>>();
+
+ for ( Report report : availableReports )
+ {
+ Map<String, Report> typeMap = reportMap.get( report.getId() );
+ if ( typeMap == null )
+ {
+ typeMap = new HashMap<String, Report>();
+ }
+
+ typeMap.put( report.getType(), report );
+ reportMap.put( report.getId(), typeMap );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.role;
+
+/*
+ * 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.integration.security.role.RedbackRoleConstants;
+
+/**
+ * RoleConstants:
+ *
+ * @author: Jesse McConnell <jesse@codehaus.org>
+ * @version: $Id$
+ * @deprecated use {@link RedbackRoleConstants}
+ */
+public class RoleConstants
+{
+ public static final String ADMINISTRATOR_ACCOUNT_NAME = RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME;
+
+ // roles
+ public static final String SYSTEM_ADMINISTRATOR_ROLE = RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE;
+
+ public static final String USER_ADMINISTRATOR_ROLE = RedbackRoleConstants.USER_ADMINISTRATOR_ROLE;
+
+ public static final String REGISTERED_USER_ROLE = RedbackRoleConstants.REGISTERED_USER_ROLE;
+
+ public static final String GUEST_ROLE = RedbackRoleConstants.GUEST_ROLE;
+
+ // guest access operation
+ public static final String GUEST_ACCESS_OPERATION = RedbackRoleConstants.GUEST_ACCESS_OPERATION;
+
+ // operations against configuration
+ public static final String CONFIGURATION_EDIT_OPERATION = RedbackRoleConstants.CONFIGURATION_EDIT_OPERATION;
+
+ // operations against user
+ public static final String USER_MANAGEMENT_USER_CREATE_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION;
+
+ public static final String USER_MANAGEMENT_USER_EDIT_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION;
+
+ public static final String USER_MANAGEMENT_USER_ROLE_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION;
+
+ public static final String USER_MANAGEMENT_USER_DELETE_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION;
+
+ public static final String USER_MANAGEMENT_USER_LIST_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION;
+
+ // operations against user assignment.
+ public static final String USER_MANAGEMENT_ROLE_GRANT_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION;
+
+ public static final String USER_MANAGEMENT_ROLE_DROP_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION;
+
+ // operations against rbac objects.
+ public static final String USER_MANAGEMENT_RBAC_ADMIN_OPERATION =
+ RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION;
+
+ public static final String USER_MANAGEMENT_MANAGE_DATA = RedbackRoleConstants.USER_MANAGEMENT_MANAGE_DATA;
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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 javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IfAuthorizedTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class ElseAuthorizedTag
+ extends ConditionalTagSupport
+{
+ protected boolean condition()
+ throws JspTagException
+ {
+ Boolean authzStatus = (Boolean) pageContext.getAttribute( "ifAuthorizedTag" );
+
+ if ( authzStatus != null )
+ {
+ pageContext.removeAttribute( "ifAuthorizedTag" );
+
+ return !authzStatus.booleanValue();
+ }
+
+ authzStatus = (Boolean) pageContext.getAttribute( "ifAnyAuthorizedTag" );
+
+ if ( authzStatus != null )
+ {
+ pageContext.removeAttribute( "ifAnyAuthorizedTag" );
+
+ return !authzStatus.booleanValue();
+ }
+
+ throw new JspTagException( "ElseAuthorizedTag should follow either IfAuthorized or IfAnyAuthorized" );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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.authorization.AuthorizationException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+import java.util.StringTokenizer;
+
+/**
+ * IfAnyAuthorizedTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class IfAnyAuthorizedTag
+ extends ConditionalTagSupport
+{
+ /**
+ * comma delimited list of permissions to check
+ */
+ private String permissions;
+
+ private String resource;
+
+ public void setPermissions( String permissions )
+ {
+ this.permissions = permissions;
+ }
+
+ public void setResource( String resource )
+ {
+ this.resource = resource;
+ }
+
+ protected boolean condition()
+ throws JspTagException
+ {
+ ApplicationContext applicationContext =
+ WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
+
+ SecuritySession securitySession =
+ (SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
+
+ try
+ {
+ final SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
+ if ( securitySystem == null )
+ {
+ throw new JspTagException( "unable to locate the security system" );
+ }
+
+ StringTokenizer strtok = new StringTokenizer( permissions, "," );
+
+ while ( strtok.hasMoreTokens() )
+ {
+ String permission = strtok.nextToken().trim();
+
+ if ( securitySystem.isAuthorized( securitySession, permission, resource ) )
+ {
+ return true;
+ }
+ }
+ }
+ catch ( AuthorizationException ae )
+ {
+ throw new JspTagException( "error with authorization", ae );
+ }
+
+ return false;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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.authorization.AuthorizationException;
+import org.apache.archiva.redback.system.SecuritySession;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.apache.archiva.redback.system.SecuritySystemConstants;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IfAuthorizedTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class IfAuthorizedTag
+ extends ConditionalTagSupport
+{
+ private String permission;
+
+ private String resource;
+
+ public void setPermission( String permission )
+ {
+ this.permission = permission;
+ }
+
+ public void setResource( String resource )
+ {
+ this.resource = resource;
+ }
+
+ protected boolean condition()
+ throws JspTagException
+ {
+ ApplicationContext applicationContext =
+ WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
+
+ Boolean authzStatusBool = (Boolean) pageContext.getAttribute( "redbackCache" + permission + resource );
+ boolean authzStatus;
+
+ //long execTime = System.currentTimeMillis();
+
+ if ( authzStatusBool == null )
+ {
+ SecuritySession securitySession =
+ (SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
+
+ try
+ {
+ SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
+ if ( securitySystem == null )
+ {
+ throw new JspTagException( "unable to locate security system" );
+ }
+
+ authzStatus = securitySystem.isAuthorized( securitySession, permission, resource );
+ pageContext.setAttribute( "redbackCache" + permission + resource, Boolean.valueOf( authzStatus ) );
+ }
+ catch ( AuthorizationException ae )
+ {
+ throw new JspTagException( "error with authorization", ae );
+ }
+
+ //System.out.println( "[PERF] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
+ }
+ else
+ {
+ authzStatus = authzStatusBool.booleanValue();
+ //System.out.println( "[PERF][Cached] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
+ }
+
+ pageContext.setAttribute( "ifAuthorizedTag", Boolean.valueOf( authzStatus ) );
+ return authzStatus;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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.configuration.UserConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IfConfiguredTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class IfConfiguredTag
+ extends ConditionalTagSupport
+{
+ private String option;
+
+ private String value;
+
+ public void setOption( String option )
+ {
+ this.option = option;
+ }
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ protected boolean condition()
+ throws JspTagException
+ {
+ ApplicationContext applicationContext =
+ WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
+
+ UserConfiguration config = applicationContext.getBean( "userConfiguration", UserConfiguration.class );
+
+ if ( value != null )
+ {
+ String configValue = config.getString( option );
+
+ if ( value.equals( configValue ) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return config.getBoolean( option );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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.users.UserManager;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IsReadOnlyUserManagerTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class IsNotReadOnlyUserManagerTag
+ extends ConditionalTagSupport
+{
+ protected boolean condition()
+ throws JspTagException
+ {
+ ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
+
+ UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
+ if (config == null)
+ {
+ throw new JspTagException( "unable to locate security system" );
+ }
+
+ return !config.isReadOnly();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.taglib.jsp;
+
+/*
+ * 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.users.UserManager;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IsReadOnlyUserManagerTag:
+ *
+ * @author Jesse McConnell <jesse@codehaus.org>
+ * @version $Id$
+ */
+public class IsReadOnlyUserManagerTag
+ extends ConditionalTagSupport
+{
+ protected boolean condition()
+ throws JspTagException
+ {
+ ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
+ UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
+ if (config == null)
+ {
+ throw new JspTagException( "unable to locate security system" );
+ }
+
+ return config.isReadOnly();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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 javax.annotation.Resource;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.archiva.redback.keys.AuthenticationKey;
+import org.apache.archiva.redback.keys.KeyManager;
+import org.apache.archiva.redback.keys.KeyManagerException;
+import org.apache.archiva.redback.keys.KeyNotFoundException;
+import org.apache.archiva.redback.policy.CookieSettings;
+import org.apache.archiva.redback.system.SecuritySystem;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * AutoLoginCookies
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("autoLoginCookies")
+public class AutoLoginCookies
+{
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Resource
+ private SecuritySystem securitySystem;
+
+ /**
+ * Cookie key for the Remember Me functionality.
+ */
+ private static final String REMEMBER_ME_KEY = "rbkRememberMe";
+
+ /**
+ * Cookie key for the signon cookie.
+ */
+ private static final String SIGNON_KEY = "rbkSignon";
+
+ public AuthenticationKey getRememberMeKey(HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ if ( !isRememberMeEnabled() )
+ {
+ return null;
+ }
+
+ Cookie rememberMeCookie = getCookie( httpServletRequest, REMEMBER_ME_KEY );
+
+ if ( rememberMeCookie == null )
+ {
+ log.debug( "Remember Me Cookie Not Found: {}", REMEMBER_ME_KEY );
+ return null;
+ }
+
+ // Found user with a remember me key.
+ String providedKey = rememberMeCookie.getValue();
+
+ log.debug( "Found remember me cookie : {}", providedKey );
+
+ CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
+ return findAuthKey( REMEMBER_ME_KEY, providedKey, settings.getDomain(), settings.getPath(), httpServletResponse, httpServletRequest );
+ }
+
+ public void setRememberMeCookie( String principal, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ if ( !isRememberMeEnabled() )
+ {
+ return;
+ }
+
+ try
+ {
+ CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
+ int timeout = settings.getCookieTimeout();
+ KeyManager keyManager = securitySystem.getKeyManager();
+ AuthenticationKey authkey = keyManager.createKey( principal, "Remember Me Key", timeout );
+
+ Cookie cookie = createCookie( REMEMBER_ME_KEY, authkey.getKey(), settings.getDomain(), settings.getPath(), httpServletRequest );
+ if ( timeout > 0 )
+ {
+ cookie.setMaxAge( timeout );
+ }
+ httpServletResponse.addCookie( cookie );
+
+ }
+ catch ( KeyManagerException e )
+ {
+ log.warn( "Unable to set remember me cookie." );
+ }
+ }
+
+ public void removeRememberMeCookie( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
+ removeCookie( httpServletResponse, httpServletRequest, REMEMBER_ME_KEY, settings.getDomain(), settings.getPath() );
+ }
+
+ public AuthenticationKey getSignonKey( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ Cookie ssoCookie = getCookie( httpServletRequest, SIGNON_KEY );
+
+ if ( ssoCookie == null )
+ {
+ log.debug( "Single Sign On Cookie Not Found: {}", SIGNON_KEY );
+ return null;
+ }
+
+ // Found user with a single sign on key.
+
+ String providedKey = ssoCookie.getValue();
+
+ log.debug( "Found sso cookie : {}", providedKey );
+
+ CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
+ return findAuthKey( SIGNON_KEY, providedKey, settings.getDomain(), settings.getPath(), httpServletResponse, httpServletRequest );
+ }
+
+ public void setSignonCookie( String principal, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ try
+ {
+ CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
+ int timeout = settings.getCookieTimeout();
+ KeyManager keyManager = securitySystem.getKeyManager();
+ AuthenticationKey authkey = keyManager.createKey( principal, "Signon Session Key", timeout );
+
+ /* The path must remain as "/" in order for SSO to work on installations where the only
+ * all of the servers are installed into the same web container but under different
+ * web contexts.
+ */
+ Cookie cookie = createCookie( SIGNON_KEY, authkey.getKey(), settings.getDomain(), settings.getPath(), httpServletRequest );
+ if ( timeout > 0 )
+ {
+ cookie.setMaxAge( timeout );
+ }
+ httpServletResponse.addCookie( cookie );
+
+ }
+ catch ( KeyManagerException e )
+ {
+ log.warn( "Unable to set single sign on cookie." );
+
+ }
+ }
+
+ public void removeSignonCookie( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
+ removeCookie( httpServletResponse, httpServletRequest, SIGNON_KEY, settings.getDomain(), settings.getPath() );
+ }
+
+ private static String getWebappContext( HttpServletRequest httpRequest )
+ {
+ // Calculate the webapp context.
+ String webappContext = httpRequest.getContextPath();
+
+ if ( StringUtils.isEmpty( webappContext ) )
+ {
+ // Still empty? means you are a root context.
+ webappContext = "/";
+ }
+
+ return webappContext;
+ }
+
+ public boolean isRememberMeEnabled()
+ {
+ return securitySystem.getPolicy().getRememberMeCookieSettings().isEnabled();
+ }
+
+ private AuthenticationKey findAuthKey( String cookieName, String providedKey, String domain, String path,
+ HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
+ {
+ try
+ {
+ AuthenticationKey authkey = securitySystem.getKeyManager().findKey( providedKey );
+
+ log.debug( "Found AuthKey: {}", authkey );
+
+ return authkey;
+ }
+ catch ( KeyNotFoundException e )
+ {
+ log.info( "Invalid AuthenticationKey {} submitted. Invalidating cookie.", providedKey );
+
+ // Invalid Cookie. Remove it.
+ removeCookie( httpServletResponse, httpServletRequest, cookieName, domain, path );
+ }
+ catch ( KeyManagerException e )
+ {
+ log.error( "KeyManagerException: " + e.getMessage(), e );
+ }
+
+ return null;
+ }
+
+ private static Cookie getCookie( HttpServletRequest request, String name )
+ {
+ Cookie[] cookies = request.getCookies();
+
+ Cookie cookie = null;
+ if ( cookies != null && !StringUtils.isEmpty( name ) )
+ {
+ for ( int i = 0; i < cookies.length && cookie == null; i++ )
+ {
+ if ( StringUtils.equals( name, cookies[i].getName() ) )
+ {
+ cookie = cookies[i];
+ }
+ }
+ }
+
+ return cookie;
+ }
+
+ private static void removeCookie( HttpServletResponse response, HttpServletRequest httpRequest, String cookieName, String domain, String path )
+ {
+ Cookie cookie = createCookie( cookieName, "", domain, path, httpRequest );
+ cookie.setMaxAge( 0 );
+ response.addCookie( cookie );
+ }
+
+ private static Cookie createCookie( String cookieName, String value, String domain, String path, HttpServletRequest httpRequest )
+ {
+ Cookie cookie = new Cookie( cookieName, value );
+ if ( domain != null )
+ {
+ cookie.setDomain( domain );
+ }
+ if ( path != null )
+ {
+ cookie.setPath( path );
+ }
+ else
+ {
+ // default to the context path, otherwise you get /security and such in some places
+ cookie.setPath( getWebappContext( httpRequest ) );
+ }
+ return cookie;
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * DateUtils
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class DateUtils
+{
+ /**
+ * Provided a date you will get a timestamp and the age/old that you want
+ *
+ * @param date the date to compare to now.
+ * @param suffix the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
+ * @return the formated string.
+ */
+ public static String formatWithAge( Date date, String suffix )
+ {
+ return formatWithAge( date, "EEE, d MMM yyyy HH:mm:ss Z", suffix );
+ }
+
+ /**
+ * Provided a date you will get a timestamp and the age/old that you want.
+ *
+ * @param date the date to compare to now.
+ * @param dateFormat the {@link SimpleDateFormat} format string to use for the date.
+ * @param suffix the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
+ * @return the formated string.
+ */
+ public static String formatWithAge( Date date, String dateFormat, String suffix )
+ {
+ if ( date == null )
+ {
+ return null;
+ }
+
+ SimpleDateFormat format = new SimpleDateFormat( dateFormat );
+
+ StringBuffer out = new StringBuffer();
+ out.append( format.format( date ) );
+ out.append( " - " );
+
+ Calendar now = Calendar.getInstance();
+ Calendar then = Calendar.getInstance();
+ then.setTime( date );
+
+ long diffMillis = now.getTimeInMillis() - then.getTimeInMillis();
+
+ long days = diffMillis / ( 24 * 60 * 60 * 1000 );
+ long hours = diffMillis / ( 60 * 60 * 1000 );
+ long minutes = diffMillis / ( 60 * 1000 );
+ long seconds = diffMillis / ( 1000 );
+
+ if ( days > 0 )
+ {
+ out.append( String.valueOf( days ) ).append( " day" );
+ if ( days > 1 )
+ {
+ out.append( 's' );
+ }
+ }
+ else if ( hours > 0 )
+ {
+ out.append( String.valueOf( hours ) ).append( " hour" );
+ if ( hours > 1 )
+ {
+ out.append( 's' );
+ }
+ }
+ else if ( minutes > 0 )
+ {
+ out.append( String.valueOf( minutes ) ).append( " minute" );
+ if ( minutes > 1 )
+ {
+ out.append( 's' );
+ }
+ }
+ else if ( seconds > 0 )
+ {
+ out.append( String.valueOf( seconds ) ).append( " second" );
+ if ( seconds > 1 )
+ {
+ out.append( 's' );
+ }
+ }
+
+ out.append( ' ' ).append( suffix );
+
+ return out.toString();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.codehaus.plexus.redback.role.model.ModelTemplate;
+
+/**
+ * ModelTemplateSorter
+ *
+ * @author <a href="mailto:hisidro@exist.com">Henry Isidro</a>
+ * @version $Id$
+ */
+public class ModelTemplateSorter
+ implements Comparator<ModelTemplate>
+{
+ public int compare( ModelTemplate template1, ModelTemplate template2 )
+ {
+ if ( ( template1 == null ) && ( template2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( template1 == null ) && ( template2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( template1 != null ) && ( template2 == null ) )
+ {
+ return 1;
+ }
+
+ return template1.getNamePrefix().compareToIgnoreCase( template2.getNamePrefix() );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.rbac.Operation;
+
+/**
+ * OperationSorter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class OperationSorter
+ implements Comparator<Operation>
+{
+
+ public int compare( Operation o1, Operation o2 )
+ {
+ if ( ( o1 == null ) && ( o2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( o1 == null ) && ( o2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( o1 != null ) && ( o2 == null ) )
+ {
+ return 1;
+ }
+
+ return o1.getName().compareToIgnoreCase( o2.getName() );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.rbac.Permission;
+
+/**
+ * PermissionSorter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class PermissionSorter
+ implements Comparator<Permission>
+{
+
+ public int compare( Permission p1, Permission p2 )
+ {
+ if ( ( p1 == null ) && ( p2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( p1 == null ) && ( p2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( p1 != null ) && ( p2 == null ) )
+ {
+ return 1;
+ }
+
+ return p1.getName().compareToIgnoreCase( p2.getName() );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.rbac.Resource;
+
+/**
+ * ResourceSorter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ResourceSorter
+ implements Comparator<Resource>
+{
+
+ public int compare( Resource r1, Resource r2 )
+ {
+ if ( ( r1 == null ) && ( r2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( r1 == null ) && ( r2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( r1 != null ) && ( r2 == null ) )
+ {
+ return 1;
+ }
+
+ return r1.getIdentifier().compareToIgnoreCase( r2.getIdentifier() );
+ }
+
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.rbac.Role;
+
+/**
+ * RoleSorter
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RoleSorter
+ implements Comparator<Role>
+{
+ public int compare( Role role1, Role role2 )
+ {
+ if ( ( role1 == null ) && ( role2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( role1 == null ) && ( role2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( role1 != null ) && ( role2 == null ) )
+ {
+ return 1;
+ }
+
+ return role1.getName().compareToIgnoreCase( role2.getName() );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.rbac.TemplatedRole;
+
+/**
+ * TemplatedRoleSorter
+ *
+ * @author <a href="hisidro@exist.com">Henry Isidro</a>
+ * @version $Id$
+ */
+public class TemplatedRoleSorter
+ implements Comparator<TemplatedRole>
+{
+ public int compare( TemplatedRole r1, TemplatedRole r2 )
+ {
+ if ( ( r1 == null ) && ( r2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( r1 == null ) && ( r2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( r1 != null ) && ( r2 == null ) )
+ {
+ return 1;
+ }
+
+ if ( r1.getResource().equals( r2.getResource() ) )
+ {
+ return r1.getTemplateNamePrefix().compareTo( r2.getTemplateNamePrefix() );
+ }
+ else
+ {
+ return r1.getResource().compareToIgnoreCase( r2.getResource() );
+ }
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.util;
+
+/*
+ * 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.util.Comparator;
+
+import org.apache.archiva.redback.users.User;
+
+/**
+ * UserComparator
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class UserComparator
+ implements Comparator<User>
+{
+ private static final int UNKNOWN = -1;
+
+ private static final int USERNAME = 1;
+
+ private static final int FULLNAME = 2;
+
+ private static final int EMAIL = 3;
+
+ private static final int VALIDATED = 4;
+
+ private static final int LOCKED = 5;
+
+ private static final int PERMANENT = 6;
+
+ private int propKey = UNKNOWN;
+
+ private boolean ascending;
+
+ public UserComparator( String property, boolean ascending )
+ {
+ this.ascending = ascending;
+
+ if ( "username".equals( property ) )
+ {
+ propKey = USERNAME;
+ }
+ else if ( "fullName".equals( property ) )
+ {
+ propKey = FULLNAME;
+ }
+ else if ( "email".equals( property ) )
+ {
+ propKey = EMAIL;
+ }
+ else if ( "validated".equals( property ) )
+ {
+ propKey = VALIDATED;
+ }
+ else if ( "locked".equals( property ) )
+ {
+ propKey = LOCKED;
+ }
+ else if ( "permanent".equals( property ) )
+ {
+ propKey = PERMANENT;
+ }
+ }
+
+ public int compare( User user1, User user2 )
+ {
+ if ( ( user1 == null ) && ( user2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( user1 == null ) && ( user2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( user1 != null ) && ( user2 == null ) )
+ {
+ return 1;
+ }
+
+ return compareUsers( user1, user2 ) * ( ascending ? 1 : -1 );
+ }
+
+ private int compareUsers( User u1, User u2 )
+ {
+ switch ( propKey )
+ {
+ case USERNAME:
+ return compareStrings( u1.getUsername(), u2.getUsername() );
+ case FULLNAME:
+ return compareStrings( u1.getFullName(), u2.getFullName() );
+ case EMAIL:
+ return compareStrings( u1.getEmail(), u2.getEmail() );
+ case VALIDATED:
+ return compareBooleans( u1.isValidated(), u2.isValidated() );
+ case LOCKED:
+ return compareBooleans( u1.isLocked(), u2.isLocked() );
+ case PERMANENT:
+ return compareBooleans( u1.isPermanent(), u2.isPermanent() );
+ default:
+ return 0;
+
+ }
+ }
+
+ private int compareStrings( String s1, String s2 )
+ {
+ if ( ( s1 == null ) && ( s2 == null ) )
+ {
+ return 0;
+ }
+
+ if ( ( s1 == null ) && ( s2 != null ) )
+ {
+ return -1;
+ }
+
+ if ( ( s1 != null ) && ( s2 == null ) )
+ {
+ return 1;
+ }
+
+ return s1.toLowerCase().compareTo( s2.toLowerCase() );
+ }
+
+ private int compareBooleans( boolean b1, boolean b2 )
+ {
+ if ( b1 == b2 )
+ {
+ return 0;
+ }
+
+ return ( b1 ) ? 1 : -1;
+ }
+}
+++ /dev/null
-package org.codehaus.redback.integration;
-
-/*
- * 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.util.Properties;
-
-import org.codehaus.plexus.util.StringUtils;
-
-/**
- * Collection of Utility methods useful in an Http environment.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * @todo should move this to plexus-utils or plexus-utils-web
- */
-public class HttpUtils
-{
- /**
- * Convert typical complex header into properties.
- * <p/>
- * <p/>
- * Example:
- * </p>
- * <p/>
- * <code>
- * realm="Somewhere Over The Rainbow", domain="kansas.co.us", nonce="65743ABCF"
- * </code>
- * <p/>
- * <p>becomes</p>
- * <p/>
- * <code>
- * Map ( "realm", "Somewhere Over The Rainbox" )
- * Map ( "domain", "kansas.co.us" )
- * Map ( "nonce", "65743ABCF" )
- * </code>
- *
- * @param rawheader
- * @param majorDelim
- * @param subDelim
- * @return
- */
- public static Properties complexHeaderToProperties( String rawheader, String majorDelim, String subDelim )
- {
- Properties ret = new Properties();
-
- if ( StringUtils.isEmpty( rawheader ) )
- {
- return ret;
- }
-
- String array[] = StringUtils.split( rawheader, majorDelim );
- for ( int i = 0; i < array.length; i++ )
- {
- // String quotes.
- String rawelem = StringUtils.replace( array[i], "\"", "" );
- String parts[] = StringUtils.split( rawelem, subDelim, 2 );
-
- ret.setProperty( StringUtils.trim( parts[0] ), StringUtils.trim( parts[1] ) );
- }
-
- return ret;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks;
-
-/*
- * 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.util.List;
-
-import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.springframework.stereotype.Service;
-
-/**
- * ExpectedJsps
- * @FIXME the jsp list is not correct
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service("environmentCheck#ExpectedJsps")
-public class ExpectedJsps
- implements EnvironmentCheck
-{
- public void validateEnvironment( List<String> violations )
- {
- String redback = "/WEB-INF/jsp/redback";
- String resources[] = new String[]{"/admin/userCreate.jspf", "/admin/userList.jspf", "/admin/userEdit.jspf",
- "/admin/userFind.jspf", "/userCredentials.jspf", "/account.jspf", "/login.jspf", "/passwordChange.jspf",
- "/register.jspf"};
-
- int missingCount = 0;
- String jspPath;
-
- for ( int i = 0; i >= resources.length; i++ )
- {
- jspPath = redback + resources[i];
- if ( !jspExists( jspPath ) )
- {
- violations.add( "Missing JSP " + quote( jspPath ) + "." );
- missingCount++;
- }
- }
-
- if ( missingCount > 0 )
- {
- violations.add( "Missing " + missingCount + " JSP(s)." );
- }
- }
-
- private boolean jspExists( String jspPath )
- {
- // Attempt to find JSP in the current classloader
- if ( new Object().getClass().getResource( jspPath ) == null )
- {
- return false;
- }
-
- return true;
- }
-
- private String quote( Object o )
- {
- if ( o == null )
- {
- return "<null>";
- }
- return "\"" + o.toString() + "\"";
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.security;
-
-/*
- * 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.rbac.RBACManager;
-import org.apache.archiva.redback.role.RoleManagerException;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.commons.lang.StringUtils;
-import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
-import org.apache.archiva.redback.configuration.UserConfiguration;
-import org.apache.archiva.redback.rbac.RbacManagerException;
-import org.apache.archiva.redback.rbac.Role;
-import org.apache.archiva.redback.role.RoleManager;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.plexus.util.IOUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 1.5
- */
-@Service( "AdminAutoCreateCheck" )
-public class AdminAutoCreateCheck
- implements EnvironmentCheck
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- public static final String FORCE_ADMIN_FILE_PATH = "redback.admin.creation.file";
-
- public static final String ADMIN_FULL_NAME_KEY = "redback.admin.fullname";
-
- public static final String ADMIN_EMAIL_KEY = "redback.admin.email";
-
- public static final String ADMIN_PASSWORD_KEY = "redback.admin.password";
-
- @Inject
- @Named( value = "userManager#configurable" )
- private UserManager userManager;
-
- @Inject
- private UserConfiguration config;
-
- @Inject
- protected SecuritySystem securitySystem;
-
- @Inject
- private RoleManager roleManager;
-
- @Inject
- @Named( value = "rBACManager#cached" )
- private RBACManager rbacManager;
-
- public void validateEnvironment( List<String> violations )
- {
- try
- {
- User user = userManager.findUser( getAdminUid() );
- if ( user == null )
- {
- useForceAdminCreationFile();
- }
-
-
- }
- catch ( UserNotFoundException e )
- {
- useForceAdminCreationFile();
- }
- }
-
- private void checkAdminKarma( User u )
- {
- try
- {
- Collection<Role> roles = rbacManager.getEffectivelyAssignedRoles( getAdminUid() );
- boolean adminRole = false;
- for ( Role role : roles )
- {
- if ( StringUtils.equals( "system-administrator", role.getName() ) )
- {
- adminRole = true;
- }
- }
- if ( !adminRole )
- {
- assignAdminRole( u );
- }
- }
- catch ( RbacManagerException e )
- {
- log.warn( "fail to checkAdminKarma {}", e, e.getMessage() );
- }
- catch ( RoleManagerException e )
- {
- log.warn( "fail to assignAdmin role {}", e, e.getMessage() );
- }
- }
-
- private void useForceAdminCreationFile()
- {
- try
- {
- String forceAdminFilePath = System.getProperty( FORCE_ADMIN_FILE_PATH );
- if ( StringUtils.isBlank( forceAdminFilePath ) )
- {
- log.info( FORCE_ADMIN_FILE_PATH + " system props is empty don't use an auto creation admin " );
- return;
- }
- File file = new File( forceAdminFilePath );
- if ( !file.exists() )
- {
- log.warn( "file set in sysprops " + FORCE_ADMIN_FILE_PATH + " not exists skip admin auto creation" );
- return;
- }
- log.debug( "user {} not found try auto creation" );
- Properties properties = new Properties();
- FileInputStream fis = new FileInputStream( file );
- try
- {
- properties.load( fis );
- }
- catch ( Exception e )
- {
- log.warn( "error loading properties from file " + forceAdminFilePath + " skip admin auto creation" );
- return;
- }
- finally
- {
- IOUtil.close( fis );
- }
-
- // ensure we have all properties
- String password = properties.getProperty( ADMIN_PASSWORD_KEY );
- String email = properties.getProperty( ADMIN_EMAIL_KEY );
- String fullName = properties.getProperty( ADMIN_FULL_NAME_KEY );
-
- if ( StringUtils.isBlank( password ) )
- {
- log.warn( "property " + ADMIN_PASSWORD_KEY + " not set skip auto admin creation" );
- return;
- }
-
- if ( StringUtils.isBlank( email ) )
- {
- log.warn( "property " + ADMIN_EMAIL_KEY + " not set skip auto admin creation" );
- return;
- }
-
- if ( StringUtils.isBlank( fullName ) )
- {
- log.warn( "property " + ADMIN_FULL_NAME_KEY + " not set skip auto admin creation" );
- return;
- }
-
- User u = userManager.createUser( getAdminUid(), fullName, email );
-
- u.setPassword( password );
- u.setLocked( false );
- u.setPasswordChangeRequired( false );
- u.setPermanent( true );
- u.setValidated( true );
-
- u = userManager.addUser( u );
- u.setPassword( password );
-
- PasswordBasedAuthenticationDataSource authdatasource = new PasswordBasedAuthenticationDataSource();
- authdatasource.setPrincipal( u.getUsername() );
- authdatasource.setPassword( u.getPassword() );
- SecuritySession securitySession = securitySystem.authenticate( authdatasource );
- if ( securitySession.getAuthenticationResult().isAuthenticated() )
- {
- // good add various tokens.
- u = securitySession.getUser();
- u.setLastLoginDate( new Date() );
- securitySystem.getUserManager().updateUser( u );
- }
- assignAdminRole( u );
-
- }
- catch ( Exception e )
- {
- log.warn( "failed to automatically create an admin account " + e.getMessage(), e );
- }
- }
-
- private void assignAdminRole( User user )
- throws RoleManagerException
- {
- roleManager.assignRole( "system-administrator", user.getPrincipal().toString() );
- }
-
- private String getAdminUid()
- {
- return config.getString( "redback.default.admin" );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.security;
-
-/*
- * 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.policy.UserSecurityPolicy;
-import org.apache.archiva.redback.role.RoleManagerException;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.role.RoleManager;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.apache.archiva.redback.users.UserManager;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.util.List;
-
-/**
- * RequiredRolesEnvironmentCheck:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-@Service( "environmentCheck#guest-user-check" )
-public class GuestUserEnvironmentCheck
- implements EnvironmentCheck
-{
-
- @Inject
- private RoleManager roleManager;
-
- @Inject
- private SecuritySystem securitySystem;
-
- /**
- * boolean detailing if this environment check has been executed
- */
- private boolean checked = false;
-
- /**
- * @param violations
- */
- public void validateEnvironment( List<String> violations )
- {
- if ( !checked )
- {
- UserManager userManager = securitySystem.getUserManager();
- UserSecurityPolicy policy = securitySystem.getPolicy();
-
- User guest;
- try
- {
- guest = userManager.getGuestUser();
- }
- catch ( UserNotFoundException e )
- {
- policy.setEnabled( false );
- guest = userManager.createGuestUser();
- policy.setEnabled( true );
- }
-
- try
- {
- roleManager.assignRole( "guest", guest.getPrincipal().toString() );
- }
- catch ( RoleManagerException rpe )
- {
- violations.add( "unable to initialize guest user properly: " + rpe.getMessage() );
- }
-
- checked = true;
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.security;
-
-/*
- * 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.rbac.RbacManagerException;
-import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.rbac.RBACManager;
-import org.apache.archiva.redback.rbac.UserAssignment;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.redback.integration.role.RoleConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * LockedAdminEnvironmentCheck: checks if accounts marked as system administrator are locked
- * and unlocks them on startup.
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-@Service( "environmentCheck#locked-admin-check" )
-public class LockedAdminEnvironmentCheck
- implements EnvironmentCheck
-{
-
- protected Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject
- @Named( value = "userManager#configurable" )
- private UserManager userManager;
-
- @Inject
- @Named( value = "rBACManager#cached" )
- private RBACManager rbacManager;
-
- /**
- * boolean detailing if this environment check has been executed
- */
- private boolean checked = false;
-
- /**
- * This environment check will unlock system administrator accounts that are locked on the restart of the
- * application when the environment checks are processed.
- *
- * @param violations
- */
- public void validateEnvironment( List<String> violations )
- {
- if ( !checked && !userManager.isReadOnly() )
- {
- List<String> roles = new ArrayList<String>();
- roles.add( RoleConstants.SYSTEM_ADMINISTRATOR_ROLE );
-
- List<UserAssignment> systemAdminstrators;
- try
- {
- systemAdminstrators = rbacManager.getUserAssignmentsForRoles( roles );
-
- for ( UserAssignment userAssignment : systemAdminstrators )
- {
- try
- {
- User admin = userManager.findUser( userAssignment.getPrincipal() );
-
- if ( admin.isLocked() )
- {
- log.info( "Unlocking system administrator: {}", admin.getUsername() );
- admin.setLocked( false );
- userManager.updateUser( admin );
- }
- }
- catch ( UserNotFoundException ne )
- {
- log.warn( "Dangling UserAssignment -> {}", userAssignment.getPrincipal() );
- }
- }
- }
- catch ( RbacManagerException e )
- {
- log.warn( "Exception when checking for locked admin user: " + e.getMessage(), e );
- }
-
- checked = true;
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.security;
-
-/*
- * 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.util.List;
-
-import javax.inject.Inject;
-
-import org.apache.archiva.redback.role.RoleManager;
-import org.apache.archiva.redback.role.RoleManagerException;
-import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-/**
- * RequiredRolesEnvironmentCheck: this environment check will check that the
- * required roles of the redback-xwork-integration artifact exist to be
- * assigned.
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-@Service("environmentCheck#required-roles")
-public class RequiredRolesEnvironmentCheck
- implements EnvironmentCheck
-{
-
- protected Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject
- private RoleManager roleManager;
-
- /**
- * boolean detailing if this environment check has been executed
- */
- private boolean checked = false;
-
- /**
- * @param violations
- */
- public void validateEnvironment( List<String> violations )
- {
- if ( !checked )
- {
- log.info( "Checking the existence of required roles." );
-
- try
- {
- if ( !roleManager.roleExists( "registered-user" ) )
- {
- violations.add( "unable to validate existence of the registered-user role" );
- }
-
- if ( !roleManager.roleExists( "user-administrator" ) )
- {
- violations.add( "unable to validate existence of the user-administator role" );
- }
-
- if ( !roleManager.roleExists( "system-administrator" ) )
- {
- violations.add( "unable to validate existence of the system-administrator role" );
- }
- }
- catch ( RoleManagerException e )
- {
- violations.add( "unable to check required roles: " + e.getMessage() );
- }
-
- checked = true;
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.xwork;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-/**
- * XworkActionConfig
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class XworkActionConfig
-{
- public String name;
-
- public String clazz;
-
- public String method;
-
- public List<String> results = new ArrayList<String>();
-
- public XworkActionConfig( String name, String className, String method )
- {
- this.name = name;
- this.clazz = className;
- this.method = method;
- }
-
- public XworkActionConfig addResult( String name )
- {
- results.add( name );
- return this;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.checks.xwork;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-/**
- * XworkPackageConfig
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class XworkPackageConfig
-{
- public String name;
-
- public List<XworkActionConfig> actions = new ArrayList<XworkActionConfig>();
-
- public XworkPackageConfig( String name )
- {
- this.name = name;
- }
-
- public XworkActionConfig addAction( String name, String className, String method )
- {
- XworkActionConfig config = new XworkActionConfig( name, className, method );
- actions.add( config );
- return config;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc;
-
-/*
- * 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.extremecomponents.table.bean.Column;
-import org.extremecomponents.table.cell.AbstractCell;
-import org.extremecomponents.table.core.TableModel;
-import org.extremecomponents.table.view.html.BuilderUtils;
-
-/**
- * CheckboxImageCell
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class CheckboxImageCell
- extends AbstractCell
-{
-
- private static final String CHECKBOX_TRUE = "icon_success_sml";
-
- private static final String CHECKBOX_FALSE = "checkbox-false";
-
- protected String getCellValue( TableModel model, Column column )
- {
- Object value = column.getPropertyValue();
- if ( value == null )
- {
- return "";
- }
-
- Boolean bool = (Boolean) value;
-
- String cellValue = "<img src=\"";
-
- if ( bool.booleanValue() )
- {
- cellValue = cellValue + BuilderUtils.getImage( model, CHECKBOX_TRUE );
- }
- else
- {
- cellValue = cellValue + BuilderUtils.getImage( model, CHECKBOX_FALSE );
- }
-
- cellValue = cellValue + "\" alt=\"" + bool.toString() + "\"/>";
-
- return cellValue;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc;
-
-/*
- * 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.extremecomponents.table.bean.Column;
-import org.extremecomponents.table.cell.AbstractCell;
-import org.extremecomponents.table.core.TableModel;
-
-/**
- * MailtoCell
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class MailtoCell
- extends AbstractCell
-{
-
- protected String getCellValue( TableModel model, Column column )
- {
- String value = column.getPropertyValueAsString();
- if ( StringUtils.isBlank( value ) )
- {
- return "";
- }
-
- return "<a href=\"mailto:" + value + "\">" + value + "</a>";
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc;
-
-/*
- * 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.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.codehaus.redback.integration.util.UserComparator;
-import org.extremecomponents.table.callback.ProcessRowsCallback;
-import org.extremecomponents.table.core.TableConstants;
-import org.extremecomponents.table.core.TableModel;
-import org.extremecomponents.table.limit.Sort;
-
-/**
- * ProcessUserRowsCallback - Efficient and safe sort callback for user manager provided user lists.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ProcessUserRowsCallback
- extends ProcessRowsCallback
-{
-
- @SuppressWarnings("unchecked")
- public Collection sortRows( TableModel model, Collection rows )
- throws Exception
- {
- boolean sorted = model.getLimit().isSorted();
-
- if ( !sorted )
- {
- return rows;
- }
-
- Sort sort = model.getLimit().getSort();
- String property = sort.getProperty();
- String sortOrder = sort.getSortOrder();
-
- System.out.println( "SORTING: " + property + " - " + sortOrder );
-
- UserComparator comparator = new UserComparator( property, TableConstants.SORT_ASC.equals( sortOrder ) );
- Collections.sort( (List) rows, comparator );
-
- return rows;
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc;
-
-/*
- * 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.extremecomponents.table.bean.Column;
-import org.extremecomponents.table.cell.Cell;
-import org.extremecomponents.table.core.TableConstants;
-import org.extremecomponents.table.core.TableModel;
-import org.extremecomponents.table.view.html.TableActions;
-import org.extremecomponents.util.HtmlBuilder;
-
-/**
- * SecurityFilterCell
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SecurityFilterCell
- implements Cell
-{
- public String getExportDisplay( TableModel model, Column column )
- {
- return null;
- }
-
- public String getHtmlDisplay( TableModel model, Column column )
- {
- HtmlBuilder html = new HtmlBuilder();
-
- html.td( 2 );
-
- if ( StringUtils.isNotEmpty( column.getFilterClass() ) )
- {
- html.styleClass( column.getFilterClass() );
- }
-
- if ( StringUtils.isNotEmpty( column.getFilterStyle() ) )
- {
- html.style( column.getFilterStyle() );
- }
-
- if ( StringUtils.isNotEmpty( column.getWidth() ) )
- {
- html.width( column.getWidth() );
- }
-
- html.close();
-
- html.div();
- html.styleClass( "filterInputGroup" );
- html.close();
-
- if ( !column.isFilterable() )
- {
- html.append( "" );
- }
- else
- {
- html.append( input( model, column ) );
- }
-
- html.divEnd();
-
- html.tdEnd();
-
- return html.toString();
- }
-
- /**
- * If the filter is specified the default is to use a <input type=text> tag.
- */
- private String input( TableModel model, Column column )
- {
- HtmlBuilder html = new HtmlBuilder();
-
- html.input( "text" );
- html.name( model.getTableHandler().prefixWithTableId() + TableConstants.FILTER + column.getAlias() );
-
- html.title( "Filter by " + column.getTitle() );
-
- String value = column.getValueAsString();
- if ( StringUtils.isNotBlank( value ) )
- {
- html.value( value );
- }
-
- StringBuffer onkeypress = new StringBuffer();
- onkeypress.append( "if (event.keyCode == 13) {" );
- onkeypress.append( new TableActions( model ).getFilterAction() );
- onkeypress.append( "}" );
- html.onkeypress( onkeypress.toString() );
-
- html.xclose();
-
- return html.toString();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc.views;
-
-/*
- * 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.util.Iterator;
-
-import org.extremecomponents.table.bean.Export;
-import org.extremecomponents.table.core.TableModel;
-import org.extremecomponents.table.view.html.BuilderConstants;
-import org.extremecomponents.table.view.html.BuilderUtils;
-import org.extremecomponents.table.view.html.StatusBarBuilder;
-import org.extremecomponents.table.view.html.ToolbarBuilder;
-import org.extremecomponents.table.view.html.TwoColumnRowLayout;
-import org.extremecomponents.util.HtmlBuilder;
-
-/**
- * SecurityToolbar
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SecurityToolbar
- extends TwoColumnRowLayout
-{
- public SecurityToolbar( HtmlBuilder html, TableModel model )
- {
- super( html, model );
- }
-
- protected boolean showLayout( TableModel model )
- {
- boolean showStatusBar = BuilderUtils.showStatusBar( model );
- boolean filterable = BuilderUtils.filterable( model );
- boolean showExports = BuilderUtils.showExports( model );
- boolean showPagination = BuilderUtils.showPagination( model );
- boolean showTitle = BuilderUtils.showTitle( model );
- if ( !showStatusBar && !filterable && !showExports && !showPagination && !showTitle )
- {
- return false;
- }
-
- return true;
- }
-
- protected void columnLeft( HtmlBuilder html, TableModel model )
- {
- boolean showStatusBar = BuilderUtils.showStatusBar( model );
- if ( !showStatusBar )
- {
- return;
- }
-
- html.td( 4 ).styleClass( BuilderConstants.STATUS_BAR_CSS ).close();
-
- new StatusBarBuilder( html, model ).statusMessage();
-
- html.tdEnd();
- }
-
- @SuppressWarnings("unchecked")
- protected void columnRight( HtmlBuilder html, TableModel model )
- {
- boolean filterable = BuilderUtils.filterable( model );
- boolean showPagination = BuilderUtils.showPagination( model );
- boolean showExports = BuilderUtils.showExports( model );
-
- ToolbarBuilder toolbarBuilder = new ToolbarBuilder( html, model );
-
- html.td( 4 ).styleClass( BuilderConstants.COMPACT_TOOLBAR_CSS ).align( "right" ).close();
-
- html.table( 4 ).border( "0" ).cellPadding( "1" ).cellSpacing( "2" ).close();
- html.tr( 5 ).close();
-
- if ( showPagination )
- {
- html.td( 5 ).close();
- html.append( "Navigation:" );
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.firstPageItemAsImage();
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.prevPageItemAsImage();
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.nextPageItemAsImage();
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.lastPageItemAsImage();
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.separator();
- html.tdEnd();
-
- html.td( 5 ).close();
- html.append( "Display Rows:" );
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.rowsDisplayedDroplist();
- html.tdEnd();
-
- if ( showExports )
- {
- html.td( 5 ).close();
- toolbarBuilder.separator();
- html.tdEnd();
- }
- }
-
- if ( showExports )
- {
- Iterator iterator = model.getExportHandler().getExports().iterator();
- for ( Iterator iter = iterator; iter.hasNext(); )
- {
- html.td( 5 ).close();
- Export export = (Export) iter.next();
- toolbarBuilder.exportItemAsImage( export );
- html.tdEnd();
- }
- }
-
- if ( filterable )
- {
- if ( showExports || showPagination )
- {
- html.td( 5 ).close();
- toolbarBuilder.separator();
- html.tdEnd();
- }
-
- html.td( 5 ).close();
- toolbarBuilder.filterItemAsButton();
- html.tdEnd();
-
- html.td( 5 ).close();
- toolbarBuilder.clearItemAsButton();
- html.tdEnd();
- }
-
- html.trEnd( 5 );
-
- html.tableEnd( 4 );
-
- html.tdEnd();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.eXc.views;
-
-/*
- * 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.extremecomponents.table.core.TableModel;
-import org.extremecomponents.table.view.AbstractHtmlView;
-import org.extremecomponents.util.HtmlBuilder;
-
-/**
- * SecurityView
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SecurityView
- extends AbstractHtmlView
-{
- protected void beforeBodyInternal( TableModel model )
- {
- getTableBuilder().tableStart();
-
- getTableBuilder().theadStart();
-
- getTableBuilder().titleRowSpanColumns();
-
- navigationToolbar( getHtmlBuilder(), getTableModel() );
-
- getTableBuilder().headerRow();
-
- getTableBuilder().theadEnd();
-
- getTableBuilder().filterRow();
-
- getTableBuilder().tbodyStart();
- }
-
- protected void afterBodyInternal( TableModel model )
- {
- getCalcBuilder().defaultCalcLayout();
-
- getTableBuilder().tbodyEnd();
-
- getTableBuilder().tableEnd();
- }
-
- protected void navigationToolbar( HtmlBuilder html, TableModel model )
- {
- new SecurityToolbar( html, model ).layout();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter;
-
-/*
- * 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.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-
-/**
- * SpringServletFilter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class SpringServletFilter
- implements Filter
-{
- private ApplicationContext applicationContext;
-
- public void destroy()
- {
- // Do nothing here.
- }
-
- protected ApplicationContext getApplicationContext()
- {
- return applicationContext;
- }
-
- public void init( FilterConfig filterConfig )
- throws ServletException
- {
- applicationContext = WebApplicationContextUtils.getWebApplicationContext( filterConfig.getServletContext() );
-
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.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 javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-
-import org.codehaus.redback.integration.filter.SpringServletFilter;
-
-/**
- * AbstractHttpAuthenticationFilter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class AbstractHttpAuthenticationFilter
- extends SpringServletFilter
-{
- private String realmName;
-
- public void init( FilterConfig filterConfig )
- throws ServletException
- {
- realmName = filterConfig.getInitParameter( "realm-name" );
- }
-
- public String getRealmName()
- {
- return realmName;
- }
-
- public void setRealmName( String realmName )
- {
- this.realmName = realmName;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.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.AuthenticationException;
-
-/**
- * HttpAuthenticationException
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class HttpAuthenticationException
- extends AuthenticationException
-{
-
- public HttpAuthenticationException()
- {
- super();
- }
-
- public HttpAuthenticationException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public HttpAuthenticationException( String message )
- {
- super( message );
- }
-
- public HttpAuthenticationException( Throwable cause )
- {
- super( cause );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.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.AuthenticationException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.archiva.redback.users.User;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.apache.archiva.redback.authentication.AuthenticationDataSource;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.codehaus.plexus.util.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-
-/**
- * HttpAuthenticator
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class HttpAuthenticator
-{
- protected Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject
- protected SecuritySystem securitySystem;
-
- /**
- * The Public Face of the Authenticator.
- *
- * @throws MustChangePasswordException
- * @throws AccountLockedException
- */
- public AuthenticationResult authenticate( AuthenticationDataSource ds, HttpSession httpSession )
- throws AuthenticationException, AccountLockedException, MustChangePasswordException
- {
- try
- {
- SecuritySession securitySession = securitySystem.authenticate( ds );
-
- setSecuritySession( securitySession, httpSession );
-
- return securitySession.getAuthenticationResult();
- }
- catch ( AuthenticationException e )
- {
- String msg = "Unable to authenticate user: " + ds;
- log.info( msg, e );
- throw new HttpAuthenticationException( msg, e );
- }
- catch ( UserNotFoundException e )
- {
- log.info( "Login attempt against unknown user: {}", ds );
- throw new HttpAuthenticationException( "User name or password invalid." );
- }
- }
-
- /**
- * Entry point for a Filter.
- *
- * @param request
- * @param response
- * @throws AuthenticationException
- */
- public void authenticate( HttpServletRequest request, HttpServletResponse response )
- throws AuthenticationException
- {
- try
- {
- AuthenticationResult result = getAuthenticationResult( request, response );
-
- if ( ( result == null ) || ( !result.isAuthenticated() ) )
- {
- throw new HttpAuthenticationException( "You are not authenticated." );
- }
- }
- catch ( AccountLockedException e )
- {
- throw new HttpAuthenticationException( "Your account is locked.", e );
- }
- catch ( MustChangePasswordException e )
- {
- throw new HttpAuthenticationException( "You must change your password.", e );
- }
-
- }
-
- /**
- * Issue a Challenge Response back to the HTTP Client.
- *
- * @param request
- * @param response
- * @param realmName
- * @param exception
- * @throws IOException
- */
- public abstract void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
- AuthenticationException exception )
- throws IOException;
-
- /**
- * Parse the incoming request and return an AuthenticationResult.
- *
- * @param request
- * @param response
- * @return null if no http auth credentials, or the actual authentication result based on the credentials.
- * @throws AuthenticationException
- * @throws MustChangePasswordException
- * @throws AccountLockedException
- */
- public abstract AuthenticationResult getAuthenticationResult( HttpServletRequest request,
- HttpServletResponse response )
- throws AuthenticationException, AccountLockedException, MustChangePasswordException;
-
-
- public User getSessionUser( HttpSession httpSession )
- {
- return (User) httpSession.getAttribute( SecuritySession.USERKEY );
- }
-
- public boolean isAlreadyAuthenticated( HttpSession httpSession )
- {
- User user = getSessionUser( httpSession );
-
- return ( ( user != null ) && !user.isLocked() && !user.isPasswordChangeRequired() );
- }
-
- public SecuritySession getSecuritySession( HttpSession httpSession )
- {
- SecuritySession securitySession = (SecuritySession) httpSession.getAttribute( SecuritySession.SESSION_KEY );
- if ( securitySession != null )
- {
- return securitySession;
- }
- return (SecuritySession) httpSession.getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
-
- }
-
-
- public void setSecuritySession( SecuritySession session, HttpSession httpSession )
- {
- httpSession.setAttribute( SecuritySession.SESSION_KEY, session );
- httpSession.setAttribute( SecuritySession.USERKEY, session.getUser() );
- }
-
- public void setSessionUser( User user, HttpSession httpSession )
- {
- httpSession.setAttribute( SecuritySession.SESSION_KEY, null );
- httpSession.setAttribute( SecuritySession.USERKEY, user );
- }
-
- public String storeDefaultUser( String principal, HttpSession httpSession )
- {
- httpSession.setAttribute( SecuritySession.SESSION_KEY, null );
- httpSession.setAttribute( SecuritySession.USERKEY, null );
-
- if ( StringUtils.isEmpty( principal ) )
- {
- return null;
- }
-
- try
- {
- User user = securitySystem.getUserManager().findUser( principal );
- httpSession.setAttribute( SecuritySession.USERKEY, user );
-
- return user.getPrincipal().toString();
-
- }
- catch ( UserNotFoundException e )
- {
- log.warn( "Default User '" + principal + "' not found.", e );
- return null;
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.basic;
-
-/*
- * 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.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.archiva.redback.authentication.AuthenticationException;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.springframework.stereotype.Service;
-
-/**
- * HttpBasicAuthentication
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service("httpAuthenticator#basic")
-public class HttpBasicAuthentication
- extends HttpAuthenticator
-{
-
- public String getId()
- {
- return HttpBasicAuthentication.class.getName();
- }
-
- public AuthenticationResult getAuthenticationResult( HttpServletRequest request, HttpServletResponse response )
- throws AuthenticationException, AccountLockedException, MustChangePasswordException
- {
- HttpSession httpSession = request.getSession( true );
- SecuritySession securitySession = getSecuritySession( httpSession );
- if ( securitySession != null )
- {
- return securitySession.getAuthenticationResult();
- }
-
- PasswordBasedAuthenticationDataSource authDataSource;
- String header = request.getHeader( "Authorization" );
-
- // in tomcat this is : authorization=Basic YWRtaW46TWFuYWdlMDc=
- if ( header == null )
- {
- header = request.getHeader( "authorization" );
- }
-
- if ( ( header != null ) && header.startsWith( "Basic " ) )
- {
- String base64Token = header.substring( 6 );
- String token = new String( Base64.decodeBase64( base64Token.getBytes() ) );
-
- String username = "";
- String password = "";
- int delim = token.indexOf( ':' );
-
- if ( delim != ( -1 ) )
- {
- username = token.substring( 0, delim );
- password = token.substring( delim + 1 );
- }
-
- authDataSource = new PasswordBasedAuthenticationDataSource( username, password );
- return super.authenticate( authDataSource, httpSession );
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Return a HTTP 403 - Access Denied response.
- *
- * @param request the request to use.
- * @param response the response to use.
- * @param realmName the realm name to state.
- * @param exception the exception to base the message off of.
- * @throws IOException if there was a problem with the {@link HttpServletResponse#sendError(int,String)} call.
- */
- public void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
- AuthenticationException exception )
- throws IOException
- {
- response.addHeader( "WWW-Authenticate", "Basic realm=\"" + realmName + "\"" );
- String message = "You must provide a username and password to access this resource.";
- if ( ( exception != null ) && StringUtils.isNotEmpty( exception.getMessage() ) )
- {
- message = exception.getMessage();
- }
- response.sendError( HttpServletResponse.SC_UNAUTHORIZED, message );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.basic;
-
-/*
- * 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.AuthenticationException;
-import org.codehaus.redback.integration.filter.authentication.AbstractHttpAuthenticationFilter;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * HttpBasicAuthenticationFilter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class HttpBasicAuthenticationFilter
- extends AbstractHttpAuthenticationFilter
-{
- private HttpAuthenticator httpAuthentication;
-
- @Override
- public void init( FilterConfig filterConfig )
- throws ServletException
- {
- super.init( filterConfig );
-
- httpAuthentication = getApplicationContext().getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
- }
-
- public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
- throws IOException, ServletException
- {
- if ( !( request instanceof HttpServletRequest ) )
- {
- throw new ServletException( "Can only process HttpServletRequest" );
- }
-
- if ( !( response instanceof HttpServletResponse ) )
- {
- throw new ServletException( "Can only process HttpServletResponse" );
- }
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- HttpServletResponse httpResponse = (HttpServletResponse) response;
-
- try
- {
- httpAuthentication.authenticate( httpRequest, httpResponse );
- }
- catch ( AuthenticationException e )
- {
- HttpAuthenticator httpauthn = new HttpBasicAuthentication();
- httpauthn.challenge( httpRequest, httpResponse, getRealmName(), e );
- return;
- }
-
- chain.doFilter( request, response );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * Digest
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * @todo move to plexus-utils in future
- */
-public class Digest
-{
- public static String md5Hex( String data )
- {
- MessageDigest digest = getDigest( "MD5" );
- return Hex.encode( digest.digest( data.getBytes() ) );
- }
-
- public static MessageDigest getDigest( String algorithm )
- {
- try
- {
- return MessageDigest.getInstance( algorithm );
- }
- catch ( NoSuchAlgorithmException e )
- {
- throw new RuntimeException( "Error initializing MessageDigest: " + e.getMessage(), e );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.
- */
-
-/**
- * Hex
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- * @todo should probably move this to plexus-utils or plexus-security-common
- */
-public class Hex
-{
- private static final byte[] DIGITS = "0123456789abcdef".getBytes();
-
- public static String encode( byte[] data )
- {
- int l = data.length;
-
- byte[] raw = new byte[l * 2];
-
- for ( int i = 0, j = 0; i < l; i++ )
- {
- raw[j++] = DIGITS[( 0xF0 & data[i] ) >>> 4];
- raw[j++] = DIGITS[0x0F & data[i]];
- }
-
- return new String( raw );
- }
-
- public static String encode( String raw )
- {
- return encode( raw.getBytes() );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.AuthenticationException;
-import org.apache.archiva.redback.policy.MustChangePasswordException;
-import org.apache.archiva.redback.users.User;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.archiva.redback.authentication.AuthenticationResult;
-import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticationException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.IOException;
-
-/**
- * HttpDigestAuthentication methods for working with <a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617 HTTP Authentication</a>.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service("httpAuthenticator#digest")
-public class HttpDigestAuthentication
- extends HttpAuthenticator
-{
- @Inject
- @Named(value="userManager#configurable")
- private UserManager userManager;
-
- /**
- *
- */
- private int nonceLifetimeSeconds = 300;
-
- /**
- * NOTE: Must be alphanumeric.
- *
- *
- */
- private String digestKey ="OrycteropusAfer";
-
- private String realm;
-
- public String getId()
- {
- return HttpDigestAuthentication.class.getName();
- }
-
- public AuthenticationResult getAuthenticationResult( HttpServletRequest request, HttpServletResponse response )
- throws AuthenticationException, AccountLockedException, MustChangePasswordException
- {
- HttpSession httpSession = request.getSession( true );
- if ( isAlreadyAuthenticated( httpSession ) )
- {
- return getSecuritySession( httpSession ).getAuthenticationResult();
- }
-
- TokenBasedAuthenticationDataSource authDataSource = new TokenBasedAuthenticationDataSource();
- String authHeader = request.getHeader( "Authorization" );
-
- // in tomcat this is : authorization=Basic YWRtaW46TWFuYWdlMDc=
- if ( authHeader == null )
- {
- authHeader = request.getHeader( "authorization" );
- }
-
- if ( ( authHeader != null ) && authHeader.startsWith( "Digest " ) )
- {
- String rawDigestHeader = authHeader.substring( 7 );
-
- HttpDigestHeader digestHeader = new HttpDigestHeader();
- digestHeader.parseClientHeader( rawDigestHeader, getRealm(), digestKey );
-
- // Lookup password for presented username
- User user = findUser( digestHeader.username );
- authDataSource.setPrincipal( user.getPrincipal().toString() );
-
- String serverSideHash = generateDigestHash( digestHeader, user.getPassword(), request.getMethod() );
-
- if ( !StringUtils.equals( serverSideHash, digestHeader.response ) )
- {
- throw new HttpAuthenticationException( "Digest response was invalid." );
- }
- }
-
- return super.authenticate( authDataSource, httpSession );
- }
-
- public User findUser( String username )
- throws HttpAuthenticationException
- {
- try
- {
- return userManager.findUser( username );
- }
- catch ( UserNotFoundException e )
- {
- String msg = "Unable to find primary user '" + username + "'.";
- log.error( msg, e );
- throw new HttpAuthenticationException( msg, e );
- }
- }
-
- /**
- * Issue HTTP Digest Authentication Challenge
- *
- * @param request the request to use.
- * @param response the response to use.
- * @param realmName the realm name to state.
- * @param exception the exception to base the message off of.
- * @throws IOException if there was a problem with the {@link HttpServletResponse#sendError(int,String)} call.
- */
- public void challenge( HttpServletRequest request, HttpServletResponse response, String realmName,
- AuthenticationException exception )
- throws IOException
- {
- // The Challenge Header
- StringBuilder authHeader = new StringBuilder();
- authHeader.append( "Digest " );
- // [REQUIRED] The name to appear in the dialog box to the user.
- authHeader.append( "realm=\"" ).append( realmName ).append( "\"" );
- // [OPTIONAL] We do not use the optional 'domain' header.
- // authHeader.append( "domain=\"" ).append( domain ).append( "\"" );
- // [REQUIRED] Nonce specification.
- authHeader.append( ", nonce=\"" );
- long timestamp = System.currentTimeMillis() + ( nonceLifetimeSeconds * 1000 );
- // Not using ETag from RFC 2617 intentionally.
- String hraw = String.valueOf( timestamp ) + ":" + digestKey;
- String rawnonce = String.valueOf( timestamp ) + ":" + Digest.md5Hex( hraw );
- authHeader.append( Base64.encodeBase64( rawnonce.getBytes() ) );
- authHeader.append( "\"" );
- // [REQUIRED] The RFC 2617 Quality of Protection.
- // MSIE Appears to only support 'auth'
- // Do not use 'opaque' here. (Your MSIE users will have issues)
- authHeader.append( ", qop=\"auth\"" );
- // [BROKEN] since we force the 'auth' qop we cannot use the opaque option.
- // authHeader.append( ", opaque=\"").append(opaqueString).append("\"");
-
- // [OPTIONAL] Use of the stale option is reserved for expired nonce strings.
- if ( exception instanceof NonceExpirationException )
- {
- authHeader.append( ", stale=\"true\"" );
- }
-
- // [OPTIONAL] We do not use the optional Algorithm header.
- // authHeader.append( ", algorithm=\"MD5\"");
-
- response.addHeader( "WWW-Authenticate", authHeader.toString() );
- response.sendError( HttpServletResponse.SC_UNAUTHORIZED, exception.getMessage() );
- }
-
- private String generateDigestHash( HttpDigestHeader digestHeader, String password, String httpMethod )
- {
- String a1 = Digest.md5Hex( digestHeader.username + ":" + realm + ":" + password );
- String a2 = Digest.md5Hex( httpMethod + ":" + digestHeader.uri );
-
- String digest;
-
- if ( StringUtils.isEmpty( digestHeader.qop ) )
- {
- digest = a1 + ":" + digestHeader.nonce + ":" + a2;
- }
- else if ( StringUtils.equals( "auth", digestHeader.qop ) )
- {
- digest = a1 + ":" + digestHeader.nonce + ":" + digestHeader.nc + ":" + digestHeader.cnonce + ":"
- + digestHeader.qop + ":" + a2;
- }
- else
- {
- throw new IllegalStateException( "Http Digest Parameter [qop] with value of [" + digestHeader.qop
- + "] is unsupported." );
- }
-
- return Digest.md5Hex( digest );
- }
-
- public String getRealm()
- {
- return realm;
- }
-
- public void setRealm( String realm )
- {
- this.realm = realm;
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.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;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * HttpDigestAuthenticationFilter.
- * <p/>
- * Uses RFC 2617 and RFC 2069 to perform Digest authentication against the incoming client.
- * <p/>
- * <ul>
- * <li><a href="http://www.faqs.org/rfcs/rfc2617.html">RFC 2617</a> - HTTP Authentication: Basic and Digest Access Authentication</li>
- * <li><a href="http://www.faqs.org/rfcs/rfc2069.html">RFC 2069</a> - An Extension to HTTP : Digest Access Authentication</li>
- * </ul>
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class HttpDigestAuthenticationFilter
- extends AbstractHttpAuthenticationFilter
-{
- private HttpDigestAuthentication httpAuthentication;
-
- @Override
- public void init( FilterConfig filterConfig )
- throws ServletException
- {
- super.init( filterConfig );
-
- httpAuthentication =
- getApplicationContext().getBean( "httpAuthenticator#digest", HttpDigestAuthentication.class );
-
- }
-
- public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
- throws IOException, ServletException
- {
- if ( !( request instanceof HttpServletRequest ) )
- {
- throw new ServletException( "Can only process HttpServletRequest" );
- }
-
- if ( !( response instanceof HttpServletResponse ) )
- {
- throw new ServletException( "Can only process HttpServletResponse" );
- }
-
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- HttpServletResponse httpResponse = (HttpServletResponse) response;
-
- try
- {
- httpAuthentication.setRealm( getRealmName() );
- httpAuthentication.authenticate( httpRequest, httpResponse );
- }
- catch ( AuthenticationException e )
- {
- HttpAuthenticator httpauthn = new HttpBasicAuthentication();
- httpauthn.challenge( httpRequest, httpResponse, getRealmName(), e );
- return;
- }
-
- chain.doFilter( request, response );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.codec.binary.Base64;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.HttpUtils;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticationException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import java.util.Properties;
-
-/**
- * HttpDigestHeader
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "httpClientHeader" )
-@Scope( "prototype" )
-public class HttpDigestHeader
-{
- private Logger log = LoggerFactory.getLogger( HttpDigestHeader.class );
-
- public String username;
-
- public String realm;
-
- public String nonce;
-
- public String uri;
-
- public String response;
-
- public String qop;
-
- public String nc;
-
- public String cnonce;
-
- public void parseClientHeader( String rawHeader, String expectedRealm, String digestKey )
- throws HttpAuthenticationException
- {
- Properties authHeaderProps = HttpUtils.complexHeaderToProperties( rawHeader, ",", "=" );
-
- username = authHeaderProps.getProperty( "username" );
- realm = authHeaderProps.getProperty( "realm" );
- nonce = authHeaderProps.getProperty( "nonce" );
- uri = authHeaderProps.getProperty( "uri" );
- response = authHeaderProps.getProperty( "response" );
- qop = authHeaderProps.getProperty( "qop" );
- nc = authHeaderProps.getProperty( "nc" );
- cnonce = authHeaderProps.getProperty( "cnonce" );
-
- // [RFC 2067] Validate all required values
- if ( StringUtils.isEmpty( username ) || StringUtils.isEmpty( realm ) || StringUtils.isEmpty( nonce )
- || StringUtils.isEmpty( uri ) || StringUtils.isEmpty( response ) )
- {
- log.debug( "Missing mandatory fields: Raw Digest Header : [{}]", rawHeader );
-
- throw new HttpAuthenticationException( "Missing mandatory digest fields per RFC2069." );
- }
-
- // [RFC 2617] Validate realm.
- if ( !StringUtils.equals( expectedRealm, realm ) )
- {
- log.debug( "Realm name is invalid: expected [{}] but got [{}]", expectedRealm, realm );
-
- throw new HttpAuthenticationException( "Response realm does not match expected realm." );
- }
-
- // [RFC 2617] Validate "auth" qop
- if ( StringUtils.equals( "auth", qop ) )
- {
- if ( StringUtils.isEmpty( nc ) || StringUtils.isEmpty( cnonce ) )
- {
- log.debug( "Missing mandatory qop fields: nc [{}] cnonce [{}]", nc, cnonce );
-
- throw new HttpAuthenticationException( "Missing mandatory qop digest fields per RFC2617." );
- }
- }
-
- // [RFC 2617] Validate nonce
- if ( !Base64.isArrayByteBase64( nonce.getBytes() ) )
- {
- log.debug( "Nonce is not encoded in Base64: nonce [{}]", nonce );
-
- throw new HttpAuthenticationException( "Response nonce is not encoded in Base64." );
- }
-
- // Decode nonce
- String decodedNonce = new String( Base64.decodeBase64( nonce.getBytes() ) );
- String nonceTokens[] = StringUtils.split( decodedNonce, ":" );
-
- // Validate nonce format
- if ( nonceTokens.length != 2 )
- {
- log.debug( "Nonce format expected [2] elements, but got [{}] instead. Decoded nonce [{}]",
- nonceTokens.length, decodedNonce );
-
- throw new HttpAuthenticationException(
- "Nonce format is invalid. " + "Received an unexpected number of sub elements." );
- }
-
- // Extract nonce timestamp
- long nonceTimestamp = 0;
-
- try
- {
- nonceTimestamp = Long.parseLong( nonceTokens[0] );
- }
- catch ( NumberFormatException e )
- {
- throw new HttpAuthenticationException( "Unexpected nonce timestamp." );
- }
-
- // Extract nonce signature
- String expectedSignature = Digest.md5Hex( nonceTimestamp + ":" + digestKey );
-
- if ( !StringUtils.equals( expectedSignature, nonceTokens[1] ) )
- {
- log.error( "Nonce parameter has been compromised." );
-
- throw new HttpAuthenticationException( "Nonce parameter has been compromised." );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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.redback.integration.filter.authentication.HttpAuthenticationException;
-
-/**
- * NonceExpirationException
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class NonceExpirationException
- extends HttpAuthenticationException
-{
-
- public NonceExpirationException()
- {
- super();
- }
-
- public NonceExpirationException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public NonceExpirationException( String message )
- {
- super( message );
- }
-
- public NonceExpirationException( Throwable cause )
- {
- super( cause );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authorization;
-
-/*
- * 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.authorization.AuthorizationException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.filter.SpringServletFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-/**
- * SimpleAuthorizationFilter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SimpleAuthorizationFilter
- extends SpringServletFilter
-{
-
- private Logger logger = LoggerFactory.getLogger( getClass() );
-
- private String permission;
-
- private String resource;
-
- private String accessDeniedLocation;
-
- public void init( FilterConfig filterConfig )
- throws ServletException
- {
- super.init( filterConfig );
-
- permission = filterConfig.getInitParameter( "permission" );
- resource = filterConfig.getInitParameter( "resource" );
- accessDeniedLocation = filterConfig.getInitParameter( "accessDeniedLocation" );
-
- if ( StringUtils.isEmpty( accessDeniedLocation ) )
- {
- throw new ServletException(
- "Missing parameter 'accessDeniedLocation' from " + SimpleAuthorizationFilter.class.getName()
- + " configuration." );
- }
- }
-
- public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
- throws IOException, ServletException
- {
- SecuritySession securitySession = getApplicationContext().getBean( "securitySession", SecuritySession.class );
-
- if ( securitySession == null )
- {
- logger.warn( "Security Session is null." );
- return;
- }
-
- SecuritySystem securitySystem = getApplicationContext().getBean( "securitySystem", SecuritySystem.class );
-
- boolean isAuthorized = false;
-
- try
- {
- if ( StringUtils.isEmpty( resource ) )
- {
- isAuthorized = securitySystem.isAuthorized( securitySession, permission );
- }
- else
- {
- isAuthorized = securitySystem.isAuthorized( securitySession, permission, resource );
- }
- if ( isAuthorized )
- {
- chain.doFilter( request, response );
- }
- else
- {
- accessDenied( response );
- }
- }
- catch ( AuthorizationException e )
- {
- accessDenied( response );
- }
- }
-
- protected void accessDenied( ServletResponse response )
- throws IOException
- {
- String newlocation = accessDeniedLocation;
-
- if ( newlocation.indexOf( '?' ) == ( -1 ) )
- {
- newlocation += "?";
- }
- else
- {
- newlocation += "&";
- }
- newlocation += "resource=" + resource;
-
- ( (HttpServletResponse) response ).sendRedirect( newlocation );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.interceptor;
-
-/*
- * 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.
- */
-
-/**
- * SecureAction
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface SecureAction
-{
- /**
- * get an authorization bundle to process for authn and authz
- */
- SecureActionBundle getSecureActionBundle()
- throws SecureActionException;
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.interceptor;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-import org.apache.archiva.redback.rbac.Resource;
-
-/**
- * SecureActionBundle:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-public class SecureActionBundle
-{
- private boolean requiresAuthentication = false;
-
- private List<AuthorizationTuple> authorizationTuples = new ArrayList<AuthorizationTuple>();
-
- public static final SecureActionBundle OPEN;
-
- public static final SecureActionBundle AUTHONLY;
-
- static
- {
- OPEN = new SecureActionBundle();
- AUTHONLY = new SecureActionBundle();
- AUTHONLY.setRequiresAuthentication( true );
- }
-
- /**
- * Add an authorization tuple
- *
- * @param operation
- * @param resource
- * @throws SecureActionException
- */
- public void addRequiredAuthorization( String operation, String resource )
- throws SecureActionException
- {
- if ( operation != null && resource != null )
- {
- authorizationTuples.add( new AuthorizationTuple( operation, resource ) );
- }
- else
- {
- throw new SecureActionException( "operation and resource are required to be non-null" );
- }
- }
-
- /**
- * add an authorization tuple, assuming the resource part of it is Resource.GLOBAL
- *
- * @param operation
- * @throws SecureActionException
- */
- public void addRequiredAuthorization( String operation )
- throws SecureActionException
- {
- if ( operation != null )
- {
- authorizationTuples.add( new AuthorizationTuple( operation, Resource.GLOBAL ) );
- }
- else
- {
- throw new SecureActionException( "operation is required to be non-null" );
- }
- }
-
- public List<AuthorizationTuple> getAuthorizationTuples()
- {
- return authorizationTuples;
- }
-
- public boolean requiresAuthentication()
- {
- return requiresAuthentication;
- }
-
- public void setRequiresAuthentication( boolean requiresAuthentication )
- {
- this.requiresAuthentication = requiresAuthentication;
- }
-
- public static class AuthorizationTuple
- {
- private String operation;
-
- private String resource;
-
- public AuthorizationTuple( String operation, String resource )
- {
- this.operation = operation;
- this.resource = resource;
- }
-
- public String getOperation()
- {
- return operation;
- }
-
- public String getResource()
- {
- return resource;
- }
-
-
- public String toString()
- {
- return "AuthorizationTuple[" + operation + "," + resource + "]";
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.interceptor;
-
-/*
- * 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.
- */
-
-/**
- * SecureActionException:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- */
-public class SecureActionException
- extends Exception
-{
-
- public SecureActionException( String string )
- {
- super( string );
- }
-
- public SecureActionException( String string, Throwable throwable )
- {
- super( string, throwable );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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.keys.AuthenticationKey;
-
-/**
- * Mail generator component.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @version $Id$
- */
-public interface MailGenerator
-{
- String ROLE = MailGenerator.class.getName();
-
- String generateMail( String templateName, AuthenticationKey authkey, String baseUrl );
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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.keys.AuthenticationKey;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
- * @version $Id$
- */
-public interface Mailer
-{
- void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
-
- void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
-
- void sendMessage( Collection<String> recipients, String subject, String content );
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-
-import org.apache.archiva.redback.configuration.UserConfiguration;
-import org.apache.archiva.redback.keys.AuthenticationKey;
-import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.apache.archiva.redback.policy.UserValidationSettings;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.plexus.util.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.mail.javamail.JavaMailSender;
-import org.springframework.stereotype.Service;
-
-/**
- * Mailer
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service("mailer")
-public class MailerImpl
- implements Mailer
-{
- protected Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject @Named(value="mailGenerator#velocity")
- private MailGenerator generator;
-
- @Inject @Named(value="mailSender")
- private JavaMailSender javaMailSender;
-
- @Inject
- private SecuritySystem securitySystem;
-
- @Inject @Named(value="userConfiguration")
- private UserConfiguration config;
-
- public void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
- {
- String content = generator.generateMail( "newAccountValidationEmail", authkey, baseUrl );
-
- UserSecurityPolicy policy = securitySystem.getPolicy();
- UserValidationSettings validation = policy.getUserValidationSettings();
- sendMessage( recipients, validation.getEmailSubject(), content );
- }
-
- public void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
- {
- String content = generator.generateMail( "passwordResetEmail", authkey, baseUrl );
-
- UserSecurityPolicy policy = securitySystem.getPolicy();
- UserValidationSettings validation = policy.getUserValidationSettings();
- sendMessage( recipients, validation.getEmailSubject(), content );
- }
-
- public void sendMessage( Collection<String> recipients, String subject, String content )
- {
- if ( recipients.isEmpty() )
- {
- log.warn( "Mail Not Sent - No mail recipients for email. subject [" + subject + "]" );
- return;
- }
-
- String fromAddress = config.getString( "email.from.address" );
- String fromName = config.getString( "email.from.name" );
-
- if ( StringUtils.isEmpty( fromAddress ) )
- {
- fromAddress = System.getProperty( "user.name" ) + "@localhost";
- }
-
-
-
- // TODO: Allow for configurable message headers.
-
- try
- {
-
- MimeMessage message = javaMailSender.createMimeMessage();
-
- message.setSubject( subject );
- message.setText( content );
-
- InternetAddress from = new InternetAddress( fromAddress, fromName );
-
- message.setFrom( from );
-
- List<Address> tos = new ArrayList<Address>();
-
- for ( String mailbox : recipients )
- {
- InternetAddress to = new InternetAddress( mailbox.trim() );
-
- tos.add( to );
- }
-
- message.setRecipients(Message.RecipientType.TO, tos.toArray(new Address[tos.size()]));
-
- log.debug("mail content {}", content );
-
- javaMailSender.send( message );
- }
- catch ( AddressException e )
- {
- log.error( "Unable to send message, subject [" + subject + "]", e );
- }
- catch ( MessagingException e )
- {
- log.error( "Unable to send message, subject [" + subject + "]", e );
- }
- catch ( UnsupportedEncodingException e )
- {
- log.error( "Unable to send message, subject [" + subject + "]", e );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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.keys.AuthenticationKey;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.exception.MethodInvocationException;
-import org.apache.velocity.exception.ParseErrorException;
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.archiva.redback.configuration.UserConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.Locale;
-
-/**
- * Mail generator component implementation using velocity.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @version $Id$
- */
-@Service( "mailGenerator#velocity" )
-public class VelocityMailGenerator
- implements MailGenerator
-{
- private Logger log = LoggerFactory.getLogger( VelocityMailGenerator.class );
-
- @Inject
- @Named( value = "userConfiguration" )
- private UserConfiguration config;
-
- // FIXME use the spring directly
- @Inject
- @Named( value = "velocityEngine#redback" )
- private VelocityEngine velocityEngine;
-
- public String generateMail( String templateName, AuthenticationKey authkey, String baseUrl )
- {
- VelocityContext context = createVelocityContext( authkey, baseUrl );
-
- String packageName = getClass().getPackage().getName().replace( '.', '/' );
- String templateFile = packageName + "/template/" + templateName + ".vm";
-
- StringWriter writer = new StringWriter();
-
- try
- {
- velocityEngine.mergeTemplate( templateFile, context, writer );
- }
- catch ( ResourceNotFoundException e )
- {
- log.error( "No such template: '{}'.", templateFile );
- }
- catch ( ParseErrorException e )
- {
- log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
- }
- catch ( MethodInvocationException e )
- {
- log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
- }
- catch ( Exception e )
- {
- log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
- }
-
- return writer.getBuffer().toString();
- }
-
- private VelocityContext createVelocityContext( AuthenticationKey authkey, String appUrl )
- {
- VelocityContext context = new VelocityContext();
-
- context.put( "applicationUrl", config.getString( "application.url", appUrl ) );
-
- String feedback = config.getString( "email.feedback.path" );
-
- if ( feedback != null )
- {
- if ( feedback.startsWith( "/" ) )
- {
- feedback = appUrl + feedback;
- }
-
- context.put( "feedback", feedback );
- }
-
- context.put( "urlPath", config.getString( "email.url.path", "security/login!login.action" ) );
-
- context.put( "authkey", authkey.getKey() );
-
- context.put( "accountId", authkey.getForPrincipal() );
-
- SimpleDateFormat dateformatter = new SimpleDateFormat( config.getString( "application.timestamp" ), Locale.US );
-
- context.put( "requestedOn", dateformatter.format( authkey.getDateCreated() ) );
-
- if ( authkey.getDateExpires() != null )
- {
- context.put( "expiresOn", dateformatter.format( authkey.getDateExpires() ) );
- }
- else
- {
- context.put( "expiresOn", "(does not expire)" );
- }
- return context;
- }
-
-
- public UserConfiguration getConfig()
- {
- return config;
- }
-
- public void setConfig( UserConfiguration config )
- {
- this.config = config;
- }
-
- public VelocityEngine getVelocityEngine()
- {
- return velocityEngine;
- }
-
- public void setVelocityEngine( VelocityEngine velocityEngine )
- {
- this.velocityEngine = velocityEngine;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.users.User;
-
-/**
- * AdminEditUserCredentials
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class AdminEditUserCredentials
- extends EditUserCredentials
-{
- private boolean locked;
-
- private boolean passwordChangeRequired;
-
- public AdminEditUserCredentials()
- {
- super();
- }
-
- public AdminEditUserCredentials( User user )
- {
- super( user );
- this.locked = user.isLocked();
- this.passwordChangeRequired = user.isPasswordChangeRequired();
- }
-
- public boolean isLocked()
- {
- return locked;
- }
-
- public void setLocked( boolean locked )
- {
- this.locked = locked;
- }
-
- public boolean isPasswordChangeRequired()
- {
- return passwordChangeRequired;
- }
-
- public void setPasswordChangeRequired( boolean passwordChangeRequired )
- {
- this.passwordChangeRequired = passwordChangeRequired;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.
- */
-
-/**
- * CreateRoleDetails
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class CreateRoleDetails
- extends RoleDetails
-{
- public CreateRoleDetails()
- {
- super();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.
- */
-
-/**
- * CreateUserCredentials
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class CreateUserCredentials
- extends UserCredentials
-{
- public CreateUserCredentials()
- {
- super();
- }
-
- public boolean isEdit()
- {
- return false;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.rbac.Permission;
-import org.apache.archiva.redback.rbac.Role;
-
-/**
- * EditRoleDetails - Existing user Role Details.
- * <p/>
- * This is a placeholder for information passed back
- * and forth between the Action and the Client.
- * <p/>
- * We intentionally do not hook up the actual object to prevent
- * creative injection of fields and values by the untrusted client.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class EditRoleDetails
- extends RoleDetails
-{
- public EditRoleDetails( Role role )
- {
- super.setName( role.getName() );
- super.setDescription( role.getDescription() );
-
- for ( String r : role.getChildRoleNames() )
- {
- super.addChildRoleName( r );
- }
-
- for ( Permission perm : role.getPermissions() )
- {
- super.addPermission( perm.getName(), perm.getOperation().getName(), perm.getResource().getIdentifier() );
- }
- }
-
- public void setName( String name )
- {
- // Prevent Change (This is an edit after all)
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.users.User;
-import org.codehaus.redback.integration.util.DateUtils;
-
-/**
- * EditUserCredentials
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class EditUserCredentials
- extends UserCredentials
-{
- public EditUserCredentials()
- {
- super();
- }
-
- public EditUserCredentials( String username )
- {
- super();
- super.setUsername( username );
- }
-
- public EditUserCredentials( User user )
- {
- super();
- super.setUsername( user.getUsername() );
- super.setFullName( user.getFullName() );
- super.setEmail( user.getEmail() );
- super.setPassword( "" );
- super.setConfirmPassword( "" );
-
- super.setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
- super.setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
- super.setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
- }
-
- public boolean isEdit()
- {
- return true;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-/**
- * RoleDetails - this is a placeholder for information passed back
- * and forth between the Action and the Client.
- * <p/>
- * We intentionally do not hook up the actual object to prevent
- * creative injection of fields and values by the untrusted client.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class RoleDetails
-{
- private String name;
-
- private String description;
-
- private boolean assignable;
-
- private List<String> childRoleNames = new ArrayList<String>();
-
- private List<SimplePermission> permissions = new ArrayList<SimplePermission>();
-
- public void addChildRoleName( String name )
- {
- childRoleNames.add( name );
- }
-
- public void addPermission( String permissionName, String operationName, String resourceIdentifier )
- {
- SimplePermission permission = new SimplePermission();
- permission.setName( permissionName );
- permission.setOperationName( operationName );
- permission.setResourceIdentifier( resourceIdentifier );
-
- permissions.add( permission );
- }
-
- public List<String> getChildRoleNames()
- {
- return childRoleNames;
- }
-
- public boolean isAssignable()
- {
- return assignable;
- }
-
- public void setAssignable( boolean assignable )
- {
- this.assignable = assignable;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription( String description )
- {
- this.description = description;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public List<SimplePermission> getPermissions()
- {
- return permissions;
- }
-
- public void setPermissions( List<SimplePermission> permissions )
- {
- this.permissions = permissions;
- }
-
- public void setChildRoleNames( List<String> childRoleNames )
- {
- this.childRoleNames = childRoleNames;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.
- */
-
-/**
- * SimplePermission - this is a placeholder for information passed back
- * and forth between the Action and the Client.
- * <p/>
- * We intentionally do not hook up the actual object to prevent
- * creative injection of fields and values by the untrusted client.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class SimplePermission
-{
- private String name;
-
- private String operationName;
-
- private String resourceIdentifier;
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public String getOperationName()
- {
- return operationName;
- }
-
- public void setOperationName( String operationName )
- {
- this.operationName = operationName;
- }
-
- public String getResourceIdentifier()
- {
- return resourceIdentifier;
- }
-
- public void setResourceIdentifier( String resourceIdentifier )
- {
- this.resourceIdentifier = resourceIdentifier;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.model;
-
-/*
- * 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.users.User;
-import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.Serializable;
-
-/**
- * UserCredentials
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public abstract class UserCredentials
- implements Serializable
-{
- // Potentially Editable Field.
- private String username;
-
- // Editable Fields.
- private String password;
-
- private String confirmPassword;
-
- private String fullName;
-
- private String email;
-
- // Display Only Fields.
- private String timestampAccountCreation;
-
- private String timestampLastLogin;
-
- private String timestampLastPasswordChange;
-
- public User createUser( UserManager um )
- {
- User user = um.createUser( username, fullName, email );
-
- user.setPassword( password );
-
- return user;
- }
-
- public String toString()
- {
- StringBuffer sb = new StringBuffer();
-
- sb.append( "UserCredentials[" );
- sb.append( "username=" ).append( username );
- sb.append( ",fullName=" ).append( fullName );
- sb.append( ",email=" ).append( email );
- sb.append( ",password=" );
- if ( StringUtils.isNotEmpty( password ) )
- {
- sb.append( "<***>" );
- }
- else
- {
- sb.append( "<empty>" );
- }
- sb.append( ",confirmPassword=" );
- if ( StringUtils.isNotEmpty( confirmPassword ) )
- {
- sb.append( "<***>" );
- }
- else
- {
- sb.append( "<empty>" );
- }
-
- return sb.append( "]" ).toString();
- }
-
- public String getConfirmPassword()
- {
- return confirmPassword;
- }
-
- public void setConfirmPassword( String confirmPassword )
- {
- this.confirmPassword = confirmPassword;
- }
-
- public String getEmail()
- {
- return email;
- }
-
- public void setEmail( String email )
- {
- this.email = email;
- }
-
- public String getFullName()
- {
- return fullName;
- }
-
- public void setFullName( String fullName )
- {
- this.fullName = fullName;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword( String password )
- {
- this.password = password;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername( String username )
- {
- this.username = username;
- }
-
- public abstract boolean isEdit();
-
- public String getTimestampAccountCreation()
- {
- return timestampAccountCreation;
- }
-
- public String getTimestampLastLogin()
- {
- return timestampLastLogin;
- }
-
- public String getTimestampLastPasswordChange()
- {
- return timestampLastPasswordChange;
- }
-
- public void setTimestampAccountCreation( String timestampAccountCreation )
- {
- this.timestampAccountCreation = timestampAccountCreation;
- }
-
- public void setTimestampLastLogin( String timestampLastLogin )
- {
- this.timestampLastLogin = timestampLastLogin;
- }
-
- public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
- {
- this.timestampLastPasswordChange = timestampLastPasswordChange;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.reports;
-
-/*
- * 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.rbac.RBACManager;
-import org.apache.archiva.redback.rbac.RbacManagerException;
-import org.apache.archiva.redback.rbac.Role;
-import org.apache.archiva.redback.rbac.UserAssignment;
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.users.User;
-import org.codehaus.redback.integration.util.RoleSorter;
-import org.codehaus.redback.integration.util.UserComparator;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * CsvRolesMatrix
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "report#rolesmatrix-csv" )
-public class CsvRolesMatrix
- implements Report
-{
- @Inject
- private SecuritySystem securitySystem;
-
- @Inject
- @Named( value = "rBACManager#jdo" )
- private RBACManager rbacManager;
-
- public String getName()
- {
- return "Roles Matrix";
- }
-
- public String getType()
- {
- return "csv";
- }
-
- public void writeReport( OutputStream os )
- throws ReportException
- {
- UserManager userManager = securitySystem.getUserManager();
-
- List<User> allUsers = userManager.getUsers();
- List<Role> allRoles;
- Map<String, List<String>> assignmentsMap;
-
- try
- {
- allRoles = rbacManager.getAllRoles();
- Collections.sort( allRoles, new RoleSorter() );
-
- assignmentsMap = new HashMap<String, List<String>>();
-
- for ( UserAssignment assignment : rbacManager.getAllUserAssignments() )
- {
- assignmentsMap.put( assignment.getPrincipal(), assignment.getRoleNames() );
- }
- }
- catch ( RbacManagerException e )
- {
- throw new ReportException( "Unable to obtain list of all roles.", e );
- }
-
- Collections.sort( allUsers, new UserComparator( "username", true ) );
-
- PrintWriter out = new PrintWriter( os );
-
- writeCsvHeader( out, allRoles );
-
- for ( User user : allUsers )
- {
- writeCsvRow( out, user, assignmentsMap, allRoles );
- }
-
- out.flush();
- }
-
- private void writeCsvHeader( PrintWriter out, List<Role> allRoles )
- {
- out.print( "Username,Full Name,Email Address" );
- for ( Role role : allRoles )
- {
- out.print( "," + escapeCell( role.getName() ) );
- }
- out.println();
- }
-
- private void writeCsvRow( PrintWriter out, User user, Map<String, List<String>> assignmentsMap,
- List<Role> allRoles )
- {
- out.print( escapeCell( user.getUsername() ) );
- out.print( "," + escapeCell( user.getFullName() ) );
- out.print( "," + escapeCell( user.getEmail() ) );
-
- List<String> assignedRoleNames = assignmentsMap.get( user.getPrincipal().toString() );
- if ( assignedRoleNames == null )
- {
- assignedRoleNames = new ArrayList<String>();
- }
-
- for ( Role role : allRoles )
- {
- out.print( ',' );
- if ( assignedRoleNames.contains( role.getName() ) )
- {
- out.print( 'Y' );
- }
- }
- out.println();
- }
-
- private String escapeCell( String cell )
- {
- return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
- }
-
- public String getId()
- {
- return "rolesmatrix";
- }
-
- public String getMimeType()
- {
- return "text/csv";
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.reports;
-
-/*
- * 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.users.User;
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.integration.util.UserComparator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * CsvUserList
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "report#userlist-csv" )
-public class CsvUserList
- implements Report
-{
- private Logger log = LoggerFactory.getLogger( CsvUserList.class );
-
- @Inject
- private SecuritySystem securitySystem;
-
- private Map<String, String> fields;
-
- public CsvUserList()
- {
- fields = new HashMap<String, String>();
- fields.put( "username", "User Name" );
- fields.put( "fullName", "Full Name" );
- fields.put( "email", "Email Address" );
- fields.put( "permanent", "Permanent User" );
- fields.put( "locked", "Locked User" );
- fields.put( "validated", "Validated User" );
- fields.put( "passwordChangeRequired", "Must Change Password On Next Login" );
- fields.put( "countFailedLoginAttempts", "Failed Login Attempts" );
- fields.put( "lastPasswordChange", "Last Password Change" );
- fields.put( "accountCreationDate", "Date Created" );
- fields.put( "lastLoginDate", "Date Last Logged In" );
- }
-
- public String getId()
- {
- return "userlist";
- }
-
- public String getMimeType()
- {
- return "text/csv";
- }
-
- public String getName()
- {
- return "User List";
- }
-
- public String getType()
- {
- return "csv";
- }
-
- public void writeReport( OutputStream os )
- throws ReportException
- {
- UserManager userManager = securitySystem.getUserManager();
-
- List<User> allUsers = userManager.getUsers();
-
- Collections.sort( allUsers, new UserComparator( "username", true ) );
-
- PrintWriter out = new PrintWriter( os );
-
- writeCsvHeader( out );
-
- Iterator<User> itUsers = allUsers.iterator();
- while ( itUsers.hasNext() )
- {
- User user = (User) itUsers.next();
- writeCsvRow( out, user );
- }
-
- out.flush();
- }
-
- private void writeCsvHeader( PrintWriter out )
- {
- boolean hasPreviousField = false;
- for ( String heading : fields.values() )
- {
- if ( hasPreviousField )
- {
- out.print( "," );
- }
- out.print( escapeCell( heading ) );
- hasPreviousField = true;
- }
- out.println();
- }
-
- @SuppressWarnings( "unchecked" )
- private void writeCsvRow( PrintWriter out, User user )
- throws ReportException
- {
- try
- {
- boolean hasPreviousField = false;
- Map<String, Object> propMap = PropertyUtils.describe( user );
- for ( String propName : fields.keySet() )
- {
- Object propValue = propMap.get( propName );
-
- if ( hasPreviousField )
- {
- out.print( "," );
- }
-
- if ( propValue != null )
- {
- out.print( escapeCell( propValue.toString() ) );
- }
- hasPreviousField = true;
- }
- out.println();
- }
- catch ( IllegalAccessException e )
- {
- String emsg = "Unable to produce " + getName() + " report.";
- log.error( emsg, e );
- throw new ReportException( emsg, e );
- }
- catch ( InvocationTargetException e )
- {
- String emsg = "Unable to produce " + getName() + " report.";
- log.error( emsg, e );
- throw new ReportException( emsg, e );
- }
- catch ( NoSuchMethodException e )
- {
- String emsg = "Unable to produce " + getName() + " report.";
- log.error( emsg, e );
- throw new ReportException( emsg, e );
- }
- }
-
- private String escapeCell( String cell )
- {
- return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.reports;
-
-/*
- * 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.OutputStream;
-
-/**
- * Report
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public interface Report
-{
- /**
- * The Name of the Report (for display to the user)
- *
- * @return the name of the report.
- */
- String getName();
-
- /**
- * The type of report (example: 'csv', 'xls', 'pdf')
- * Used in the display of the report links to the user.
- *
- * @return the type of report.
- */
- String getType();
-
- /**
- * The mimetype of the report. (used to set download content type correctly)
- *
- * @return the mimetype.
- */
- String getMimeType();
-
- /**
- * The ID for this report.
- *
- * @return the ID for this report.
- */
- String getId();
-
- /**
- * Write Report to provided outputstream.
- *
- * @param os the outputstream to write to.
- * @throws ReportException if there was a problem in generating the report.
- */
- void writeReport( OutputStream os )
- throws ReportException;
-}
+++ /dev/null
-package org.codehaus.redback.integration.reports;
-
-/*
- * 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.
- */
-
-/**
- * ReportException
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ReportException
- extends Exception
-{
-
- public ReportException()
- {
- super();
- }
-
- public ReportException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public ReportException( String message )
- {
- super( message );
- }
-
- public ReportException( Throwable cause )
- {
- super( cause );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.reports;
-
-/*
- * 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.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * ReportManager
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service( "reportManager" )
-public class ReportManager
-{
-
- @Inject
- private List<Report> availableReports;
-
- @Inject
- private ApplicationContext applicationContext;
-
- private Map<String, Map<String, Report>> reportMap;
-
- public Report findReport( String id, String type )
- throws ReportException
- {
- if ( StringUtils.isBlank( id ) )
- {
- throw new ReportException( "Unable to generate report from empty report id." );
- }
-
- if ( StringUtils.isBlank( type ) )
- {
- throw new ReportException( "Unable to generate report from empty report type." );
- }
-
- Map<String, Report> typeMap = reportMap.get( id );
- if ( typeMap == null )
- {
- throw new ReportException( "Unable to find report id [" + id + "]" );
- }
-
- Report requestedReport = typeMap.get( type );
-
- if ( requestedReport == null )
- {
- throw new ReportException( "Unable to find report id [" + id + "] type [" + type + "]" );
- }
-
- return requestedReport;
- }
-
- public Map<String, Map<String, Report>> getReportMap()
- {
- return Collections.unmodifiableMap( reportMap );
- }
-
- @SuppressWarnings( "unchecked" )
- @PostConstruct
- public void initialize()
- {
- reportMap = new HashMap<String, Map<String, Report>>();
-
- for ( Report report : availableReports )
- {
- Map<String, Report> typeMap = reportMap.get( report.getId() );
- if ( typeMap == null )
- {
- typeMap = new HashMap<String, Report>();
- }
-
- typeMap.put( report.getType(), report );
- reportMap.put( report.getId(), typeMap );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.role;
-
-/*
- * 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.integration.security.role.RedbackRoleConstants;
-
-/**
- * RoleConstants:
- *
- * @author: Jesse McConnell <jesse@codehaus.org>
- * @version: $Id$
- * @deprecated use {@link RedbackRoleConstants}
- */
-public class RoleConstants
-{
- public static final String ADMINISTRATOR_ACCOUNT_NAME = RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME;
-
- // roles
- public static final String SYSTEM_ADMINISTRATOR_ROLE = RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE;
-
- public static final String USER_ADMINISTRATOR_ROLE = RedbackRoleConstants.USER_ADMINISTRATOR_ROLE;
-
- public static final String REGISTERED_USER_ROLE = RedbackRoleConstants.REGISTERED_USER_ROLE;
-
- public static final String GUEST_ROLE = RedbackRoleConstants.GUEST_ROLE;
-
- // guest access operation
- public static final String GUEST_ACCESS_OPERATION = RedbackRoleConstants.GUEST_ACCESS_OPERATION;
-
- // operations against configuration
- public static final String CONFIGURATION_EDIT_OPERATION = RedbackRoleConstants.CONFIGURATION_EDIT_OPERATION;
-
- // operations against user
- public static final String USER_MANAGEMENT_USER_CREATE_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION;
-
- public static final String USER_MANAGEMENT_USER_EDIT_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION;
-
- public static final String USER_MANAGEMENT_USER_ROLE_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION;
-
- public static final String USER_MANAGEMENT_USER_DELETE_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION;
-
- public static final String USER_MANAGEMENT_USER_LIST_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION;
-
- // operations against user assignment.
- public static final String USER_MANAGEMENT_ROLE_GRANT_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION;
-
- public static final String USER_MANAGEMENT_ROLE_DROP_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION;
-
- // operations against rbac objects.
- public static final String USER_MANAGEMENT_RBAC_ADMIN_OPERATION =
- RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION;
-
- public static final String USER_MANAGEMENT_MANAGE_DATA = RedbackRoleConstants.USER_MANAGEMENT_MANAGE_DATA;
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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 javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-
-/**
- * IfAuthorizedTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class ElseAuthorizedTag
- extends ConditionalTagSupport
-{
- protected boolean condition()
- throws JspTagException
- {
- Boolean authzStatus = (Boolean) pageContext.getAttribute( "ifAuthorizedTag" );
-
- if ( authzStatus != null )
- {
- pageContext.removeAttribute( "ifAuthorizedTag" );
-
- return !authzStatus.booleanValue();
- }
-
- authzStatus = (Boolean) pageContext.getAttribute( "ifAnyAuthorizedTag" );
-
- if ( authzStatus != null )
- {
- pageContext.removeAttribute( "ifAnyAuthorizedTag" );
-
- return !authzStatus.booleanValue();
- }
-
- throw new JspTagException( "ElseAuthorizedTag should follow either IfAuthorized or IfAnyAuthorized" );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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.authorization.AuthorizationException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-import java.util.StringTokenizer;
-
-/**
- * IfAnyAuthorizedTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class IfAnyAuthorizedTag
- extends ConditionalTagSupport
-{
- /**
- * comma delimited list of permissions to check
- */
- private String permissions;
-
- private String resource;
-
- public void setPermissions( String permissions )
- {
- this.permissions = permissions;
- }
-
- public void setResource( String resource )
- {
- this.resource = resource;
- }
-
- protected boolean condition()
- throws JspTagException
- {
- ApplicationContext applicationContext =
- WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
-
- SecuritySession securitySession =
- (SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
-
- try
- {
- final SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
- if ( securitySystem == null )
- {
- throw new JspTagException( "unable to locate the security system" );
- }
-
- StringTokenizer strtok = new StringTokenizer( permissions, "," );
-
- while ( strtok.hasMoreTokens() )
- {
- String permission = strtok.nextToken().trim();
-
- if ( securitySystem.isAuthorized( securitySession, permission, resource ) )
- {
- return true;
- }
- }
- }
- catch ( AuthorizationException ae )
- {
- throw new JspTagException( "error with authorization", ae );
- }
-
- return false;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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.authorization.AuthorizationException;
-import org.apache.archiva.redback.system.SecuritySession;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-
-/**
- * IfAuthorizedTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class IfAuthorizedTag
- extends ConditionalTagSupport
-{
- private String permission;
-
- private String resource;
-
- public void setPermission( String permission )
- {
- this.permission = permission;
- }
-
- public void setResource( String resource )
- {
- this.resource = resource;
- }
-
- protected boolean condition()
- throws JspTagException
- {
- ApplicationContext applicationContext =
- WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
-
- Boolean authzStatusBool = (Boolean) pageContext.getAttribute( "redbackCache" + permission + resource );
- boolean authzStatus;
-
- //long execTime = System.currentTimeMillis();
-
- if ( authzStatusBool == null )
- {
- SecuritySession securitySession =
- (SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
-
- try
- {
- SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
- if ( securitySystem == null )
- {
- throw new JspTagException( "unable to locate security system" );
- }
-
- authzStatus = securitySystem.isAuthorized( securitySession, permission, resource );
- pageContext.setAttribute( "redbackCache" + permission + resource, Boolean.valueOf( authzStatus ) );
- }
- catch ( AuthorizationException ae )
- {
- throw new JspTagException( "error with authorization", ae );
- }
-
- //System.out.println( "[PERF] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
- }
- else
- {
- authzStatus = authzStatusBool.booleanValue();
- //System.out.println( "[PERF][Cached] " + "redbackCache" + permission + resource + " Time: " + (System.currentTimeMillis() - execTime) );
- }
-
- pageContext.setAttribute( "ifAuthorizedTag", Boolean.valueOf( authzStatus ) );
- return authzStatus;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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.configuration.UserConfiguration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-
-/**
- * IfConfiguredTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class IfConfiguredTag
- extends ConditionalTagSupport
-{
- private String option;
-
- private String value;
-
- public void setOption( String option )
- {
- this.option = option;
- }
-
- public void setValue( String value )
- {
- this.value = value;
- }
-
- protected boolean condition()
- throws JspTagException
- {
- ApplicationContext applicationContext =
- WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
-
- UserConfiguration config = applicationContext.getBean( "userConfiguration", UserConfiguration.class );
-
- if ( value != null )
- {
- String configValue = config.getString( option );
-
- if ( value.equals( configValue ) )
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- else
- {
- return config.getBoolean( option );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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.users.UserManager;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-
-/**
- * IsReadOnlyUserManagerTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class IsNotReadOnlyUserManagerTag
- extends ConditionalTagSupport
-{
- protected boolean condition()
- throws JspTagException
- {
- ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
-
- UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
- if (config == null)
- {
- throw new JspTagException( "unable to locate security system" );
- }
-
- return !config.isReadOnly();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.taglib.jsp;
-
-/*
- * 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.users.UserManager;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.jsp.JspTagException;
-import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
-
-/**
- * IsReadOnlyUserManagerTag:
- *
- * @author Jesse McConnell <jesse@codehaus.org>
- * @version $Id$
- */
-public class IsReadOnlyUserManagerTag
- extends ConditionalTagSupport
-{
- protected boolean condition()
- throws JspTagException
- {
- ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext());
- UserManager config = applicationContext.getBean( "userManager#configurable" , UserManager.class );
- if (config == null)
- {
- throw new JspTagException( "unable to locate security system" );
- }
-
- return config.isReadOnly();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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 javax.annotation.Resource;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.archiva.redback.keys.AuthenticationKey;
-import org.apache.archiva.redback.keys.KeyManager;
-import org.apache.archiva.redback.keys.KeyManagerException;
-import org.apache.archiva.redback.keys.KeyNotFoundException;
-import org.apache.archiva.redback.policy.CookieSettings;
-import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.plexus.util.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-/**
- * AutoLoginCookies
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-@Service("autoLoginCookies")
-public class AutoLoginCookies
-{
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- @Resource
- private SecuritySystem securitySystem;
-
- /**
- * Cookie key for the Remember Me functionality.
- */
- private static final String REMEMBER_ME_KEY = "rbkRememberMe";
-
- /**
- * Cookie key for the signon cookie.
- */
- private static final String SIGNON_KEY = "rbkSignon";
-
- public AuthenticationKey getRememberMeKey(HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- if ( !isRememberMeEnabled() )
- {
- return null;
- }
-
- Cookie rememberMeCookie = getCookie( httpServletRequest, REMEMBER_ME_KEY );
-
- if ( rememberMeCookie == null )
- {
- log.debug( "Remember Me Cookie Not Found: {}", REMEMBER_ME_KEY );
- return null;
- }
-
- // Found user with a remember me key.
- String providedKey = rememberMeCookie.getValue();
-
- log.debug( "Found remember me cookie : {}", providedKey );
-
- CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
- return findAuthKey( REMEMBER_ME_KEY, providedKey, settings.getDomain(), settings.getPath(), httpServletResponse, httpServletRequest );
- }
-
- public void setRememberMeCookie( String principal, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- if ( !isRememberMeEnabled() )
- {
- return;
- }
-
- try
- {
- CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
- int timeout = settings.getCookieTimeout();
- KeyManager keyManager = securitySystem.getKeyManager();
- AuthenticationKey authkey = keyManager.createKey( principal, "Remember Me Key", timeout );
-
- Cookie cookie = createCookie( REMEMBER_ME_KEY, authkey.getKey(), settings.getDomain(), settings.getPath(), httpServletRequest );
- if ( timeout > 0 )
- {
- cookie.setMaxAge( timeout );
- }
- httpServletResponse.addCookie( cookie );
-
- }
- catch ( KeyManagerException e )
- {
- log.warn( "Unable to set remember me cookie." );
- }
- }
-
- public void removeRememberMeCookie( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- CookieSettings settings = securitySystem.getPolicy().getRememberMeCookieSettings();
- removeCookie( httpServletResponse, httpServletRequest, REMEMBER_ME_KEY, settings.getDomain(), settings.getPath() );
- }
-
- public AuthenticationKey getSignonKey( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- Cookie ssoCookie = getCookie( httpServletRequest, SIGNON_KEY );
-
- if ( ssoCookie == null )
- {
- log.debug( "Single Sign On Cookie Not Found: {}", SIGNON_KEY );
- return null;
- }
-
- // Found user with a single sign on key.
-
- String providedKey = ssoCookie.getValue();
-
- log.debug( "Found sso cookie : {}", providedKey );
-
- CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
- return findAuthKey( SIGNON_KEY, providedKey, settings.getDomain(), settings.getPath(), httpServletResponse, httpServletRequest );
- }
-
- public void setSignonCookie( String principal, HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- try
- {
- CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
- int timeout = settings.getCookieTimeout();
- KeyManager keyManager = securitySystem.getKeyManager();
- AuthenticationKey authkey = keyManager.createKey( principal, "Signon Session Key", timeout );
-
- /* The path must remain as "/" in order for SSO to work on installations where the only
- * all of the servers are installed into the same web container but under different
- * web contexts.
- */
- Cookie cookie = createCookie( SIGNON_KEY, authkey.getKey(), settings.getDomain(), settings.getPath(), httpServletRequest );
- if ( timeout > 0 )
- {
- cookie.setMaxAge( timeout );
- }
- httpServletResponse.addCookie( cookie );
-
- }
- catch ( KeyManagerException e )
- {
- log.warn( "Unable to set single sign on cookie." );
-
- }
- }
-
- public void removeSignonCookie( HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- CookieSettings settings = securitySystem.getPolicy().getSignonCookieSettings();
- removeCookie( httpServletResponse, httpServletRequest, SIGNON_KEY, settings.getDomain(), settings.getPath() );
- }
-
- private static String getWebappContext( HttpServletRequest httpRequest )
- {
- // Calculate the webapp context.
- String webappContext = httpRequest.getContextPath();
-
- if ( StringUtils.isEmpty( webappContext ) )
- {
- // Still empty? means you are a root context.
- webappContext = "/";
- }
-
- return webappContext;
- }
-
- public boolean isRememberMeEnabled()
- {
- return securitySystem.getPolicy().getRememberMeCookieSettings().isEnabled();
- }
-
- private AuthenticationKey findAuthKey( String cookieName, String providedKey, String domain, String path,
- HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest )
- {
- try
- {
- AuthenticationKey authkey = securitySystem.getKeyManager().findKey( providedKey );
-
- log.debug( "Found AuthKey: {}", authkey );
-
- return authkey;
- }
- catch ( KeyNotFoundException e )
- {
- log.info( "Invalid AuthenticationKey {} submitted. Invalidating cookie.", providedKey );
-
- // Invalid Cookie. Remove it.
- removeCookie( httpServletResponse, httpServletRequest, cookieName, domain, path );
- }
- catch ( KeyManagerException e )
- {
- log.error( "KeyManagerException: " + e.getMessage(), e );
- }
-
- return null;
- }
-
- private static Cookie getCookie( HttpServletRequest request, String name )
- {
- Cookie[] cookies = request.getCookies();
-
- Cookie cookie = null;
- if ( cookies != null && !StringUtils.isEmpty( name ) )
- {
- for ( int i = 0; i < cookies.length && cookie == null; i++ )
- {
- if ( StringUtils.equals( name, cookies[i].getName() ) )
- {
- cookie = cookies[i];
- }
- }
- }
-
- return cookie;
- }
-
- private static void removeCookie( HttpServletResponse response, HttpServletRequest httpRequest, String cookieName, String domain, String path )
- {
- Cookie cookie = createCookie( cookieName, "", domain, path, httpRequest );
- cookie.setMaxAge( 0 );
- response.addCookie( cookie );
- }
-
- private static Cookie createCookie( String cookieName, String value, String domain, String path, HttpServletRequest httpRequest )
- {
- Cookie cookie = new Cookie( cookieName, value );
- if ( domain != null )
- {
- cookie.setDomain( domain );
- }
- if ( path != null )
- {
- cookie.setPath( path );
- }
- else
- {
- // default to the context path, otherwise you get /security and such in some places
- cookie.setPath( getWebappContext( httpRequest ) );
- }
- return cookie;
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-/**
- * DateUtils
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class DateUtils
-{
- /**
- * Provided a date you will get a timestamp and the age/old that you want
- *
- * @param date the date to compare to now.
- * @param suffix the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
- * @return the formated string.
- */
- public static String formatWithAge( Date date, String suffix )
- {
- return formatWithAge( date, "EEE, d MMM yyyy HH:mm:ss Z", suffix );
- }
-
- /**
- * Provided a date you will get a timestamp and the age/old that you want.
- *
- * @param date the date to compare to now.
- * @param dateFormat the {@link SimpleDateFormat} format string to use for the date.
- * @param suffix the suffix in the age string. using "ago" here would result in "2006 Aug 23, 11:43 pm - 12 days ago"
- * @return the formated string.
- */
- public static String formatWithAge( Date date, String dateFormat, String suffix )
- {
- if ( date == null )
- {
- return null;
- }
-
- SimpleDateFormat format = new SimpleDateFormat( dateFormat );
-
- StringBuffer out = new StringBuffer();
- out.append( format.format( date ) );
- out.append( " - " );
-
- Calendar now = Calendar.getInstance();
- Calendar then = Calendar.getInstance();
- then.setTime( date );
-
- long diffMillis = now.getTimeInMillis() - then.getTimeInMillis();
-
- long days = diffMillis / ( 24 * 60 * 60 * 1000 );
- long hours = diffMillis / ( 60 * 60 * 1000 );
- long minutes = diffMillis / ( 60 * 1000 );
- long seconds = diffMillis / ( 1000 );
-
- if ( days > 0 )
- {
- out.append( String.valueOf( days ) ).append( " day" );
- if ( days > 1 )
- {
- out.append( 's' );
- }
- }
- else if ( hours > 0 )
- {
- out.append( String.valueOf( hours ) ).append( " hour" );
- if ( hours > 1 )
- {
- out.append( 's' );
- }
- }
- else if ( minutes > 0 )
- {
- out.append( String.valueOf( minutes ) ).append( " minute" );
- if ( minutes > 1 )
- {
- out.append( 's' );
- }
- }
- else if ( seconds > 0 )
- {
- out.append( String.valueOf( seconds ) ).append( " second" );
- if ( seconds > 1 )
- {
- out.append( 's' );
- }
- }
-
- out.append( ' ' ).append( suffix );
-
- return out.toString();
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.codehaus.plexus.redback.role.model.ModelTemplate;
-
-/**
- * ModelTemplateSorter
- *
- * @author <a href="mailto:hisidro@exist.com">Henry Isidro</a>
- * @version $Id$
- */
-public class ModelTemplateSorter
- implements Comparator<ModelTemplate>
-{
- public int compare( ModelTemplate template1, ModelTemplate template2 )
- {
- if ( ( template1 == null ) && ( template2 == null ) )
- {
- return 0;
- }
-
- if ( ( template1 == null ) && ( template2 != null ) )
- {
- return -1;
- }
-
- if ( ( template1 != null ) && ( template2 == null ) )
- {
- return 1;
- }
-
- return template1.getNamePrefix().compareToIgnoreCase( template2.getNamePrefix() );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.rbac.Operation;
-
-/**
- * OperationSorter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class OperationSorter
- implements Comparator<Operation>
-{
-
- public int compare( Operation o1, Operation o2 )
- {
- if ( ( o1 == null ) && ( o2 == null ) )
- {
- return 0;
- }
-
- if ( ( o1 == null ) && ( o2 != null ) )
- {
- return -1;
- }
-
- if ( ( o1 != null ) && ( o2 == null ) )
- {
- return 1;
- }
-
- return o1.getName().compareToIgnoreCase( o2.getName() );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.rbac.Permission;
-
-/**
- * PermissionSorter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class PermissionSorter
- implements Comparator<Permission>
-{
-
- public int compare( Permission p1, Permission p2 )
- {
- if ( ( p1 == null ) && ( p2 == null ) )
- {
- return 0;
- }
-
- if ( ( p1 == null ) && ( p2 != null ) )
- {
- return -1;
- }
-
- if ( ( p1 != null ) && ( p2 == null ) )
- {
- return 1;
- }
-
- return p1.getName().compareToIgnoreCase( p2.getName() );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.rbac.Resource;
-
-/**
- * ResourceSorter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class ResourceSorter
- implements Comparator<Resource>
-{
-
- public int compare( Resource r1, Resource r2 )
- {
- if ( ( r1 == null ) && ( r2 == null ) )
- {
- return 0;
- }
-
- if ( ( r1 == null ) && ( r2 != null ) )
- {
- return -1;
- }
-
- if ( ( r1 != null ) && ( r2 == null ) )
- {
- return 1;
- }
-
- return r1.getIdentifier().compareToIgnoreCase( r2.getIdentifier() );
- }
-
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.rbac.Role;
-
-/**
- * RoleSorter
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RoleSorter
- implements Comparator<Role>
-{
- public int compare( Role role1, Role role2 )
- {
- if ( ( role1 == null ) && ( role2 == null ) )
- {
- return 0;
- }
-
- if ( ( role1 == null ) && ( role2 != null ) )
- {
- return -1;
- }
-
- if ( ( role1 != null ) && ( role2 == null ) )
- {
- return 1;
- }
-
- return role1.getName().compareToIgnoreCase( role2.getName() );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.rbac.TemplatedRole;
-
-/**
- * TemplatedRoleSorter
- *
- * @author <a href="hisidro@exist.com">Henry Isidro</a>
- * @version $Id$
- */
-public class TemplatedRoleSorter
- implements Comparator<TemplatedRole>
-{
- public int compare( TemplatedRole r1, TemplatedRole r2 )
- {
- if ( ( r1 == null ) && ( r2 == null ) )
- {
- return 0;
- }
-
- if ( ( r1 == null ) && ( r2 != null ) )
- {
- return -1;
- }
-
- if ( ( r1 != null ) && ( r2 == null ) )
- {
- return 1;
- }
-
- if ( r1.getResource().equals( r2.getResource() ) )
- {
- return r1.getTemplateNamePrefix().compareTo( r2.getTemplateNamePrefix() );
- }
- else
- {
- return r1.getResource().compareToIgnoreCase( r2.getResource() );
- }
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.util;
-
-/*
- * 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.util.Comparator;
-
-import org.apache.archiva.redback.users.User;
-
-/**
- * UserComparator
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class UserComparator
- implements Comparator<User>
-{
- private static final int UNKNOWN = -1;
-
- private static final int USERNAME = 1;
-
- private static final int FULLNAME = 2;
-
- private static final int EMAIL = 3;
-
- private static final int VALIDATED = 4;
-
- private static final int LOCKED = 5;
-
- private static final int PERMANENT = 6;
-
- private int propKey = UNKNOWN;
-
- private boolean ascending;
-
- public UserComparator( String property, boolean ascending )
- {
- this.ascending = ascending;
-
- if ( "username".equals( property ) )
- {
- propKey = USERNAME;
- }
- else if ( "fullName".equals( property ) )
- {
- propKey = FULLNAME;
- }
- else if ( "email".equals( property ) )
- {
- propKey = EMAIL;
- }
- else if ( "validated".equals( property ) )
- {
- propKey = VALIDATED;
- }
- else if ( "locked".equals( property ) )
- {
- propKey = LOCKED;
- }
- else if ( "permanent".equals( property ) )
- {
- propKey = PERMANENT;
- }
- }
-
- public int compare( User user1, User user2 )
- {
- if ( ( user1 == null ) && ( user2 == null ) )
- {
- return 0;
- }
-
- if ( ( user1 == null ) && ( user2 != null ) )
- {
- return -1;
- }
-
- if ( ( user1 != null ) && ( user2 == null ) )
- {
- return 1;
- }
-
- return compareUsers( user1, user2 ) * ( ascending ? 1 : -1 );
- }
-
- private int compareUsers( User u1, User u2 )
- {
- switch ( propKey )
- {
- case USERNAME:
- return compareStrings( u1.getUsername(), u2.getUsername() );
- case FULLNAME:
- return compareStrings( u1.getFullName(), u2.getFullName() );
- case EMAIL:
- return compareStrings( u1.getEmail(), u2.getEmail() );
- case VALIDATED:
- return compareBooleans( u1.isValidated(), u2.isValidated() );
- case LOCKED:
- return compareBooleans( u1.isLocked(), u2.isLocked() );
- case PERMANENT:
- return compareBooleans( u1.isPermanent(), u2.isPermanent() );
- default:
- return 0;
-
- }
- }
-
- private int compareStrings( String s1, String s2 )
- {
- if ( ( s1 == null ) && ( s2 == null ) )
- {
- return 0;
- }
-
- if ( ( s1 == null ) && ( s2 != null ) )
- {
- return -1;
- }
-
- if ( ( s1 != null ) && ( s2 == null ) )
- {
- return 1;
- }
-
- return s1.toLowerCase().compareTo( s2.toLowerCase() );
- }
-
- private int compareBooleans( boolean b1, boolean b2 )
- {
- if ( b1 == b2 )
- {
- return 0;
- }
-
- return ( b1 ) ? 1 : -1;
- }
-}
default-lazy-init="true">
<context:annotation-config />
- <context:component-scan base-package="org.codehaus.redback.integration"/>
+ <context:component-scan base-package="org.apache.archiva.redback.integration"/>
<bean name="velocityEngine#redback" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<tag>
<name>ifConfigured</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.IfConfiguredTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.IfConfiguredTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>option</name>
<tag>
<name>isReadOnlyUserManager</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.IsReadOnlyUserManagerTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.IsReadOnlyUserManagerTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<name>isNotReadOnlyUserManager</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.IsNotReadOnlyUserManagerTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.IsNotReadOnlyUserManagerTag</tag-class>
<body-content>JSP</body-content>
</tag>
<tag>
<name>ifAuthorized</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.IfAuthorizedTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.IfAuthorizedTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>permission</name>
<tag>
<name>ifAnyAuthorized</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.IfAnyAuthorizedTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.IfAnyAuthorizedTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>permissions</name>
<tag>
<name>elseAuthorized</name>
- <tag-class>org.codehaus.redback.integration.taglib.jsp.ElseAuthorizedTag</tag-class>
+ <tag-class>org.apache.archiva.redback.integration.taglib.jsp.ElseAuthorizedTag</tag-class>
<body-content>JSP</body-content>
</tag>
--- /dev/null
+# 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.
+
+# --------------------------------------------------
+# Classes Section
+#
+# General - These are localizations that are used by multiple classes.
+# If you can't find the text under each class, you can find it here.
+# --------------------------------------------------
+username.required=User Name is required.
+username.has.spaces=User Name can not have spaces.
+password.confimation.failed=Password confirmation failed. Passwords do not match.
+password.provided.does.not.match.existing=Password provided does not match existing.
+old.password.required=Current password is required.
+user.admin.password.required=User admin password is required when updating a user account. Please provide your password to validate identification.
+user.admin.password.does.not.match.existing=The password you provided does not match your existing password.
+user.does.not.exist=User ''{0}'' does not exist.
+user.not.found.exception=There was an error looking for the user ''{0}'': {1}
+save.role.success=Successfully Saved Role ''{0}''
+cannot.get.role=Unable to get Role ''{0}'': {1}
+invalid.user.credentials=Invalid user credentials.
+user.already.exists=User ''{0}'' already exists.
+cannot.edit.user.null.username=Unable to edit user with null username.
+cannot.edit.user.empty.username=Unable to edit user with empty username.
+cannot.get.user=Unable to get User ''{0}'': {1}
+cannot.edit.user.null.credentials=Unable to edit user with null user credentials.
+cannot.operate.on.null.user=Unable to operate on null user.
+user.not.found=User not found.
+
+# --------------------------------------------------
+# AbstractUserCredentialsAction
+# --------------------------------------------------
+fullName.required=Full Name is required.
+email.required=Email Address is required.
+email.invalid=Email Address is invalid.
+password.required=Password is required.
+passwords.does.not.match=Passwords do not match.
+username.invalid.characters=Invalid characters found in Username.
+fullName.invalid.characters=Invalid characters found in Full Name.
+
+# --------------------------------------------------
+# AccountAction
+# --------------------------------------------------
+cannot.show.account.login.required=Unable to show your account. Not logged in.
+
+# --------------------------------------------------
+# LoginAction
+# --------------------------------------------------
+reset.password.missing=Reset Password key missing.
+cannot.find.key=Unable to find the key.
+cannot.find.key.at.the.moment=Unable to process key at this time. Please try again later.
+cannot.find.user=Unable to find user.
+validation.failure.key.missing=Validation failure key missing.
+incorrect.username.password=You have entered an incorrect username and/or password.
+account.validation.required=You have entered an incorrect username and/or password.
+authentication.failed=Authentication failed.
+authentication.exception=There was an error in the authentication process: {0}
+account.locked=Your Account is Locked.
+login.already.logged.in=You are already logged in.
+
+# --------------------------------------------------
+# PasswordAction
+# --------------------------------------------------
+newPassword.cannot.be.empty=New Password cannot be empty.
+cannot.update.user.not.found=Unable to update user ''{0}'' not found.
+admin.deleted.account=Likely occurs because an Administrator deleted your account.
+
+# --------------------------------------------------
+# PasswordResetAction
+# --------------------------------------------------
+username.cannot.be.empty=Username cannot be empty.
+password.reset.success=If the user was found, a message has been sent.
+password.reset.failure=If the user was found, a message has been sent.
+password.reset.email.generation.failure=Internal system error prevented generation of Password reset email.
+password.previous.empty=Previous password cannot be empty.
+password.empty=Password cannot be empty.
+password.confirmation.empty=Password confirmation cannot be empty.
+password.confirmation.same="password and password confirmation must be the same.
+
+# --------------------------------------------------
+# RegisterAction
+# --------------------------------------------------
+assign.role.failure=Unable to assign core register user role to new user.
+cannot.register.user=Unable to process new user registration request.
+
+# --------------------------------------------------
+# AddAdminUserAction
+# --------------------------------------------------
+invalid.admin.credentials=Invalid admin credentials, try again.
+admin.user.already.exists=Admin User exists in database (someone else probably created the user before you).
+cannot.assign.admin.role=Unable to assign system administrator role.
+
+# --------------------------------------------------
+# AssignmentsAction
+# --------------------------------------------------
+rbac.edit.user.empty.principal=Cannot use AssignmentsAction for RBAC Edit User with an empty principal.
+error.adding.selected.roles=Error adding the selected roles: {0}
+error.removing.selected.roles=Error removing the selected roles: {0}
+
+# --------------------------------------------------
+# EditRoleAction
+# --------------------------------------------------
+cannot.edit.null.role=Unable to edit null role name.
+cannot.edit.empty.role=Unable to edit empty role name.
+cannot.operate.null.role=Unable to operate on null role.
+
+# --------------------------------------------------
+# OperationsAction
+# --------------------------------------------------
+cannot.list.all.operations=Unable to list all operations: {0}
+cannot.save.operation=Unable to save operation: {0}.
+cannot.remove.operation=Unable to remove operation ''{0}''.
+
+# --------------------------------------------------
+# PermissionsAction
+# --------------------------------------------------
+cannot.list.all.permissions=Unable to list all permissions: {0}
+cannot.edit.null.permission=Unable to edit null permission name.
+cannot.edit.empty.permission=Unable to edit empty permission name.
+cannot.operate.null.permission=Unable to operate on null permission.
+cannot.get.permission=Unable to get Permission ''{0}'': {1}
+save.permission.success=Successfully Saved Permission ''{0}''
+
+# --------------------------------------------------
+# ReportAction
+# --------------------------------------------------
+cannot.get.report=Unable to find report: {0}
+cannot.generate.report=Unable to generate report.
+
+# --------------------------------------------------
+# ResourcesAction
+# --------------------------------------------------
+cannot.list.all.resources=Unable to list all resources: {0}
+cannot.save.resource=Unable to save resource: {0}
+cannot.remove.resource=Unable to locate resource to remove ''{0}''
+
+# --------------------------------------------------
+# RoleCreateAction
+# --------------------------------------------------
+cannot.add.null.permission=Unable to add null permission.
+cannot.add.empty.role=Unable to create role with empty name.
+roleName.invalid.characters=Invalid characters found in role name.
+
+# --------------------------------------------------
+# RolesAction
+# --------------------------------------------------
+cannot.list.all.roles=Unable to list all roles: {0}
+
+# --------------------------------------------------
+# UserDeleteAction
+# --------------------------------------------------
+cannot.remove.user.null.username=Unable to delete user based on null username.
+cannot.remove.user.empty.username=Unable to delete user based on empty username.
+cannot.remove.user.not.found=Unable to locate user {0} to delete.
+cannot.remove.user.role=Unable to remove user role assignments for ''{0}'' because {1}
+cannot.remove.user.non.existent=Unable to delete non-existent user ''{0}''
+
+# --------------------------------------------------
+# JSP Section
+#
+# General - These are localizations that are used by multiple JSPs.
+# If you can't find the text under each JSP, you can find it here.
+# --------------------------------------------------
+username=Username
+full.name=Full Name
+email=Email
+email.address=Email Address
+password=Password
+current.password=Current Password
+new.password=New Password
+confirm.password=Confirm Password
+user.admin.password=Password
+register=Register
+login=Login
+logout=Logout
+submit=Submit
+remove=Remove
+delete=Delete
+update=Update
+search=Search
+cancel=Cancel
+goback=Go Back
+edit=Edit
+save=Save
+name=Name
+description=Description
+role.name=Role Name
+role.description=Role Description
+remove.selected.roles=Remove Selected Roles
+role=Role
+roles=Roles
+effective.roles=Effective Roles
+permissions=Permissions
+operations=Operations
+resources=Resources
+
+# --------------------------------------------------
+# accessDenied
+# --------------------------------------------------
+access.denied.page.title=Security Alert - Access Denied
+access.denied.section.title=Security Alert - Access Denied
+access.denied.message=The action you attempted requires permissions that you do not have.<br>Please contact your administrator to be granted the appropriate permissions.
+
+# --------------------------------------------------
+# invalid token (for CSRF)
+# --------------------------------------------------
+invalid.token.page.title=Security Alert - Invalid Token Found
+invalid.token.section.title=Security Alert - Invalid Token Found
+invalid.token.message=Possible CSRF attack detected! Invalid token found in the request.
+
+# --------------------------------------------------
+# account
+# --------------------------------------------------
+account.details.page.title=Account Details
+account.details.section.title=Account Details
+
+# --------------------------------------------------
+# alert
+# --------------------------------------------------
+alert.page.title=Security Alert Page
+alert.message=You are not authorized for this activity.
+
+# --------------------------------------------------
+# generalError
+# --------------------------------------------------
+general.error.page.title=Error Occurred
+general.error.section.title=Error Occurred
+
+# --------------------------------------------------
+# login
+# --------------------------------------------------
+login.page.title=Login Page
+login.section.title=Login
+login.remember.me=Remember Me
+login.need.an.account=Need an Account?
+login.register=Register!
+login.forgot.your.password=Forgot your Password?
+login.request.password.reset=Request a password reset.
+
+# --------------------------------------------------
+# password
+# --------------------------------------------------
+password.page.title=Change Password
+password.section.title=Change Password
+password.existing=Existing Password
+password.new=New Password
+password.new.confirm=Confirm New Password
+password.change=Change Password
+
+# --------------------------------------------------
+# passwordResetNotification
+# --------------------------------------------------
+password.reset.page.title=Password Reset
+password.reset.message=Password Reset Successful.
+password.reset.go.to=Go to
+
+# --------------------------------------------------
+# register
+# --------------------------------------------------
+register.page.title=Registration Page
+register.section.title=Register for an Account
+
+# --------------------------------------------------
+# requestPasswordReset
+# --------------------------------------------------
+request.password.reset.page.title=Request Password Reset
+request.password.reset.section.title=Request Password Reset
+request.password.reset=Request Reset
+
+# --------------------------------------------------
+# requiresAuthentication
+# --------------------------------------------------
+requires.authentication.page.title=Security Alert - Action Requires Authentication
+requires.authentication.section.title=Security Alert - Action Requires Authentication
+requires.authentication.message=The action you attempted requires that you authenticate yourself.
+requires.authentication.go.ahead=Go Ahead
+
+# --------------------------------------------------
+# validationNotification
+# --------------------------------------------------
+validation.notification.page.title=Validation Notification Page
+validation.notification.section.title=Validation Reminder
+validation.notification.message.1=A validation email has been sent to the email address you provided ({0}). Please check for the email validation link sent to you.
+validation.notification.message.2=This account ({0}) will remain locked until it is validated.
+
+# --------------------------------------------------
+# grantRoles
+# --------------------------------------------------
+grant=Grant
+
+# --------------------------------------------------
+# securityLinks
+# --------------------------------------------------
+current.user=Current User:
+unknown.user=Unknown User
+edit.details=Edit Details
+notify.password.expiration=Password will expire on
+
+# --------------------------------------------------
+# userCredentials
+# --------------------------------------------------
+account.creation=Account Creation
+last.login=Last Login
+last.password.change=Last Password Change
+
+# --------------------------------------------------
+# assignments
+# --------------------------------------------------
+assignments.page.title=[Admin] User Edit
+assignments.section.title=[Admin] User Roles
+assignments.no.roles=No Roles Assigned (yet)
+assignments.available.roles=Available Roles:
+assignments.assigned.roles=Assigned Roles:
+assignments.resource.roles=Resource Roles:
+assignments.submit=Submit
+assignments.reset=Reset
+assignments.add.roles=Add Selected Roles
+assignments.remove.roles=Remove Selected Roles
+assignments.no.roles.to.grant=No Roles Available to Grant
+
+# --------------------------------------------------
+# createAdmin
+# --------------------------------------------------
+create.admin.page.title=Create Admin User
+create.admin.page.link=Create Admin User
+create.admin.section.title=Create Admin User
+create.admin=Create Admin
+
+# --------------------------------------------------
+# operationList
+# --------------------------------------------------
+operation.list.page.title=[Admin] Operation List
+operation.list.section.title=[Admin] Operation List
+operation.list.no.operations.available=No Operations Available
+
+# --------------------------------------------------
+# permissionList
+# --------------------------------------------------
+permission.list.page.title=[Admin] Permission List
+permission.list.section.title=[Admin] Permission List
+permission.list.no.permissions.available=No Permissions Available
+
+# --------------------------------------------------
+# resourceList
+# --------------------------------------------------
+resource.list.page.title=[Admin] Resource List
+resource.list.section.title=[Admin] Resource List
+resource.list.no.resources.available=No Resources Available
+
+# --------------------------------------------------
+# role
+# --------------------------------------------------
+role.page.title=[Admin] Role Viewer
+role.section.title=Role Modification Page
+role.assignable=Assignable?
+role.currently.assigned.permissions=Currently Assigned Permissions:
+role.add.new.permission=Add New Permission
+role.currently.assigned.roles=Currently Assigned Roles:
+role.add.sub.role=Add Sub Role
+role.operation=Operation
+role.resource=Resource
+
+# --------------------------------------------------
+# roleEdit
+# --------------------------------------------------
+role.edit.no.parent.defined=No Parent Roles Defined for this Role
+role.edit.no.childrole.defined=No Child Roles Defined for this Role
+role.edit.users.defined.in.current.role=Users defined with the current role
+role.edit.users.defined.in.parent.roles=Users defined with parent roles
+role.edit.section.users=List of Users
+role.edit.no.user.defined=No Users Defined for this Role
+cannot.assign.role=Unable to update user ''{0}'' : {1}
+
+# --------------------------------------------------
+# roleCreate
+# --------------------------------------------------
+role.create.page.title=[Admin] Create Role
+role.create.section.title=[Admin] Create Role
+role.create.operation=Operation
+role.create.resource=Resource
+role.create.no.permissions.defined=No Permissions Defined for this Role
+role.create.add.permission=Add Permission
+
+# --------------------------------------------------
+# roleList
+# --------------------------------------------------
+role.list.page.title=[Admin] Role List
+role.list.section.title=[Admin] Role List
+role.list.no.roles.available=No Roles Available
+
+# --------------------------------------------------
+# roleModel
+# --------------------------------------------------
+role.model.page.title=[Admin] Role Model
+role.model.section.title=[Admin] Role Model
+role.model.message=These are the resources, operations, roles and role templates that are known by the role manager. They are not the current content of the RBAC store as those contain the resource, operations, and roles declared below _and_ any dynamic data created from creating new roles from the templates below.
+role.model.id=Id
+role.model.name=Name
+role.model.name.prefix=Name Prefix
+role.model.permanent=Permanent
+role.model.assignable=Assignable
+role.model.delimeter=Delimeter
+role.model.operation.id=Operation Id
+role.model.resource.id=Resource Id
+role.model.role.id=Role Id
+role.model.parent.roles=Parent Roles
+role.model.child.roles=Child Roles
+role.model.templates=Templates
+role.model.template.id=Template Id
+role.model.parent.templates=Parent Templates
+role.model.child.templates=Child Templates
+
+# --------------------------------------------------
+# roleSummary
+# --------------------------------------------------
+role.summary.page.title=[Admin] Role Summary
+role.summary.section.title=[Admin] Role Summary
+
+# --------------------------------------------------
+# systemInformation
+# --------------------------------------------------
+system.info.page.title=[Admin] System Information
+system.info.section.title=Security System Information
+
+# --------------------------------------------------
+# userCreate
+# --------------------------------------------------
+user.create.page.title=[Admin] User Create
+user.create.section.title=[Admin] User Create
+user.create=Create User
+
+# --------------------------------------------------
+# userDelete
+# --------------------------------------------------
+user.delete.page.title=[Admin] User Delete
+user.delete.section.title=[Admin] User Delete
+user.delete.message=The following user will be deleted
+user.delete=Delete User
+
+# --------------------------------------------------
+# userEdit
+# --------------------------------------------------
+user.edit.page.title=[Admin] User Edit
+user.edit.confirm.page.title=[Admin] User Edit - Confirm Administrator Password
+user.edit.section.title=[Admin] User Edit
+user.edit.confirm.section.title=[Admin] User Edit - Confirm Administrator Password
+user.edit.locked.user=Locked User
+user.edit.force.user.change.password=Force User to Change Password
+user.edit.roles=Edit Roles
+has.hidden.roles=Some roles above your permission level have been omitted
+
+# --------------------------------------------------
+# userFind
+# --------------------------------------------------
+user.find=Find a user
+
+# --------------------------------------------------
+# userList
+# --------------------------------------------------
+user.list.page.title=[Admin] User List
+user.list.section.title=[Admin] List of Users in Role: {0}
+user.list.permanent=Permanent
+user.list.validated=Validated
+user.list.locked=Locked
+user.list.tasks=Tasks
+user.list.tools=Tools
+user.list.reports=Reports
+user.list.message=The following tools are available for administrators to manipulate the user list.
+user.list.create.new.user=Create New User
+user.list.show.users.in.role=Show Users In Role
+user.list.types=Types
+
+# --------------------------------------------------
+# backupRestore
+# --------------------------------------------------
+backupRestore.page.title=Backup and Restore
+backupRestore.section.backup.title=Backup
+backupRestore.section.restore.title=Restore
+backupRestore.section.recent.backup=Recent Backups
+backupRestore.backup.error = Backup File Not Found
+backupRestore.backup.empty.error = Backup directory is required
+
+# --------------------------------------------------
+# Logging Section
+#
+# General - These are localizations that are used by multiple classes.
+# If you can't find the text under each class, you can find it here.
+# --------------------------------------------------
+log.password.reset.request=Password Reset Request for user '{}'
+log.password.change=Password Changed for user '{}'
+log.account.validation=Account Validated for user '{}'
+log.account.create=User Created: '{}'
+log.account.edit=User Modified: '{}'
+log.account.delete=User Deleted: '{}'
+log.login.success=Successful Login for user '{}'
+log.logout.success=Logged Out user '{}'
+log.login.fail=Login Failure for user '{}'
+log.login.fail.locked=Login Failure for user '{}' (account locked)
+log.assign.role=Role Assigned to user '{}': '{}'
+log.revoke.role=Role Revoked from user '{}': '{}'
+log.role.create=Role Created: '{}'
+log.role.edit=Role Modified: '{}'
+
+# --------------------------------------------------
+# changePasswordSuccess
+# --------------------------------------------------
+change.password.page.title=Change Password
+change.password.success.section.title=Password successfully changed
\ No newline at end of file
--- /dev/null
+# 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.
+
+# --------------------------------------------------
+# Classes Section
+#
+# General - These are localizations that are used by multiple classes.
+# If you can't find the text under each class, you can find it here.
+# --------------------------------------------------
+username.required=Es mu\u00DF ein Benutzername angegeben werden.
+username.has.spaces=Benutzername darf keine Leerzeichen enthalten.
+password.confimation.failed=Das Passwort und die Passwortbest\u00E4tigung stimmen nicht \u00FCberein.
+password.provided.does.not.match.existing=Das angegebene Passwort stimmt nicht mit dem existierenden \u00FCberein.
+user.does.not.exist=Der Benutzer ''{0}'' existiert nicht.
+user.not.found.exception=Fehler beim Beauskunften des Benutzers ''{0}'': {1}
+save.role.success=Rolle ''{0}'' erfolgreich aktualisiert.
+cannot.get.role=Ermittlung der Rolle ''{0}'' nicht m\u00F6glich: {1}
+invalid.user.credentials=Ung\u00FCltige Benutzer Legitimiationsdaten.
+user.already.exists=Der Benutzer ''{0}'' existiert bereits.
+cannot.edit.user.null.username=Bearbeitung eines Benutzers mit leerem Namen nicht m\u00F6glich.
+cannot.edit.user.empty.username=Bearbeitung eines Benutzers ohne Namen nicht m\u00F6glich.
+cannot.get.user=Ermittlung des Benutzers ''{0}'' nicht m\u00F6glich: {1}
+cannot.edit.user.null.credentials=Bearbeitung eines Benutzers mit leeren Legitimationsdaten nicht m\u00F6glich.
+cannot.operate.on.null.user=Verarbeitung leerer Benutzer nicht m\u00F6glich.
+
+# --------------------------------------------------
+# AbstractUserCredentialsAction
+# --------------------------------------------------
+fullName.required=Es mu\u00DF ein vollst\u00E4ndiger Name angegeben werden.
+email.required=Es mu\u00DF eine E-Mail-Adresse angegeben werden.
+email.invalid=Ung\u00FCltige E-Mail-Adresse.
+password.required=Es mu\u00DF ein Passwort angegeben werden.
+passwords.does.not.match=Die Passw\u00F6rter stimmen nicht \u00FCberein.
+
+# --------------------------------------------------
+# AccountAction
+# --------------------------------------------------
+cannot.show.account.login.required=Anzeige Ihres Kontos nicht m\u00F6glich. Sie sind nicht angemeldet.
+
+# --------------------------------------------------
+# LoginAction
+# --------------------------------------------------
+reset.password.missing=Schl\u00FCssel der Passwort-Zur\u00FCcksetzung nicht gefunden.
+cannot.find.key=Schl\u00FCssel nicht gefunden.
+cannot.find.key.at.the.moment=Der Schl\u00FCssel kann momentan nicht verarbeitet werden. Bitte versuchen Sie es sp\u00E4ter erneut.
+cannot.find.user=Benutzer nicht gefunden.
+validation.failure.key.missing=Validierungsfehler, Schl\u00FCssel fehlt.
+incorrect.username.password=Sie haben eine ung\u00FCltige Kombination von Benutzername und Passwort angegeben.
+account.validation.required=Es wurde eine ung\u00FCltige Kombination von Benutzername und Passwort angegeben.
+authentication.failed=Authentifizierung fehlgeschlagen.
+authentication.exception=Fehler bei der Authentifizierung: {0}
+account.locked=Ihr Konto ist gesperrt.
+login.already.logged.in=Sie sind bereits authentifiziert.
+
+# --------------------------------------------------
+# PasswordAction
+# --------------------------------------------------
+newPassword.cannot.be.empty=Das neue Passwort darf nicht leer sein.
+cannot.update.user.not.found=Aktualisierung nicht m\u00F6glich. Benutzer ''{0}'' nicht gefunden.
+admin.deleted.account=Tritt meistens auf, wenn ein Administrator Ihr Konto gel\u00F6scht hat.
+
+# --------------------------------------------------
+# PasswordResetAction
+# --------------------------------------------------
+username.cannot.be.empty=Benutzername darf nicht leer sein.
+password.reset.success=Es wurde eine Nachricht versendet, sollte der Benutzer ermittelt worden sein.
+password.reset.failure=Es wurde eine Nachricht versendet, sollte der Benutzer ermittelt worden sein.
+password.reset.email.generation.failure=Ein interner Systemfehler hat die Erstellung der E-Mail zur Zur\u00FCcksetzung des Passwortes verhindert.
+
+# --------------------------------------------------
+# RegisterAction
+# --------------------------------------------------
+assign.role.failure=Die ''registered-user'' Rolle konnte nicht zugewiesen werden.
+cannot.register.user=Verarbeitung der Registrierungs-Anfrage nicht m\u00F6glich.
+
+# --------------------------------------------------
+# AddAdminUserAction
+# --------------------------------------------------
+invalid.admin.credentials=Ung\u00FCltige Administrations-Legitimationsdaten. Bitte versuchen Sie es erneut.
+admin.user.already.exists=Der Administrator existiert bereits. Evtl. wurde der Administrator bereits von jemand anderem angelegt, bevor Sie die M\u00F6glichkeit dazu hatten.
+cannot.assign.admin.role=System-Administrator Rolle kann nicht zugewiesen werden.
+
+# --------------------------------------------------
+# AssignmentsAction
+# --------------------------------------------------
+rbac.edit.user.empty.principal=RBAC Benutzer-Aktualisierung mir leerer Identit\u00E4t nicht m\u00F6glich.
+error.adding.selected.roles=Fehler beim Hinzuf\u00FCgen der ausgew\u00E4hlten Rollen: {0}
+error.removing.selected.roles=Fehler beim Entfernen der ausgew\u00E4hlten Rollen: {0}
+
+# --------------------------------------------------
+# EditRoleAction
+# --------------------------------------------------
+cannot.edit.null.role=Bearbeitung einer Rolle mit leerem Namen nicht m\u00F6glich.
+cannot.edit.empty.role=Bearbeitung einer Rolle ohne Namen nicht m\u00F6glich.
+cannot.operate.null.role=Verarbeitung leerer Rollen nicht m\u00F6glich.
+
+# --------------------------------------------------
+# OperationsAction
+# --------------------------------------------------
+cannot.list.all.operations=Ermittlung der Operationen nicht m\u00F6glich: {0}
+cannot.save.operation=Aktualisierung der Operation nicht m\u00F6glich: {0}.
+cannot.remove.operation=Entfernung der Operation ''{0}'' nicht m\u00F6glich.
+
+# --------------------------------------------------
+# PermissionsAction
+# --------------------------------------------------
+cannot.list.all.permissions=Ermittlung der Berechtigungen nicht m\u00F6glich: {0}
+cannot.edit.null.permission=Bearbeitung einer Berechtigung mit leerem Namen nicht m\u00F6glich.
+cannot.edit.empty.permission=Bearbeitung einer Berechtigung ohne Namen nicht m\u00F6glich.
+cannot.operate.null.permission=Verarbeitung leerer Berechtigungen nicht m\u00F6glich.
+cannot.get.permission=Ermittlung der Berechtigung ''{0}'' nicht m\u00F6glich: {1}
+save.permission.success=Berechtigung ''{0}'' erfolgreich aktualisiert.
+
+# --------------------------------------------------
+# ReportAction
+# --------------------------------------------------
+cannot.get.report=Ermittlung des Berichts nicht m\u00F6glich: {0}
+cannot.generate.report=Erstellung des Berichts nicht m\u00F6glich.
+
+# --------------------------------------------------
+# ResourcesAction
+# --------------------------------------------------
+cannot.list.all.resources=Ermittlung der Resourcen nicht m\u00F6glich: {0}
+cannot.save.resource=Aktualisierung der Resouce nicht m\u00F6glich: {0}
+cannot.remove.resource=Zu l\u00F6schende Resource nicht gefunden ''{0}''
+
+# --------------------------------------------------
+# RoleCreateAction
+# --------------------------------------------------
+cannot.add.null.permission=Hinzuf\u00FCgen einer leeren Berechtigung nicht m\u00F6glich.
+cannot.add.empty.role=Erstellung einer Rolle mit leerem Namen nicht m\u00F6glich.
+
+# --------------------------------------------------
+# RolesAction
+# --------------------------------------------------
+cannot.list.all.roles=Ermittlung der Rollen nicht m\u00F6glich: {0}
+
+# --------------------------------------------------
+# UserDeleteAction
+# --------------------------------------------------
+cannot.remove.user.null.username=L\u00F6schung eines Benutzers auf Basis eines leeren Benutzernamens nicht m\u00F6glich.
+cannot.remove.user.empty.username=L\u00F6schung eines Benutzers mit leerem Namen nicht m\u00F6glich.
+cannot.remove.user.not.found=L\u00F6schung des Benutzers ''{0}'' nicht m\u00F6glich. Benutzer nicht gefunden.
+cannot.remove.user.role=L\u00F6schung der Rollen-Zuweisung f\u00FCr ''{0}'' nicht m\u00F6glich. {1}
+cannot.remove.user.non.existent=L\u00F6schung des nicht existierenden Benutzers ''{0}'' nicht m\u00F6glich.
+
+# --------------------------------------------------
+# JSP Section
+#
+# General - These are localizations that are used by multiple JSPs.
+# If you can't find the text under each JSP, you can find it here.
+# --------------------------------------------------
+username=Benutzername
+full.name=Vollst\u00E4ndiger Name
+email=E-Mail
+email.address=E-Mail Adresse
+password=Passwort
+current.password=Aktuelles Passwort
+new.password=Neues Passwort
+confirm.password=Passwortbest\u00E4tigung
+register=Registrieren
+login=Anmelden
+logout=Abmelden
+submit=\u00DCbertragen
+remove=Entfernen
+delete=L\u00F6schen
+update=Aktualisieren
+search=Suchen
+cancel=Abbrechen
+name=Name
+description=Beschreibung
+role.name=Rollenname
+role.description=Rollenbeschreibung
+remove.selected.roles=Ausgew\u00E4hlte Rollen entfernen
+role=Rolle
+roles=Rollen
+effective.roles=Effektive Rollen
+permissions=Berechtigungen
+operations=Operationen
+resources=Resourcen
+
+# --------------------------------------------------
+# accessDenied
+# --------------------------------------------------
+access.denied.page.title=Sicherheits Hinweis - Zugang verweigert
+access.denied.section.title=Sicherheits Hinweis - Zugang verweigert
+access.denied.message=Sie haben nicht die erforderlichen Berechtigungen zur Ausf\u00FChrung des Vorgangs.<br>Bitte kontaktieren Sie Ihren Administrator, um entsprechende Berechtigungen erteilt zu bekommen.
+
+# --------------------------------------------------
+# account
+# --------------------------------------------------
+account.details.page.title=Kontodetails
+account.details.section.title=Kontodetails
+
+# --------------------------------------------------
+# alert
+# --------------------------------------------------
+alert.page.title=Sicherheitshinweis
+alert.message=Sie sind zur Ausf\u00FChrung des Vorgangs nicht authorisiert.
+
+# --------------------------------------------------
+# generalError
+# --------------------------------------------------
+general.error.page.title=Es ist ein Fehler aufgetreten
+general.error.section.title=Es ist ein Fehler aufgetreten
+
+# --------------------------------------------------
+# login
+# --------------------------------------------------
+login.page.title=Anmeldungsseite
+login.section.title=Anmeldung
+login.remember.me=Daten merken
+login.need.an.account=Ben\u00F6tigen Sie ein Benutzerkonto?
+login.register=Registrieren Sie sich!
+login.forgot.your.password=Passwort vergessen?
+login.request.password.reset=Zur\u00FCcksetzung des Passwortes beauftragen.
+
+# --------------------------------------------------
+# password
+# --------------------------------------------------
+password.page.title=Passwort\u00E4nderung
+password.section.title=Passwort\u00E4nderung
+password.existing=Bestehendes Passwort
+password.new=Neues Passwort
+password.new.confirm=Passwortbest\u00E4tigung
+password.change=Passwort \u00E4ndern
+
+# --------------------------------------------------
+# passwordResetNotification
+# --------------------------------------------------
+password.reset.page.title=Passwort-Zur\u00FCcksetzung
+password.reset.message=Zur\u00FCcksetzung des Passwortes erfolgreich.
+password.reset.go.to=Gehe zu
+
+# --------------------------------------------------
+# register
+# --------------------------------------------------
+register.page.title=Registrierungs-Seite
+register.section.title=Registrierung eines Benutzerkontos
+
+# --------------------------------------------------
+# requestPasswordReset
+# --------------------------------------------------
+request.password.reset.page.title=Passwort-Zur\u00FCcksetzung beauftragen
+request.password.reset.section.title=Passwort-Zur\u00FCcksetzung beauftragen
+request.password.reset=Zur\u00FCcksetzung beauftragen
+
+# --------------------------------------------------
+# requiresAuthentication
+# --------------------------------------------------
+requires.authentication.page.title=Sicherheits-Hinweis - Aktion erfordert Authenfizierung
+requires.authentication.section.title=Sicherheits-Hinweis - Aktion erfordert Authenfizierung
+requires.authentication.message=Diese Aktion erfordert Ihre Authenfizierung.
+requires.authentication.go.ahead=Weiter
+
+# --------------------------------------------------
+# validationNotification
+# --------------------------------------------------
+validation.notification.page.title=Best\u00E4tigungs-Benachrichtigungs-Seite
+validation.notification.section.title=Best\u00E4tigungs-Erinnerung
+validation.notification.message.1=Eine Best\u00E4tigungsmail wurde an die von Ihnen angegebene Adresse ({0}) gesendet. Bitte pr\u00FCfen Sie Ihren Posteingang.
+validation.notification.message.2=Dieses Konto ({0}) wird bis zur Best\u00E4tigung gesperrt bleiben.
+
+# --------------------------------------------------
+# grantRoles
+# --------------------------------------------------
+grant=Erteilen
+
+# --------------------------------------------------
+# securityLinks
+# --------------------------------------------------
+current.user=Aktueller Benutzer:
+unknown.user=Unbekannter Benutzer
+edit.details=Details bearbeiten
+notify.password.expiration=Das Passwort wird ung\u00FCltig zum
+
+# --------------------------------------------------
+# userCredentials
+# --------------------------------------------------
+account.creation=Kontoerstellung
+last.login=Letzte Anmeldung
+last.password.change=Letzte \u00C4nderung des Passwortes
+
+# --------------------------------------------------
+# assignments
+# --------------------------------------------------
+assignments.page.title=[Admin] Benutzer bearbeiten
+assignments.section.title=[Admin] Benutzerrollen
+assignments.no.roles=Noch keinen Rollen zugewiesen
+assignments.available.roles=Verf\u00FCgbare Rollen
+assignments.assigned.roles=Zugewiesene Rollen
+assignments.submit=\u00DCbertragen
+assignments.reset=Zur\u00FCcksetzen
+assignments.add.roles=Ausgew\u00E4hlte Rollen hinzuf\u00FCgen
+assignments.remove.roles=Ausgew\u00E4hlte Rollen entfernen
+assignments.no.roles.to.grant=Keine Rollen zur Zuweisung verf\u00FCgbar
+
+# --------------------------------------------------
+# createAdmin
+# --------------------------------------------------
+create.admin.page.title=Administrator anlegen
+create.admin.section.title=Administrator anlegen
+create.admin=Administrator anlegen
+
+# --------------------------------------------------
+# operationList
+# --------------------------------------------------
+operation.list.page.title=[Admin] Liste der Operationen
+operation.list.section.title=[Admin] Liste der Operationen
+operation.list.no.operations.available=Keine Operationen verf\u00FCgbar
+
+# --------------------------------------------------
+# permissionList
+# --------------------------------------------------
+permission.list.page.title=[Admin] Liste der Berechtigungen
+permission.list.section.title=[Admin] Liste der Berechtigungen
+permission.list.no.permissions.available=Keine Berechtigungen verf\u00FCgbar
+
+# --------------------------------------------------
+# resourceList
+# --------------------------------------------------
+resource.list.page.title=[Admin] Liste der Resourcen
+resource.list.section.title=[Admin] Liste der Resourcen
+resource.list.no.resources.available=Keine Resourcen verf\u00FCgbar
+
+# --------------------------------------------------
+# role
+# --------------------------------------------------
+role.page.title=[Admin] Rollenansicht
+role.section.title=Rollen-Bearbeitung
+role.assignable=Zuweisbar?
+role.currently.assigned.permissions=Aktuell erteilte Berechtigungen:
+role.add.new.permission=Neue Berechtigung hinzuf\u00FCgen
+role.currently.assigned.roles=Aktuell zugewiesene Rollen:
+role.add.sub.role=Kind-Rolle hinzuf\u00FCgen
+
+# --------------------------------------------------
+# roleEdit
+# --------------------------------------------------
+role.edit.no.parent.defined=Keine Eltern-Rolle f\u00FCr diese Rolle definiert.
+role.edit.no.childrole.defined=Keine Kind-Rollen f\u00FCr diese Rolle definiert.
+role.edit.users.defined.in.current.role=Benutzer, die der aktuellen Rolle zugeteilt sind
+role.edit.users.defined.in.parent.roles=Benutzer mit zugewiesener Eltern-Rolle
+role.edit.section.users=Benutzerliste
+role.edit.no.user.defined=Keine Benutzer f\u00FCr diese Rolle definiert.
+cannot.assign.role=Benutzer ''{0}'' kann nicht aktualisiert werden: {1}
+
+# --------------------------------------------------
+# roleCreate
+# --------------------------------------------------
+role.create.page.title=[Admin] Rolle erstellen
+role.create.section.title=[Admin] Rolle erstellen
+role.create.operation=Operation
+role.create.resource=Resource
+role.create.no.permissions.defined=Keine Berechtigungen f\u00FCr diese Rolle definiert.
+role.create.add.permission=Berechtigung hinzuf\u00FCgen
+
+# --------------------------------------------------
+# roleList
+# --------------------------------------------------
+role.list.page.title=[Admin] Liste der Rollen
+role.list.section.title=[Admin] Liste der Rollen
+role.list.no.roles.available=Keine Rollen verf\u00FCgbar
+
+# --------------------------------------------------
+# roleModel
+# --------------------------------------------------
+role.model.page.title=[Admin] Rollen-Modell
+role.model.section.title=[Admin] Rollen-Modell
+role.model.message=Dies sind die dem Rollen-Verwalter bekannten Resourcen, Operationen, Rollen und Rollen-Schablonen.
+role.model.id=Bezeichner
+role.model.name=Name
+role.model.name.prefix=Prefix
+role.model.permanent=Permanent
+role.model.assignable=Erteilbar
+role.model.delimeter=Trennzeichen
+role.model.operation.id=Operations-Bezeichner
+role.model.resource.id=Resource-Bezeichner
+role.model.role.id=Rollen-Bezeichner
+role.model.parent.roles=Eltern-Rollen
+role.model.child.roles=Kind-Rollen
+role.model.templates=Schablonen
+role.model.template.id=Schablonen-Bezeichner
+role.model.parent.templates=Eltern-Schablonen
+role.model.child.templates=Kind-Schablonen
+
+# --------------------------------------------------
+# roleSummary
+# --------------------------------------------------
+role.summary.page.title=[Admin] Rollen\u00FCbersicht
+role.summary.section.title=[Admin] Rollen\u00FCbersicht
+
+# --------------------------------------------------
+# systemInformation
+# --------------------------------------------------
+system.info.page.title=[Admin] System-Informationen
+system.info.section.title=[Admin] Informationen zum Sicherheits-System
+
+# --------------------------------------------------
+# userCreate
+# --------------------------------------------------
+user.create.page.title=[Admin] Benutzer anlegen
+user.create.section.title=[Admin] Benutzer anlegen
+user.create=Benutzer anlegen
+
+# --------------------------------------------------
+# userDelete
+# --------------------------------------------------
+user.delete.page.title=[Admin] Benutzer l\u00F6schen
+user.delete.section.title=[Admin] Benutzer l\u00F6schen
+user.delete.message=Der folgende Benutzer wird gel\u00F6scht werden
+user.delete=Benutzer l\u00F6schen
+
+# --------------------------------------------------
+# userEdit
+# --------------------------------------------------
+user.edit.page.title=[Admin] Benutzer bearbeiten
+user.edit.section.title=[Admin] Benutzer bearbeiten
+user.edit.locked.user=Gesperrter Benutzer
+user.edit.force.user.change.password=Benutzer auffordern das Passwort zu \u00E4ndern
+user.edit.roles=Rollen bearbeiten
+
+# --------------------------------------------------
+# userFind
+# --------------------------------------------------
+user.find=Benutzer finden
+
+# --------------------------------------------------
+# userList
+# --------------------------------------------------
+user.list.page.title=[Admin] Liste der Benutzer
+user.list.section.title=[Admin] Liste der zur Rolle ''{0}'' zugewiesenen Benutzer:
+user.list.permanent=Permanent
+user.list.validated=\u00DCberpr\u00FCft
+user.list.locked=Gesperrt
+user.list.tasks=Vorg\u00E4nge
+user.list.tools=Werkzeuge
+user.list.reports=Reports
+user.list.message=Die folgenden Werkzeuge stehen Administratoren zur Bearbeitung von Benutzern zur Verf\u00FCgung.
+user.list.create.new.user=Neuen Benutzer anlegen
+user.list.show.users.in.role=Zeige Benutzer mit Rolle
+user.list.types=Typen
--- /dev/null
+# 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.
+
+# --------------------------------------------------
+# Empty localization file to workaround REDBACK-233
+# --------------------------------------------------
\ No newline at end of file
--- /dev/null
+# 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.
+
+# --------------------------------------------------
+# Classes Section
+#
+# General - These are localizations that are used by multiple classes.
+# If you can't find the text under each class, you can find it here.
+# --------------------------------------------------
+#Translate by Damien Blugeon.
+username.required=Le nom d''utilisateur est obligatoire.
+username.has.spaces=Le nom d''utilisateur ne peut pas contenir des espaces.
+password.confimation.failed=La confirmation du mot de passe a \u00e9chou\u00e9. Les mots de passe ne correspondent pas.
+password.provided.does.not.match.existing=Le mot de passe fournis ne correspond pas au compte.
+user.does.not.exist=L''utilisateur ''{0}'' n''existe pas.
+user.not.found.exception=Une erreur s''est produite lors de la recherche de l''utilisateur ''{0}'': {1}
+save.role.success=R\u00f4le ''{0}'' Sauvegard\u00e9
+cannot.get.role=Impossible de r\u00e9cup\u00e9rer le r\u00f4le ''{0}'': {1}
+invalid.user.credentials=Informations d''autorisations de l''utilisateur invalide.
+user.already.exists=L''utilisateur ''{0}'' existe d\u00e9j\u00e0.
+cannot.edit.user.null.username=Impossible d'\u00e9diter un utilisateur qui a un nom d''utilisateur null.
+cannot.edit.user.empty.username=Impossible d''\u00e9diter un utilisateur qui a un nom d''utilisateur vide.
+cannot.get.user=Impossible de r\u00e9cup\u00e9rer l''utilisateur ''{0}'': {1}
+cannot.edit.user.null.credentials=Impossible d''\u00e9diter un utilisateur qui a des autorisations nulles.
+cannot.operate.on.null.user=Impossible d''op\u00e9rer sur un utilisateur qui n''existe pas.
+
+# --------------------------------------------------
+# AbstractUserCredentialsAction
+# --------------------------------------------------
+fullName.required=Le nom complet est obligatoire.
+email.required=L''adresse email est obligatoire.
+email.invalid=L''adresse email est invalide.
+password.required=Le mot de passe est obligatoire.
+passwords.does.not.match=Les mots de passe ne correspondent pas.
+
+# --------------------------------------------------
+# AccountAction
+# --------------------------------------------------
+cannot.show.account.login.required=Impossible d''afficher votre compte. Vous n''\u00eates pas connect\u00e9.
+
+# --------------------------------------------------
+# LoginAction
+# --------------------------------------------------
+reset.password.missing=R\u00e9initialisation du mot de passe, cl\u00e9 manquante.
+cannot.find.key=Impossible de trouver la cl\u00e9.
+cannot.find.key.at.the.moment=Impossible de traiter la cl\u00e9 pour le moment. S''il vous pla\u00eet, r\u00e9essayez ult\u00e9rieurement.
+cannot.find.user=Impossible de trouver l''utilisateur.
+validation.failure.key.missing=Echec de la validation, cl\u00e9 manquante.
+incorrect.username.password=Vous avez entr\u00e9 un nom d''utilisateur et/ou un mot de passe incorrect(s).
+account.validation.required=Vous avez entr\u00e9 un nom d''utilisateur et/ou un mot de passe incorrect(s).
+authentication.failed=Echec de l''authentification.
+authentication.exception=Une erreur s''est produite lors de l''authentification : {0}
+account.locked=Votre compte est verrouill\u00e9.
+login.already.logged.in=Vous \u00eatestes d\u00e9j\u00e0 connect\u00e9.
+
+# --------------------------------------------------
+# PasswordAction
+# --------------------------------------------------
+newPassword.cannot.be.empty=Le nouveau mot de passe ne peut \u00eatre vide.
+cannot.update.user.not.found=Impossible de mettre \u00e0 jour l''utilisateur ''{0}''. Utilisateur non trouv\u00e9.
+admin.deleted.account=Probablement parce qu''un administrateur vient de supprimer votre compte.
+
+# --------------------------------------------------
+# PasswordResetAction
+# --------------------------------------------------
+username.cannot.be.empty=Le nom d''utilisateur ne peut \u00eatre vide.
+password.reset.success=Si l''utilisateur a \u00e9t\u00e9 trouv\u00e9, un message vient d''\u00eatre envoy\u00e9.
+password.reset.failure=Si l''utilisateur a \u00e9t\u00e9 trouv\u00e9, un message vient d''\u00eatre envoy\u00e9.
+password.reset.email.generation.failure=Une erreur syst\u00e8me interne a emp\u00each\u00e9 la g\u00e9n\u00e9ration de l''email de r\u00e9initialisation du mot de passe.
+
+# --------------------------------------------------
+# RegisterAction
+# --------------------------------------------------
+assign.role.failure=impossible d''assigner le r\u00f4le utilisateur enregistr\u00e9 au nouvel utilisateur.
+cannot.register.user=Impossible de traiter la demande d''enregistrement du nouvel utilisateur.
+
+# --------------------------------------------------
+# AddAdminUserAction
+# --------------------------------------------------
+invalid.admin.credentials=Informations d''autorisations d''adminstration invalide.
+admin.user.already.exists=Un administrateur existe d\u00e9j\u00e0 dans la base de donn\u00e9e (quelqu''un a probablement cr\u00e9\u00e9 l''utilisateur avant vous).
+cannot.assign.admin.role=Impossible d''assigner le r\u00f4le d''administrateur syst\u00e8me.
+
+# --------------------------------------------------
+# AssignmentsAction
+# --------------------------------------------------
+rbac.edit.user.empty.principal=Impossible d''utiliser AssignmentsAction pour RBAC Edit User avec un principal vide.
+error.adding.selected.roles=Erreur lors de l''ajout des r\u00f4les s\u00e9lectionn\u00e9s : {0}
+error.removing.selected.roles=Erreur lors du retrait des r\u00f4les s\u00e9lectionn\u00e9s: {0}
+
+# --------------------------------------------------
+# EditRoleAction
+# --------------------------------------------------
+cannot.edit.null.role=Impossible d''\u00e9diter le nom de r\u00f4le null.
+cannot.edit.empty.role=Impossible d''\u00e9diter un nom de r\u00f4le vide.
+cannot.operate.null.role=Impossible d''op\u00e9rer sur un r\u00f4le null.
+
+# --------------------------------------------------
+# OperationsAction
+# --------------------------------------------------
+cannot.list.all.operations=Impossible d''\u00e9num\u00e9rer toutes les op\u00e9rations : {0}
+cannot.save.operation=Impossible d''enregistrer l''op\u00e9ration : {0}.
+cannot.remove.operation=Impossible de retirer l''op\u00e9ration : {0}.
+
+# --------------------------------------------------
+# PermissionsAction
+# --------------------------------------------------
+cannot.list.all.permissions=Impossible d''\u00e9num\u00e9rer toutes les permissions : {0}
+cannot.edit.null.permission=Impossible d''\u00e9diter un nom de permission null.
+cannot.edit.empty.permission=Impossible d''\u00e9diter un nom de permission vide.
+cannot.operate.null.permission=Impossible d''op\u00e9rer sur une permision qui n''existe pas.
+cannot.get.permission=Impossible de r\u00e9cuperer la permission ''{0}'': {1}
+save.permission.success=Permission ''{0}'' Sauvegard\u00e9e
+
+# --------------------------------------------------
+# ReportAction
+# --------------------------------------------------
+cannot.get.report=Impossible de trouver le rapport : {0}
+cannot.generate.report=Impossible de g\u00e9n\u00e9rer le rapport.
+
+# --------------------------------------------------
+# ResourcesAction
+# --------------------------------------------------
+cannot.list.all.resources=Impossible d''\u00e9num\u00e9rer toutes les ressources : {0}
+cannot.save.resource=Impossible d''enregistrer la ressource: {0}.
+cannot.remove.resource=Impossible de localiser la ressource \u00e0 retirer ''{0}''
+
+# --------------------------------------------------
+# RoleCreateAction
+# --------------------------------------------------
+cannot.add.null.permission=Impossible d''ajouter une permission null.
+cannot.add.empty.role=Impossible de cr\u00e9er un r\u00f4le avec un nom vide.
+
+# --------------------------------------------------
+# RolesAction
+# --------------------------------------------------
+cannot.list.all.roles=Impossible d''\u00e9num\u00e9rer toutes les r\u00f4les : {0}
+
+# --------------------------------------------------
+# UserDeleteAction
+# --------------------------------------------------
+cannot.remove.user.null.username=Impossible de supprimer l''utilisateur bas\u00e9 sur le nom d''utilisateur null.
+cannot.remove.user.empty.username=Impossible de supprimer l''utilisateur bas\u00e9 sur le nom d''utilisateur vide.
+cannot.remove.user.not.found=Impossible de localiser l''utilisateur ''{0}'' \u00e0 supprimer.
+cannot.remove.user.role=Impossible de retirer les r\u00f4les de l''utilisateur ''{0}'' parce que {1}
+cannot.remove.user.non.existent=Impossible de supprimer l''utilisateur inexistant ''{0}''
+
+# --------------------------------------------------
+# JSP Section
+#
+# General - These are localizations that are used by multiple JSPs.
+# If you can't find the text under each JSP, you can find it here.
+# --------------------------------------------------
+username=Nom d''utilisateur
+full.name=Nom complet
+email=Email
+email.address=Adresse email
+password=Mot de passe
+current.password=Mot de passe actuel
+new.password=Nouveau mot de passe
+confirm.password=Confirmer le mot de passe
+register=S''enregistrer
+login=S''authentifier
+logout=Se d\u00e9connecter
+submit=Envoyer
+remove=Retirer
+delete=Supprimer
+update=Mise \u00e0 jour
+search=Rechercher
+cancel=Annuler
+goback=Retour
+edit=\u00c9diter
+save=Sauvegarder
+name=Nom
+description=Description
+role.name=Nom du r\u00f4le
+role.description=Description du r\u00f4le
+remove.selected.roles=Retitrer les r\u00f4les s\u00e9lectionn\u00e9es
+role=R\u00f4le
+roles=R\u00f4les
+effective.roles=R\u00f4les affect\u00e9s
+permissions=Permissions
+operations=Op\u00e9rations
+resources=Ressources
+
+# --------------------------------------------------
+# accessDenied
+# --------------------------------------------------
+access.denied.page.title=Alerte s\u00e9curit\u00e9 - Acc\u00e8s interdit.
+access.denied.section.title=Alerte s\u00e9curit\u00e9 - Acc\u00e8s interdit.
+access.denied.message=L''action que vous avez tent\u00e9 d''effectuer requi\u00e8re des permissions que vous n''avez pas.<br>S''il vous pla\u00eet, contactez votre administrateur pour obtenir les droits appropri\u00e9s.
+
+# --------------------------------------------------
+# account
+# --------------------------------------------------
+account.details.page.title=D\u00e9tails du compte
+account.details.section.title=D\u00e9tails du compte
+
+# --------------------------------------------------
+# alert
+# --------------------------------------------------
+alert.page.title=Page d''alerte s\u00e9curit\u00e9s
+alert.message=Vous n'\u00eates pas autoris\u00e9 pour cette activit\u00e9.
+
+# --------------------------------------------------
+# generalError
+# --------------------------------------------------
+general.error.page.title=Une erreur est survenue
+general.error.section.title=Une erreur est survenue
+
+# --------------------------------------------------
+# login
+# --------------------------------------------------
+login.page.title=Page d''authentification
+login.section.title=S''authentifier
+login.remember.me=Se souvenir de moi
+login.need.an.account=Besoin d''un compte ?
+login.register=S''enregistrer !
+login.forgot.your.password=Mot de passe oubli\u00e9 ?
+login.request.password.reset=Demander une r\u00e9initialisation de votre mot de passe.
+
+# --------------------------------------------------
+# password
+# --------------------------------------------------
+password.page.title=Changer de mot de passe
+password.section.title=Changer de mot de passe
+password.existing=Mot de passe existant
+password.new=Nouveau mot de passe
+password.new.confirm=Confirmer le nouveau mot de passe
+password.change=Changer de mot de passe
+
+# --------------------------------------------------
+# passwordResetNotification
+# --------------------------------------------------
+password.reset.page.title=R\u00e9initialiser le mot de passe
+password.reset.message=R\u00e9initialisation du mot de passe r\u00e9ussie.
+password.reset.go.to=Aller \u00e0
+
+# --------------------------------------------------
+# register
+# --------------------------------------------------
+register.page.title=Page d''enregistrement
+register.section.title=Ouvrir un compte
+
+# --------------------------------------------------
+# requestPasswordReset
+# --------------------------------------------------
+request.password.reset.page.title=Demande de r\u00e9initialisation du mot de passe
+request.password.reset.section.title=Demande de r\u00e9initialisation du mot de passe
+request.password.reset=Demander la r\u00e9initialisations
+
+# --------------------------------------------------
+# requiresAuthentication
+# --------------------------------------------------
+requires.authentication.page.title=Alerte s\u00e9curit\u00e9 - L''action requiert une authentification
+requires.authentication.section.title=Alerte s\u00e9curit\u00e9 - L''action requiert une authentification
+requires.authentication.message=L''action que vous avez tent\u00e9 d''effectuer requi\u00e8re que vous soyez authentifi\u00e9.
+requires.authentication.go.ahead=Aller \u00e0 la page
+
+# --------------------------------------------------
+# validationNotification
+# --------------------------------------------------
+validation.notification.page.title=Page de notification de validation
+validation.notification.section.title=Rappel de validation
+validation.notification.message.1=Un email de validation vient d''\u00eatre envoy\u00e9 \u00e0 l''adresse que vous avez fournis ({0}). S''il vous pla\u00eet, v\u00e9rifier le lien de validation qui vient de vous \u00eatre envoy\u00e9.
+validation.notification.message.2=Ce compte ({0}) restera verrouill\u00e9 jusqu''\u00e0 ce qu''il soit valid\u00e9.
+
+# --------------------------------------------------
+# grantRoles
+# --------------------------------------------------
+grant=Promouvoir
+
+# --------------------------------------------------
+# securityLinks
+# --------------------------------------------------
+current.user=Utilisateur connect\u00e9 :
+unknown.user=Utilisateur inconnu
+edit.details=\u00c9diter les d\u00e9tails
+notify.password.expiration=Le mot de passe expirera le
+
+# --------------------------------------------------
+# userCredentials
+# --------------------------------------------------
+account.creation=Cr\u00e9ation de compte
+last.login=Derni\u00e8re authentification
+last.password.change=Dernier Changement de mot de passe
+
+# --------------------------------------------------
+# assignments
+# --------------------------------------------------
+assignments.page.title=[Admin] Edition de l''utilisateur
+assignments.section.title=[Admin] R\u00f4les de l''utilisateur
+assignments.no.roles=Aucun r\u00f4le d''assign\u00e9
+assignments.available.roles=R\u00f4les disponibles :
+assignments.assigned.roles=R\u00f4les assign\u00e9s :
+assignments.resource.roles=R\u00f4les pour les ressources :
+assignments.submit=Envoyer
+assignments.reset=R\u00e9initialiser
+assignments.add.roles=Ajouter les r\u00f4les s\u00e9lectionn\u00e9es
+assignments.remove.roles=Retitrer les r\u00f4les s\u00e9lectionn\u00e9es
+assignments.no.roles.to.grant=Aucun r\u00f4le de disponible \u00e0 promouvoir.
+
+# --------------------------------------------------
+# createAdmin
+# --------------------------------------------------
+create.admin.page.title=Cr\u00e9ation d''un administrateur
+create.admin.section.title=Cr\u00e9ation d''un administrateur
+create.admin=Cr\u00e9er l''administrateur
+
+# --------------------------------------------------
+# operationList
+# --------------------------------------------------
+operation.list.page.title=[Admin] Liste des op\u00e9rations
+operation.list.section.title=[Admin] Liste des op\u00e9rations
+operation.list.no.operations.available=Aucune op\u00e9ration disponible
+
+# --------------------------------------------------
+# permissionList
+# --------------------------------------------------
+permission.list.page.title=[Admin] Liste des permissions
+permission.list.section.title=[Admin] Liste des permissions
+permission.list.no.permissions.available=Aucune persmission disponible
+
+# --------------------------------------------------
+# resourceList
+# --------------------------------------------------
+resource.list.page.title=[Admin] Liste des ressources
+resource.list.section.title=[Admin] Liste des ressources
+resource.list.no.resources.available=Aucune ressource disponible
+
+# --------------------------------------------------
+# role
+# --------------------------------------------------
+role.page.title=[Admin] Visualisation des r\u00f4les
+role.section.title=Page de modification des r\u00f4les
+role.assignable=Assignable ?
+role.currently.assigned.permissions=Permissions actuellement assign\u00e9es :
+role.add.new.permission=Ajouter une nouvelle permission
+role.currently.assigned.roles=R\u00f4les actuellement assign\u00e9s :
+role.add.sub.role=Ajouter un sous-r\u00f4le
+role.operation=Op\u00e9ration
+role.resource=Ressource
+
+# --------------------------------------------------
+# roleEdit
+# --------------------------------------------------
+role.edit.no.parent.defined=Aucun r\u00f4le parent d\u00e9fini pour ce r\u00f4le
+role.edit.no.childrole.defined=Aucun r\u00f4le enfant d\u00e9fini pour ce r\u00f4le
+role.edit.users.defined.in.current.role=Utilisateurs d\u00e9fini avec ce r\u00f4le
+role.edit.users.defined.in.parent.roles=Utilisateurs d\u00e9fini avec un r\u00f4le parent
+role.edit.section.users=Liste des utilisateurs
+role.edit.no.user.defined=Aucun utilisateur d\u00e9fini pour ce r\u00f4le
+cannot.assign.role=Impossible de mettre a jour l''utilisateur ''{0}'' : {1}
+
+# --------------------------------------------------
+# roleCreate
+# --------------------------------------------------
+role.create.page.title=[Admin] Cr\u00e9ation d''un r\u00f4le
+role.create.section.title=[Admin] Cr\u00e9ation d''un r\u00f4le
+role.create.operation=Op\u00e9ration
+role.create.resource=Ressource
+role.create.no.permissions.defined=Aucune permission d\u00e9finie pour ce r\u00f4le
+role.create.add.permission=Ajouter permission
+
+# --------------------------------------------------
+# roleList
+# --------------------------------------------------
+role.list.page.title=[Admin] Liste des r\u00f4les
+role.list.section.title=[Admin] Liste des r\u00f4les
+role.list.no.roles.available=Aucun r\u00f4le disponible
+
+# --------------------------------------------------
+# roleModel
+# --------------------------------------------------
+role.model.page.title=[Admin] Mod\u00e8le des r\u00f4les
+role.model.section.title=[Admin] Mod\u00e8le des r\u00f4les
+role.model.message=Voici les ressources, les op\u00e9rations et les mod\u00e8les de r\u00f4le qui sont connus par le gestionnaire de r\u00f4le. Ce n''est pas le contenu courant de l''entrep\u00f4t de RBAC car il contient les \u00e9l\u00e9ments list\u00e9 ci-apr\u00e8s ET toutes les donn\u00e9es dynamiques cr\u00e9\u00e9es depuis la cr\u00e9ation de nouveaux r\u00f4les depuis les templates ci-apr\u00e8s.
+role.model.id=Id
+role.model.name=Nom
+role.model.name.prefix=Nom du pr\u00e9fixe
+role.model.permanent=Permanent
+role.model.assignable=Assignable
+role.model.delimeter=D\u00e9limiteur
+role.model.operation.id=Id de l''operation
+role.model.resource.id=Id de la ressource
+role.model.role.id=Id du R\u00f4le
+role.model.parent.roles=R\u00f4les parents
+role.model.child.roles=R\u00f4les enfants
+role.model.templates=Mod\u00e8les
+role.model.template.id=Id du Mod\u00e8le
+role.model.parent.templates=Mod\u00e8les parent
+role.model.child.templates=Mod\u00e8les enfants
+
+# --------------------------------------------------
+# roleSummary
+# --------------------------------------------------
+role.summary.page.title=[Admin] R\u00e9sum\u00e9 du r\u00f4le
+role.summary.section.title=[Admin] R\u00e9sum\u00e9 du r\u00f4le
+
+# --------------------------------------------------
+# systemInformation
+# --------------------------------------------------
+system.info.page.title=[Admin] Informations syst\u00e8mes
+system.info.section.title=Informations du syst\u00e8me de s\u00e9curit\u00e9
+
+# --------------------------------------------------
+# userCreate
+# --------------------------------------------------
+user.create.page.title=[Admin] Cr\u00e9ation d''utilisateur
+user.create.section.title=[Admin] Cr\u00e9ation d''utilisateur
+user.create=Cr\u00e9er l''utilisateur
+
+# --------------------------------------------------
+# userDelete
+# --------------------------------------------------
+user.delete.page.title=[Admin] Suppression de l''utilisateur
+user.delete.section.title=[Admin] Suppression de l''utilisateur
+user.delete.message=L''utilisateur suivant va \u00eatre supprim\u00e9
+user.delete=Supprimer l''utilisateur
+
+# --------------------------------------------------
+# userEdit
+# --------------------------------------------------
+user.edit.page.title=[Admin] \u00c9dition de l''utilisateur
+user.edit.section.title=[Admin] \u00c9dition de l''utilisateur
+user.edit.locked.user=Utilisateur verrouill\u00e9
+user.edit.force.user.change.password=Forcer l''utilisateur \u00e0 changer son mot de passe
+user.edit.roles=\u00c9diter les r\u00f4les
+
+# --------------------------------------------------
+# userFind
+# --------------------------------------------------
+user.find=Trouver un utilisateur
+
+# --------------------------------------------------
+# userList
+# --------------------------------------------------
+user.list.page.title=[Admin] Liste des utilisateurs
+user.list.section.title=[Admin] Liste des utilisateurs dans le r\u00f4le : {0}
+user.list.permanent=Permanent
+user.list.validated=Valid\u00e9
+user.list.locked=Verrouill\u00e9
+user.list.tasks=T\u00e2ches
+user.list.tools=Outils
+user.list.reports=Rapports
+user.list.message=Les outils suivants sont disponibles pour les administrateurs pour manipuler la liste des utilisateurs.
+user.list.create.new.user=Cr\u00e9er un nouvel utilisateur
+user.list.show.users.in.role=Afficher utilisateurs dans le r\u00f4le
+user.list.types=Types
+
+# --------------------------------------------------
+# backupRestore
+# --------------------------------------------------
+backupRestore.page.title=Sauvegarde et restauration
+backupRestore.section.backup.title=Sauvegarde
+backupRestore.section.restore.title=Restauration
+backupRestore.section.recent.backup=Sauvegardes r\u00e9centes
+backupRestore.backup.error = Fichier de sauvegarde non trouv\u00e9
+backupRestore.backup.empty.error = Le r\u00e9pertoire de sauvegarde est vide
+
+# --------------------------------------------------
+# Logging Section
+#
+# General - These are localizations that are used by multiple classes.
+# If you can't find the text under each class, you can find it here.
+# --------------------------------------------------
+log.password.reset.request=Demande de r\u00e9initialisation du mot de passe pour l''utilisateur '{}'
+log.password.change=Mot de passe chang\u00e9 pour l''utilisateur '{}'
+log.account.validation=Compte valid\u00e9 pour l''utilisateur '{}'
+log.account.create=Utilisateur cr\u00e9\u00e9 : '{}'
+log.account.edit=Utilisateur modifi\u00e9 : '{}'
+log.account.delete=Utilisateur supprim\u00e9 : '{}'
+log.login.success=Connexion r\u00e9ussie pour l''utilisateur '{}'
+log.logout.success=D\u00e9connexion de l''utilisateur '{}'
+log.login.fail=\u00c9chec de connexion pour l''utilisateur '{}'
+log.login.fail.locked=\u00c9chec de connexion pour l''utilisateur '{}' (compte v\u00e9rouill\u00e9)
+log.assign.role=R\u00f4le assign\u00e9 \u0224 l''utilisateur '{}': '{}'
+log.revoke.role=R\u00f4le retir\u00e9 \u0224 l''utilisateur '{}': '{}'
+log.role.create=R\u00f4le cr\u00e9\u00e9 : '{}'
+log.role.edit=R\u00f4le modifi\u00e9 : '{}'
+
+# --------------------------------------------------
+# changePasswordSuccess
+# --------------------------------------------------
+change.password.page.title=Changer le mot de passe
+change.password.success.section.title=Mot de passe chang\u00e9 avec succ\u00e8s
\ No newline at end of file
--- /dev/null
+#*
+ * 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.
+ *#
+
+
+Welcome
+
+Username: $accountId
+
+This account was requested on $requestedOn
+
+Use the following URL to validate your account.
+
+$applicationUrl/$urlPath?validateMe=$authkey
+
+This url will be valid until $expiresOn
+
+Once validated, your account will only have the most basic rights on the system.
+Please contact the administrator to be assigned a more appropriate set of Roles
+and Permissions.
+
+Please keep this email for future reference.
+
+#if ( $feedback )
+Questions/Comments? $feedback
+#end
+
+
--- /dev/null
+#*
+ * 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.
+ *#
+
+
+Password Reset
+
+Username: $accountId
+
+Someone requested a password reset for this account on $requestedOn
+
+Use the following URL to reset the password on your account.
+
+$applicationUrl/$urlPath?resetPassword=$authkey
+
+This url will be valid until $expiresOn
+
+#if ( $feedback )
+Questions/Comments? $feedback
+#end
+
+
+++ /dev/null
-# 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.
-
-# --------------------------------------------------
-# Classes Section
-#
-# General - These are localizations that are used by multiple classes.
-# If you can't find the text under each class, you can find it here.
-# --------------------------------------------------
-username.required=User Name is required.
-username.has.spaces=User Name can not have spaces.
-password.confimation.failed=Password confirmation failed. Passwords do not match.
-password.provided.does.not.match.existing=Password provided does not match existing.
-old.password.required=Current password is required.
-user.admin.password.required=User admin password is required when updating a user account. Please provide your password to validate identification.
-user.admin.password.does.not.match.existing=The password you provided does not match your existing password.
-user.does.not.exist=User ''{0}'' does not exist.
-user.not.found.exception=There was an error looking for the user ''{0}'': {1}
-save.role.success=Successfully Saved Role ''{0}''
-cannot.get.role=Unable to get Role ''{0}'': {1}
-invalid.user.credentials=Invalid user credentials.
-user.already.exists=User ''{0}'' already exists.
-cannot.edit.user.null.username=Unable to edit user with null username.
-cannot.edit.user.empty.username=Unable to edit user with empty username.
-cannot.get.user=Unable to get User ''{0}'': {1}
-cannot.edit.user.null.credentials=Unable to edit user with null user credentials.
-cannot.operate.on.null.user=Unable to operate on null user.
-user.not.found=User not found.
-
-# --------------------------------------------------
-# AbstractUserCredentialsAction
-# --------------------------------------------------
-fullName.required=Full Name is required.
-email.required=Email Address is required.
-email.invalid=Email Address is invalid.
-password.required=Password is required.
-passwords.does.not.match=Passwords do not match.
-username.invalid.characters=Invalid characters found in Username.
-fullName.invalid.characters=Invalid characters found in Full Name.
-
-# --------------------------------------------------
-# AccountAction
-# --------------------------------------------------
-cannot.show.account.login.required=Unable to show your account. Not logged in.
-
-# --------------------------------------------------
-# LoginAction
-# --------------------------------------------------
-reset.password.missing=Reset Password key missing.
-cannot.find.key=Unable to find the key.
-cannot.find.key.at.the.moment=Unable to process key at this time. Please try again later.
-cannot.find.user=Unable to find user.
-validation.failure.key.missing=Validation failure key missing.
-incorrect.username.password=You have entered an incorrect username and/or password.
-account.validation.required=You have entered an incorrect username and/or password.
-authentication.failed=Authentication failed.
-authentication.exception=There was an error in the authentication process: {0}
-account.locked=Your Account is Locked.
-login.already.logged.in=You are already logged in.
-
-# --------------------------------------------------
-# PasswordAction
-# --------------------------------------------------
-newPassword.cannot.be.empty=New Password cannot be empty.
-cannot.update.user.not.found=Unable to update user ''{0}'' not found.
-admin.deleted.account=Likely occurs because an Administrator deleted your account.
-
-# --------------------------------------------------
-# PasswordResetAction
-# --------------------------------------------------
-username.cannot.be.empty=Username cannot be empty.
-password.reset.success=If the user was found, a message has been sent.
-password.reset.failure=If the user was found, a message has been sent.
-password.reset.email.generation.failure=Internal system error prevented generation of Password reset email.
-password.previous.empty=Previous password cannot be empty.
-password.empty=Password cannot be empty.
-password.confirmation.empty=Password confirmation cannot be empty.
-password.confirmation.same="password and password confirmation must be the same.
-
-# --------------------------------------------------
-# RegisterAction
-# --------------------------------------------------
-assign.role.failure=Unable to assign core register user role to new user.
-cannot.register.user=Unable to process new user registration request.
-
-# --------------------------------------------------
-# AddAdminUserAction
-# --------------------------------------------------
-invalid.admin.credentials=Invalid admin credentials, try again.
-admin.user.already.exists=Admin User exists in database (someone else probably created the user before you).
-cannot.assign.admin.role=Unable to assign system administrator role.
-
-# --------------------------------------------------
-# AssignmentsAction
-# --------------------------------------------------
-rbac.edit.user.empty.principal=Cannot use AssignmentsAction for RBAC Edit User with an empty principal.
-error.adding.selected.roles=Error adding the selected roles: {0}
-error.removing.selected.roles=Error removing the selected roles: {0}
-
-# --------------------------------------------------
-# EditRoleAction
-# --------------------------------------------------
-cannot.edit.null.role=Unable to edit null role name.
-cannot.edit.empty.role=Unable to edit empty role name.
-cannot.operate.null.role=Unable to operate on null role.
-
-# --------------------------------------------------
-# OperationsAction
-# --------------------------------------------------
-cannot.list.all.operations=Unable to list all operations: {0}
-cannot.save.operation=Unable to save operation: {0}.
-cannot.remove.operation=Unable to remove operation ''{0}''.
-
-# --------------------------------------------------
-# PermissionsAction
-# --------------------------------------------------
-cannot.list.all.permissions=Unable to list all permissions: {0}
-cannot.edit.null.permission=Unable to edit null permission name.
-cannot.edit.empty.permission=Unable to edit empty permission name.
-cannot.operate.null.permission=Unable to operate on null permission.
-cannot.get.permission=Unable to get Permission ''{0}'': {1}
-save.permission.success=Successfully Saved Permission ''{0}''
-
-# --------------------------------------------------
-# ReportAction
-# --------------------------------------------------
-cannot.get.report=Unable to find report: {0}
-cannot.generate.report=Unable to generate report.
-
-# --------------------------------------------------
-# ResourcesAction
-# --------------------------------------------------
-cannot.list.all.resources=Unable to list all resources: {0}
-cannot.save.resource=Unable to save resource: {0}
-cannot.remove.resource=Unable to locate resource to remove ''{0}''
-
-# --------------------------------------------------
-# RoleCreateAction
-# --------------------------------------------------
-cannot.add.null.permission=Unable to add null permission.
-cannot.add.empty.role=Unable to create role with empty name.
-roleName.invalid.characters=Invalid characters found in role name.
-
-# --------------------------------------------------
-# RolesAction
-# --------------------------------------------------
-cannot.list.all.roles=Unable to list all roles: {0}
-
-# --------------------------------------------------
-# UserDeleteAction
-# --------------------------------------------------
-cannot.remove.user.null.username=Unable to delete user based on null username.
-cannot.remove.user.empty.username=Unable to delete user based on empty username.
-cannot.remove.user.not.found=Unable to locate user {0} to delete.
-cannot.remove.user.role=Unable to remove user role assignments for ''{0}'' because {1}
-cannot.remove.user.non.existent=Unable to delete non-existent user ''{0}''
-
-# --------------------------------------------------
-# JSP Section
-#
-# General - These are localizations that are used by multiple JSPs.
-# If you can't find the text under each JSP, you can find it here.
-# --------------------------------------------------
-username=Username
-full.name=Full Name
-email=Email
-email.address=Email Address
-password=Password
-current.password=Current Password
-new.password=New Password
-confirm.password=Confirm Password
-user.admin.password=Password
-register=Register
-login=Login
-logout=Logout
-submit=Submit
-remove=Remove
-delete=Delete
-update=Update
-search=Search
-cancel=Cancel
-goback=Go Back
-edit=Edit
-save=Save
-name=Name
-description=Description
-role.name=Role Name
-role.description=Role Description
-remove.selected.roles=Remove Selected Roles
-role=Role
-roles=Roles
-effective.roles=Effective Roles
-permissions=Permissions
-operations=Operations
-resources=Resources
-
-# --------------------------------------------------
-# accessDenied
-# --------------------------------------------------
-access.denied.page.title=Security Alert - Access Denied
-access.denied.section.title=Security Alert - Access Denied
-access.denied.message=The action you attempted requires permissions that you do not have.<br>Please contact your administrator to be granted the appropriate permissions.
-
-# --------------------------------------------------
-# invalid token (for CSRF)
-# --------------------------------------------------
-invalid.token.page.title=Security Alert - Invalid Token Found
-invalid.token.section.title=Security Alert - Invalid Token Found
-invalid.token.message=Possible CSRF attack detected! Invalid token found in the request.
-
-# --------------------------------------------------
-# account
-# --------------------------------------------------
-account.details.page.title=Account Details
-account.details.section.title=Account Details
-
-# --------------------------------------------------
-# alert
-# --------------------------------------------------
-alert.page.title=Security Alert Page
-alert.message=You are not authorized for this activity.
-
-# --------------------------------------------------
-# generalError
-# --------------------------------------------------
-general.error.page.title=Error Occurred
-general.error.section.title=Error Occurred
-
-# --------------------------------------------------
-# login
-# --------------------------------------------------
-login.page.title=Login Page
-login.section.title=Login
-login.remember.me=Remember Me
-login.need.an.account=Need an Account?
-login.register=Register!
-login.forgot.your.password=Forgot your Password?
-login.request.password.reset=Request a password reset.
-
-# --------------------------------------------------
-# password
-# --------------------------------------------------
-password.page.title=Change Password
-password.section.title=Change Password
-password.existing=Existing Password
-password.new=New Password
-password.new.confirm=Confirm New Password
-password.change=Change Password
-
-# --------------------------------------------------
-# passwordResetNotification
-# --------------------------------------------------
-password.reset.page.title=Password Reset
-password.reset.message=Password Reset Successful.
-password.reset.go.to=Go to
-
-# --------------------------------------------------
-# register
-# --------------------------------------------------
-register.page.title=Registration Page
-register.section.title=Register for an Account
-
-# --------------------------------------------------
-# requestPasswordReset
-# --------------------------------------------------
-request.password.reset.page.title=Request Password Reset
-request.password.reset.section.title=Request Password Reset
-request.password.reset=Request Reset
-
-# --------------------------------------------------
-# requiresAuthentication
-# --------------------------------------------------
-requires.authentication.page.title=Security Alert - Action Requires Authentication
-requires.authentication.section.title=Security Alert - Action Requires Authentication
-requires.authentication.message=The action you attempted requires that you authenticate yourself.
-requires.authentication.go.ahead=Go Ahead
-
-# --------------------------------------------------
-# validationNotification
-# --------------------------------------------------
-validation.notification.page.title=Validation Notification Page
-validation.notification.section.title=Validation Reminder
-validation.notification.message.1=A validation email has been sent to the email address you provided ({0}). Please check for the email validation link sent to you.
-validation.notification.message.2=This account ({0}) will remain locked until it is validated.
-
-# --------------------------------------------------
-# grantRoles
-# --------------------------------------------------
-grant=Grant
-
-# --------------------------------------------------
-# securityLinks
-# --------------------------------------------------
-current.user=Current User:
-unknown.user=Unknown User
-edit.details=Edit Details
-notify.password.expiration=Password will expire on
-
-# --------------------------------------------------
-# userCredentials
-# --------------------------------------------------
-account.creation=Account Creation
-last.login=Last Login
-last.password.change=Last Password Change
-
-# --------------------------------------------------
-# assignments
-# --------------------------------------------------
-assignments.page.title=[Admin] User Edit
-assignments.section.title=[Admin] User Roles
-assignments.no.roles=No Roles Assigned (yet)
-assignments.available.roles=Available Roles:
-assignments.assigned.roles=Assigned Roles:
-assignments.resource.roles=Resource Roles:
-assignments.submit=Submit
-assignments.reset=Reset
-assignments.add.roles=Add Selected Roles
-assignments.remove.roles=Remove Selected Roles
-assignments.no.roles.to.grant=No Roles Available to Grant
-
-# --------------------------------------------------
-# createAdmin
-# --------------------------------------------------
-create.admin.page.title=Create Admin User
-create.admin.page.link=Create Admin User
-create.admin.section.title=Create Admin User
-create.admin=Create Admin
-
-# --------------------------------------------------
-# operationList
-# --------------------------------------------------
-operation.list.page.title=[Admin] Operation List
-operation.list.section.title=[Admin] Operation List
-operation.list.no.operations.available=No Operations Available
-
-# --------------------------------------------------
-# permissionList
-# --------------------------------------------------
-permission.list.page.title=[Admin] Permission List
-permission.list.section.title=[Admin] Permission List
-permission.list.no.permissions.available=No Permissions Available
-
-# --------------------------------------------------
-# resourceList
-# --------------------------------------------------
-resource.list.page.title=[Admin] Resource List
-resource.list.section.title=[Admin] Resource List
-resource.list.no.resources.available=No Resources Available
-
-# --------------------------------------------------
-# role
-# --------------------------------------------------
-role.page.title=[Admin] Role Viewer
-role.section.title=Role Modification Page
-role.assignable=Assignable?
-role.currently.assigned.permissions=Currently Assigned Permissions:
-role.add.new.permission=Add New Permission
-role.currently.assigned.roles=Currently Assigned Roles:
-role.add.sub.role=Add Sub Role
-role.operation=Operation
-role.resource=Resource
-
-# --------------------------------------------------
-# roleEdit
-# --------------------------------------------------
-role.edit.no.parent.defined=No Parent Roles Defined for this Role
-role.edit.no.childrole.defined=No Child Roles Defined for this Role
-role.edit.users.defined.in.current.role=Users defined with the current role
-role.edit.users.defined.in.parent.roles=Users defined with parent roles
-role.edit.section.users=List of Users
-role.edit.no.user.defined=No Users Defined for this Role
-cannot.assign.role=Unable to update user ''{0}'' : {1}
-
-# --------------------------------------------------
-# roleCreate
-# --------------------------------------------------
-role.create.page.title=[Admin] Create Role
-role.create.section.title=[Admin] Create Role
-role.create.operation=Operation
-role.create.resource=Resource
-role.create.no.permissions.defined=No Permissions Defined for this Role
-role.create.add.permission=Add Permission
-
-# --------------------------------------------------
-# roleList
-# --------------------------------------------------
-role.list.page.title=[Admin] Role List
-role.list.section.title=[Admin] Role List
-role.list.no.roles.available=No Roles Available
-
-# --------------------------------------------------
-# roleModel
-# --------------------------------------------------
-role.model.page.title=[Admin] Role Model
-role.model.section.title=[Admin] Role Model
-role.model.message=These are the resources, operations, roles and role templates that are known by the role manager. They are not the current content of the RBAC store as those contain the resource, operations, and roles declared below _and_ any dynamic data created from creating new roles from the templates below.
-role.model.id=Id
-role.model.name=Name
-role.model.name.prefix=Name Prefix
-role.model.permanent=Permanent
-role.model.assignable=Assignable
-role.model.delimeter=Delimeter
-role.model.operation.id=Operation Id
-role.model.resource.id=Resource Id
-role.model.role.id=Role Id
-role.model.parent.roles=Parent Roles
-role.model.child.roles=Child Roles
-role.model.templates=Templates
-role.model.template.id=Template Id
-role.model.parent.templates=Parent Templates
-role.model.child.templates=Child Templates
-
-# --------------------------------------------------
-# roleSummary
-# --------------------------------------------------
-role.summary.page.title=[Admin] Role Summary
-role.summary.section.title=[Admin] Role Summary
-
-# --------------------------------------------------
-# systemInformation
-# --------------------------------------------------
-system.info.page.title=[Admin] System Information
-system.info.section.title=Security System Information
-
-# --------------------------------------------------
-# userCreate
-# --------------------------------------------------
-user.create.page.title=[Admin] User Create
-user.create.section.title=[Admin] User Create
-user.create=Create User
-
-# --------------------------------------------------
-# userDelete
-# --------------------------------------------------
-user.delete.page.title=[Admin] User Delete
-user.delete.section.title=[Admin] User Delete
-user.delete.message=The following user will be deleted
-user.delete=Delete User
-
-# --------------------------------------------------
-# userEdit
-# --------------------------------------------------
-user.edit.page.title=[Admin] User Edit
-user.edit.confirm.page.title=[Admin] User Edit - Confirm Administrator Password
-user.edit.section.title=[Admin] User Edit
-user.edit.confirm.section.title=[Admin] User Edit - Confirm Administrator Password
-user.edit.locked.user=Locked User
-user.edit.force.user.change.password=Force User to Change Password
-user.edit.roles=Edit Roles
-has.hidden.roles=Some roles above your permission level have been omitted
-
-# --------------------------------------------------
-# userFind
-# --------------------------------------------------
-user.find=Find a user
-
-# --------------------------------------------------
-# userList
-# --------------------------------------------------
-user.list.page.title=[Admin] User List
-user.list.section.title=[Admin] List of Users in Role: {0}
-user.list.permanent=Permanent
-user.list.validated=Validated
-user.list.locked=Locked
-user.list.tasks=Tasks
-user.list.tools=Tools
-user.list.reports=Reports
-user.list.message=The following tools are available for administrators to manipulate the user list.
-user.list.create.new.user=Create New User
-user.list.show.users.in.role=Show Users In Role
-user.list.types=Types
-
-# --------------------------------------------------
-# backupRestore
-# --------------------------------------------------
-backupRestore.page.title=Backup and Restore
-backupRestore.section.backup.title=Backup
-backupRestore.section.restore.title=Restore
-backupRestore.section.recent.backup=Recent Backups
-backupRestore.backup.error = Backup File Not Found
-backupRestore.backup.empty.error = Backup directory is required
-
-# --------------------------------------------------
-# Logging Section
-#
-# General - These are localizations that are used by multiple classes.
-# If you can't find the text under each class, you can find it here.
-# --------------------------------------------------
-log.password.reset.request=Password Reset Request for user '{}'
-log.password.change=Password Changed for user '{}'
-log.account.validation=Account Validated for user '{}'
-log.account.create=User Created: '{}'
-log.account.edit=User Modified: '{}'
-log.account.delete=User Deleted: '{}'
-log.login.success=Successful Login for user '{}'
-log.logout.success=Logged Out user '{}'
-log.login.fail=Login Failure for user '{}'
-log.login.fail.locked=Login Failure for user '{}' (account locked)
-log.assign.role=Role Assigned to user '{}': '{}'
-log.revoke.role=Role Revoked from user '{}': '{}'
-log.role.create=Role Created: '{}'
-log.role.edit=Role Modified: '{}'
-
-# --------------------------------------------------
-# changePasswordSuccess
-# --------------------------------------------------
-change.password.page.title=Change Password
-change.password.success.section.title=Password successfully changed
\ No newline at end of file
+++ /dev/null
-# 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.
-
-# --------------------------------------------------
-# Classes Section
-#
-# General - These are localizations that are used by multiple classes.
-# If you can't find the text under each class, you can find it here.
-# --------------------------------------------------
-username.required=Es mu\u00DF ein Benutzername angegeben werden.
-username.has.spaces=Benutzername darf keine Leerzeichen enthalten.
-password.confimation.failed=Das Passwort und die Passwortbest\u00E4tigung stimmen nicht \u00FCberein.
-password.provided.does.not.match.existing=Das angegebene Passwort stimmt nicht mit dem existierenden \u00FCberein.
-user.does.not.exist=Der Benutzer ''{0}'' existiert nicht.
-user.not.found.exception=Fehler beim Beauskunften des Benutzers ''{0}'': {1}
-save.role.success=Rolle ''{0}'' erfolgreich aktualisiert.
-cannot.get.role=Ermittlung der Rolle ''{0}'' nicht m\u00F6glich: {1}
-invalid.user.credentials=Ung\u00FCltige Benutzer Legitimiationsdaten.
-user.already.exists=Der Benutzer ''{0}'' existiert bereits.
-cannot.edit.user.null.username=Bearbeitung eines Benutzers mit leerem Namen nicht m\u00F6glich.
-cannot.edit.user.empty.username=Bearbeitung eines Benutzers ohne Namen nicht m\u00F6glich.
-cannot.get.user=Ermittlung des Benutzers ''{0}'' nicht m\u00F6glich: {1}
-cannot.edit.user.null.credentials=Bearbeitung eines Benutzers mit leeren Legitimationsdaten nicht m\u00F6glich.
-cannot.operate.on.null.user=Verarbeitung leerer Benutzer nicht m\u00F6glich.
-
-# --------------------------------------------------
-# AbstractUserCredentialsAction
-# --------------------------------------------------
-fullName.required=Es mu\u00DF ein vollst\u00E4ndiger Name angegeben werden.
-email.required=Es mu\u00DF eine E-Mail-Adresse angegeben werden.
-email.invalid=Ung\u00FCltige E-Mail-Adresse.
-password.required=Es mu\u00DF ein Passwort angegeben werden.
-passwords.does.not.match=Die Passw\u00F6rter stimmen nicht \u00FCberein.
-
-# --------------------------------------------------
-# AccountAction
-# --------------------------------------------------
-cannot.show.account.login.required=Anzeige Ihres Kontos nicht m\u00F6glich. Sie sind nicht angemeldet.
-
-# --------------------------------------------------
-# LoginAction
-# --------------------------------------------------
-reset.password.missing=Schl\u00FCssel der Passwort-Zur\u00FCcksetzung nicht gefunden.
-cannot.find.key=Schl\u00FCssel nicht gefunden.
-cannot.find.key.at.the.moment=Der Schl\u00FCssel kann momentan nicht verarbeitet werden. Bitte versuchen Sie es sp\u00E4ter erneut.
-cannot.find.user=Benutzer nicht gefunden.
-validation.failure.key.missing=Validierungsfehler, Schl\u00FCssel fehlt.
-incorrect.username.password=Sie haben eine ung\u00FCltige Kombination von Benutzername und Passwort angegeben.
-account.validation.required=Es wurde eine ung\u00FCltige Kombination von Benutzername und Passwort angegeben.
-authentication.failed=Authentifizierung fehlgeschlagen.
-authentication.exception=Fehler bei der Authentifizierung: {0}
-account.locked=Ihr Konto ist gesperrt.
-login.already.logged.in=Sie sind bereits authentifiziert.
-
-# --------------------------------------------------
-# PasswordAction
-# --------------------------------------------------
-newPassword.cannot.be.empty=Das neue Passwort darf nicht leer sein.
-cannot.update.user.not.found=Aktualisierung nicht m\u00F6glich. Benutzer ''{0}'' nicht gefunden.
-admin.deleted.account=Tritt meistens auf, wenn ein Administrator Ihr Konto gel\u00F6scht hat.
-
-# --------------------------------------------------
-# PasswordResetAction
-# --------------------------------------------------
-username.cannot.be.empty=Benutzername darf nicht leer sein.
-password.reset.success=Es wurde eine Nachricht versendet, sollte der Benutzer ermittelt worden sein.
-password.reset.failure=Es wurde eine Nachricht versendet, sollte der Benutzer ermittelt worden sein.
-password.reset.email.generation.failure=Ein interner Systemfehler hat die Erstellung der E-Mail zur Zur\u00FCcksetzung des Passwortes verhindert.
-
-# --------------------------------------------------
-# RegisterAction
-# --------------------------------------------------
-assign.role.failure=Die ''registered-user'' Rolle konnte nicht zugewiesen werden.
-cannot.register.user=Verarbeitung der Registrierungs-Anfrage nicht m\u00F6glich.
-
-# --------------------------------------------------
-# AddAdminUserAction
-# --------------------------------------------------
-invalid.admin.credentials=Ung\u00FCltige Administrations-Legitimationsdaten. Bitte versuchen Sie es erneut.
-admin.user.already.exists=Der Administrator existiert bereits. Evtl. wurde der Administrator bereits von jemand anderem angelegt, bevor Sie die M\u00F6glichkeit dazu hatten.
-cannot.assign.admin.role=System-Administrator Rolle kann nicht zugewiesen werden.
-
-# --------------------------------------------------
-# AssignmentsAction
-# --------------------------------------------------
-rbac.edit.user.empty.principal=RBAC Benutzer-Aktualisierung mir leerer Identit\u00E4t nicht m\u00F6glich.
-error.adding.selected.roles=Fehler beim Hinzuf\u00FCgen der ausgew\u00E4hlten Rollen: {0}
-error.removing.selected.roles=Fehler beim Entfernen der ausgew\u00E4hlten Rollen: {0}
-
-# --------------------------------------------------
-# EditRoleAction
-# --------------------------------------------------
-cannot.edit.null.role=Bearbeitung einer Rolle mit leerem Namen nicht m\u00F6glich.
-cannot.edit.empty.role=Bearbeitung einer Rolle ohne Namen nicht m\u00F6glich.
-cannot.operate.null.role=Verarbeitung leerer Rollen nicht m\u00F6glich.
-
-# --------------------------------------------------
-# OperationsAction
-# --------------------------------------------------
-cannot.list.all.operations=Ermittlung der Operationen nicht m\u00F6glich: {0}
-cannot.save.operation=Aktualisierung der Operation nicht m\u00F6glich: {0}.
-cannot.remove.operation=Entfernung der Operation ''{0}'' nicht m\u00F6glich.
-
-# --------------------------------------------------
-# PermissionsAction
-# --------------------------------------------------
-cannot.list.all.permissions=Ermittlung der Berechtigungen nicht m\u00F6glich: {0}
-cannot.edit.null.permission=Bearbeitung einer Berechtigung mit leerem Namen nicht m\u00F6glich.
-cannot.edit.empty.permission=Bearbeitung einer Berechtigung ohne Namen nicht m\u00F6glich.
-cannot.operate.null.permission=Verarbeitung leerer Berechtigungen nicht m\u00F6glich.
-cannot.get.permission=Ermittlung der Berechtigung ''{0}'' nicht m\u00F6glich: {1}
-save.permission.success=Berechtigung ''{0}'' erfolgreich aktualisiert.
-
-# --------------------------------------------------
-# ReportAction
-# --------------------------------------------------
-cannot.get.report=Ermittlung des Berichts nicht m\u00F6glich: {0}
-cannot.generate.report=Erstellung des Berichts nicht m\u00F6glich.
-
-# --------------------------------------------------
-# ResourcesAction
-# --------------------------------------------------
-cannot.list.all.resources=Ermittlung der Resourcen nicht m\u00F6glich: {0}
-cannot.save.resource=Aktualisierung der Resouce nicht m\u00F6glich: {0}
-cannot.remove.resource=Zu l\u00F6schende Resource nicht gefunden ''{0}''
-
-# --------------------------------------------------
-# RoleCreateAction
-# --------------------------------------------------
-cannot.add.null.permission=Hinzuf\u00FCgen einer leeren Berechtigung nicht m\u00F6glich.
-cannot.add.empty.role=Erstellung einer Rolle mit leerem Namen nicht m\u00F6glich.
-
-# --------------------------------------------------
-# RolesAction
-# --------------------------------------------------
-cannot.list.all.roles=Ermittlung der Rollen nicht m\u00F6glich: {0}
-
-# --------------------------------------------------
-# UserDeleteAction
-# --------------------------------------------------
-cannot.remove.user.null.username=L\u00F6schung eines Benutzers auf Basis eines leeren Benutzernamens nicht m\u00F6glich.
-cannot.remove.user.empty.username=L\u00F6schung eines Benutzers mit leerem Namen nicht m\u00F6glich.
-cannot.remove.user.not.found=L\u00F6schung des Benutzers ''{0}'' nicht m\u00F6glich. Benutzer nicht gefunden.
-cannot.remove.user.role=L\u00F6schung der Rollen-Zuweisung f\u00FCr ''{0}'' nicht m\u00F6glich. {1}
-cannot.remove.user.non.existent=L\u00F6schung des nicht existierenden Benutzers ''{0}'' nicht m\u00F6glich.
-
-# --------------------------------------------------
-# JSP Section
-#
-# General - These are localizations that are used by multiple JSPs.
-# If you can't find the text under each JSP, you can find it here.
-# --------------------------------------------------
-username=Benutzername
-full.name=Vollst\u00E4ndiger Name
-email=E-Mail
-email.address=E-Mail Adresse
-password=Passwort
-current.password=Aktuelles Passwort
-new.password=Neues Passwort
-confirm.password=Passwortbest\u00E4tigung
-register=Registrieren
-login=Anmelden
-logout=Abmelden
-submit=\u00DCbertragen
-remove=Entfernen
-delete=L\u00F6schen
-update=Aktualisieren
-search=Suchen
-cancel=Abbrechen
-name=Name
-description=Beschreibung
-role.name=Rollenname
-role.description=Rollenbeschreibung
-remove.selected.roles=Ausgew\u00E4hlte Rollen entfernen
-role=Rolle
-roles=Rollen
-effective.roles=Effektive Rollen
-permissions=Berechtigungen
-operations=Operationen
-resources=Resourcen
-
-# --------------------------------------------------
-# accessDenied
-# --------------------------------------------------
-access.denied.page.title=Sicherheits Hinweis - Zugang verweigert
-access.denied.section.title=Sicherheits Hinweis - Zugang verweigert
-access.denied.message=Sie haben nicht die erforderlichen Berechtigungen zur Ausf\u00FChrung des Vorgangs.<br>Bitte kontaktieren Sie Ihren Administrator, um entsprechende Berechtigungen erteilt zu bekommen.
-
-# --------------------------------------------------
-# account
-# --------------------------------------------------
-account.details.page.title=Kontodetails
-account.details.section.title=Kontodetails
-
-# --------------------------------------------------
-# alert
-# --------------------------------------------------
-alert.page.title=Sicherheitshinweis
-alert.message=Sie sind zur Ausf\u00FChrung des Vorgangs nicht authorisiert.
-
-# --------------------------------------------------
-# generalError
-# --------------------------------------------------
-general.error.page.title=Es ist ein Fehler aufgetreten
-general.error.section.title=Es ist ein Fehler aufgetreten
-
-# --------------------------------------------------
-# login
-# --------------------------------------------------
-login.page.title=Anmeldungsseite
-login.section.title=Anmeldung
-login.remember.me=Daten merken
-login.need.an.account=Ben\u00F6tigen Sie ein Benutzerkonto?
-login.register=Registrieren Sie sich!
-login.forgot.your.password=Passwort vergessen?
-login.request.password.reset=Zur\u00FCcksetzung des Passwortes beauftragen.
-
-# --------------------------------------------------
-# password
-# --------------------------------------------------
-password.page.title=Passwort\u00E4nderung
-password.section.title=Passwort\u00E4nderung
-password.existing=Bestehendes Passwort
-password.new=Neues Passwort
-password.new.confirm=Passwortbest\u00E4tigung
-password.change=Passwort \u00E4ndern
-
-# --------------------------------------------------
-# passwordResetNotification
-# --------------------------------------------------
-password.reset.page.title=Passwort-Zur\u00FCcksetzung
-password.reset.message=Zur\u00FCcksetzung des Passwortes erfolgreich.
-password.reset.go.to=Gehe zu
-
-# --------------------------------------------------
-# register
-# --------------------------------------------------
-register.page.title=Registrierungs-Seite
-register.section.title=Registrierung eines Benutzerkontos
-
-# --------------------------------------------------
-# requestPasswordReset
-# --------------------------------------------------
-request.password.reset.page.title=Passwort-Zur\u00FCcksetzung beauftragen
-request.password.reset.section.title=Passwort-Zur\u00FCcksetzung beauftragen
-request.password.reset=Zur\u00FCcksetzung beauftragen
-
-# --------------------------------------------------
-# requiresAuthentication
-# --------------------------------------------------
-requires.authentication.page.title=Sicherheits-Hinweis - Aktion erfordert Authenfizierung
-requires.authentication.section.title=Sicherheits-Hinweis - Aktion erfordert Authenfizierung
-requires.authentication.message=Diese Aktion erfordert Ihre Authenfizierung.
-requires.authentication.go.ahead=Weiter
-
-# --------------------------------------------------
-# validationNotification
-# --------------------------------------------------
-validation.notification.page.title=Best\u00E4tigungs-Benachrichtigungs-Seite
-validation.notification.section.title=Best\u00E4tigungs-Erinnerung
-validation.notification.message.1=Eine Best\u00E4tigungsmail wurde an die von Ihnen angegebene Adresse ({0}) gesendet. Bitte pr\u00FCfen Sie Ihren Posteingang.
-validation.notification.message.2=Dieses Konto ({0}) wird bis zur Best\u00E4tigung gesperrt bleiben.
-
-# --------------------------------------------------
-# grantRoles
-# --------------------------------------------------
-grant=Erteilen
-
-# --------------------------------------------------
-# securityLinks
-# --------------------------------------------------
-current.user=Aktueller Benutzer:
-unknown.user=Unbekannter Benutzer
-edit.details=Details bearbeiten
-notify.password.expiration=Das Passwort wird ung\u00FCltig zum
-
-# --------------------------------------------------
-# userCredentials
-# --------------------------------------------------
-account.creation=Kontoerstellung
-last.login=Letzte Anmeldung
-last.password.change=Letzte \u00C4nderung des Passwortes
-
-# --------------------------------------------------
-# assignments
-# --------------------------------------------------
-assignments.page.title=[Admin] Benutzer bearbeiten
-assignments.section.title=[Admin] Benutzerrollen
-assignments.no.roles=Noch keinen Rollen zugewiesen
-assignments.available.roles=Verf\u00FCgbare Rollen
-assignments.assigned.roles=Zugewiesene Rollen
-assignments.submit=\u00DCbertragen
-assignments.reset=Zur\u00FCcksetzen
-assignments.add.roles=Ausgew\u00E4hlte Rollen hinzuf\u00FCgen
-assignments.remove.roles=Ausgew\u00E4hlte Rollen entfernen
-assignments.no.roles.to.grant=Keine Rollen zur Zuweisung verf\u00FCgbar
-
-# --------------------------------------------------
-# createAdmin
-# --------------------------------------------------
-create.admin.page.title=Administrator anlegen
-create.admin.section.title=Administrator anlegen
-create.admin=Administrator anlegen
-
-# --------------------------------------------------
-# operationList
-# --------------------------------------------------
-operation.list.page.title=[Admin] Liste der Operationen
-operation.list.section.title=[Admin] Liste der Operationen
-operation.list.no.operations.available=Keine Operationen verf\u00FCgbar
-
-# --------------------------------------------------
-# permissionList
-# --------------------------------------------------
-permission.list.page.title=[Admin] Liste der Berechtigungen
-permission.list.section.title=[Admin] Liste der Berechtigungen
-permission.list.no.permissions.available=Keine Berechtigungen verf\u00FCgbar
-
-# --------------------------------------------------
-# resourceList
-# --------------------------------------------------
-resource.list.page.title=[Admin] Liste der Resourcen
-resource.list.section.title=[Admin] Liste der Resourcen
-resource.list.no.resources.available=Keine Resourcen verf\u00FCgbar
-
-# --------------------------------------------------
-# role
-# --------------------------------------------------
-role.page.title=[Admin] Rollenansicht
-role.section.title=Rollen-Bearbeitung
-role.assignable=Zuweisbar?
-role.currently.assigned.permissions=Aktuell erteilte Berechtigungen:
-role.add.new.permission=Neue Berechtigung hinzuf\u00FCgen
-role.currently.assigned.roles=Aktuell zugewiesene Rollen:
-role.add.sub.role=Kind-Rolle hinzuf\u00FCgen
-
-# --------------------------------------------------
-# roleEdit
-# --------------------------------------------------
-role.edit.no.parent.defined=Keine Eltern-Rolle f\u00FCr diese Rolle definiert.
-role.edit.no.childrole.defined=Keine Kind-Rollen f\u00FCr diese Rolle definiert.
-role.edit.users.defined.in.current.role=Benutzer, die der aktuellen Rolle zugeteilt sind
-role.edit.users.defined.in.parent.roles=Benutzer mit zugewiesener Eltern-Rolle
-role.edit.section.users=Benutzerliste
-role.edit.no.user.defined=Keine Benutzer f\u00FCr diese Rolle definiert.
-cannot.assign.role=Benutzer ''{0}'' kann nicht aktualisiert werden: {1}
-
-# --------------------------------------------------
-# roleCreate
-# --------------------------------------------------
-role.create.page.title=[Admin] Rolle erstellen
-role.create.section.title=[Admin] Rolle erstellen
-role.create.operation=Operation
-role.create.resource=Resource
-role.create.no.permissions.defined=Keine Berechtigungen f\u00FCr diese Rolle definiert.
-role.create.add.permission=Berechtigung hinzuf\u00FCgen
-
-# --------------------------------------------------
-# roleList
-# --------------------------------------------------
-role.list.page.title=[Admin] Liste der Rollen
-role.list.section.title=[Admin] Liste der Rollen
-role.list.no.roles.available=Keine Rollen verf\u00FCgbar
-
-# --------------------------------------------------
-# roleModel
-# --------------------------------------------------
-role.model.page.title=[Admin] Rollen-Modell
-role.model.section.title=[Admin] Rollen-Modell
-role.model.message=Dies sind die dem Rollen-Verwalter bekannten Resourcen, Operationen, Rollen und Rollen-Schablonen.
-role.model.id=Bezeichner
-role.model.name=Name
-role.model.name.prefix=Prefix
-role.model.permanent=Permanent
-role.model.assignable=Erteilbar
-role.model.delimeter=Trennzeichen
-role.model.operation.id=Operations-Bezeichner
-role.model.resource.id=Resource-Bezeichner
-role.model.role.id=Rollen-Bezeichner
-role.model.parent.roles=Eltern-Rollen
-role.model.child.roles=Kind-Rollen
-role.model.templates=Schablonen
-role.model.template.id=Schablonen-Bezeichner
-role.model.parent.templates=Eltern-Schablonen
-role.model.child.templates=Kind-Schablonen
-
-# --------------------------------------------------
-# roleSummary
-# --------------------------------------------------
-role.summary.page.title=[Admin] Rollen\u00FCbersicht
-role.summary.section.title=[Admin] Rollen\u00FCbersicht
-
-# --------------------------------------------------
-# systemInformation
-# --------------------------------------------------
-system.info.page.title=[Admin] System-Informationen
-system.info.section.title=[Admin] Informationen zum Sicherheits-System
-
-# --------------------------------------------------
-# userCreate
-# --------------------------------------------------
-user.create.page.title=[Admin] Benutzer anlegen
-user.create.section.title=[Admin] Benutzer anlegen
-user.create=Benutzer anlegen
-
-# --------------------------------------------------
-# userDelete
-# --------------------------------------------------
-user.delete.page.title=[Admin] Benutzer l\u00F6schen
-user.delete.section.title=[Admin] Benutzer l\u00F6schen
-user.delete.message=Der folgende Benutzer wird gel\u00F6scht werden
-user.delete=Benutzer l\u00F6schen
-
-# --------------------------------------------------
-# userEdit
-# --------------------------------------------------
-user.edit.page.title=[Admin] Benutzer bearbeiten
-user.edit.section.title=[Admin] Benutzer bearbeiten
-user.edit.locked.user=Gesperrter Benutzer
-user.edit.force.user.change.password=Benutzer auffordern das Passwort zu \u00E4ndern
-user.edit.roles=Rollen bearbeiten
-
-# --------------------------------------------------
-# userFind
-# --------------------------------------------------
-user.find=Benutzer finden
-
-# --------------------------------------------------
-# userList
-# --------------------------------------------------
-user.list.page.title=[Admin] Liste der Benutzer
-user.list.section.title=[Admin] Liste der zur Rolle ''{0}'' zugewiesenen Benutzer:
-user.list.permanent=Permanent
-user.list.validated=\u00DCberpr\u00FCft
-user.list.locked=Gesperrt
-user.list.tasks=Vorg\u00E4nge
-user.list.tools=Werkzeuge
-user.list.reports=Reports
-user.list.message=Die folgenden Werkzeuge stehen Administratoren zur Bearbeitung von Benutzern zur Verf\u00FCgung.
-user.list.create.new.user=Neuen Benutzer anlegen
-user.list.show.users.in.role=Zeige Benutzer mit Rolle
-user.list.types=Typen
+++ /dev/null
-# 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.
-
-# --------------------------------------------------
-# Empty localization file to workaround REDBACK-233
-# --------------------------------------------------
\ No newline at end of file
+++ /dev/null
-# 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.
-
-# --------------------------------------------------
-# Classes Section
-#
-# General - These are localizations that are used by multiple classes.
-# If you can't find the text under each class, you can find it here.
-# --------------------------------------------------
-#Translate by Damien Blugeon.
-username.required=Le nom d''utilisateur est obligatoire.
-username.has.spaces=Le nom d''utilisateur ne peut pas contenir des espaces.
-password.confimation.failed=La confirmation du mot de passe a \u00e9chou\u00e9. Les mots de passe ne correspondent pas.
-password.provided.does.not.match.existing=Le mot de passe fournis ne correspond pas au compte.
-user.does.not.exist=L''utilisateur ''{0}'' n''existe pas.
-user.not.found.exception=Une erreur s''est produite lors de la recherche de l''utilisateur ''{0}'': {1}
-save.role.success=R\u00f4le ''{0}'' Sauvegard\u00e9
-cannot.get.role=Impossible de r\u00e9cup\u00e9rer le r\u00f4le ''{0}'': {1}
-invalid.user.credentials=Informations d''autorisations de l''utilisateur invalide.
-user.already.exists=L''utilisateur ''{0}'' existe d\u00e9j\u00e0.
-cannot.edit.user.null.username=Impossible d'\u00e9diter un utilisateur qui a un nom d''utilisateur null.
-cannot.edit.user.empty.username=Impossible d''\u00e9diter un utilisateur qui a un nom d''utilisateur vide.
-cannot.get.user=Impossible de r\u00e9cup\u00e9rer l''utilisateur ''{0}'': {1}
-cannot.edit.user.null.credentials=Impossible d''\u00e9diter un utilisateur qui a des autorisations nulles.
-cannot.operate.on.null.user=Impossible d''op\u00e9rer sur un utilisateur qui n''existe pas.
-
-# --------------------------------------------------
-# AbstractUserCredentialsAction
-# --------------------------------------------------
-fullName.required=Le nom complet est obligatoire.
-email.required=L''adresse email est obligatoire.
-email.invalid=L''adresse email est invalide.
-password.required=Le mot de passe est obligatoire.
-passwords.does.not.match=Les mots de passe ne correspondent pas.
-
-# --------------------------------------------------
-# AccountAction
-# --------------------------------------------------
-cannot.show.account.login.required=Impossible d''afficher votre compte. Vous n''\u00eates pas connect\u00e9.
-
-# --------------------------------------------------
-# LoginAction
-# --------------------------------------------------
-reset.password.missing=R\u00e9initialisation du mot de passe, cl\u00e9 manquante.
-cannot.find.key=Impossible de trouver la cl\u00e9.
-cannot.find.key.at.the.moment=Impossible de traiter la cl\u00e9 pour le moment. S''il vous pla\u00eet, r\u00e9essayez ult\u00e9rieurement.
-cannot.find.user=Impossible de trouver l''utilisateur.
-validation.failure.key.missing=Echec de la validation, cl\u00e9 manquante.
-incorrect.username.password=Vous avez entr\u00e9 un nom d''utilisateur et/ou un mot de passe incorrect(s).
-account.validation.required=Vous avez entr\u00e9 un nom d''utilisateur et/ou un mot de passe incorrect(s).
-authentication.failed=Echec de l''authentification.
-authentication.exception=Une erreur s''est produite lors de l''authentification : {0}
-account.locked=Votre compte est verrouill\u00e9.
-login.already.logged.in=Vous \u00eatestes d\u00e9j\u00e0 connect\u00e9.
-
-# --------------------------------------------------
-# PasswordAction
-# --------------------------------------------------
-newPassword.cannot.be.empty=Le nouveau mot de passe ne peut \u00eatre vide.
-cannot.update.user.not.found=Impossible de mettre \u00e0 jour l''utilisateur ''{0}''. Utilisateur non trouv\u00e9.
-admin.deleted.account=Probablement parce qu''un administrateur vient de supprimer votre compte.
-
-# --------------------------------------------------
-# PasswordResetAction
-# --------------------------------------------------
-username.cannot.be.empty=Le nom d''utilisateur ne peut \u00eatre vide.
-password.reset.success=Si l''utilisateur a \u00e9t\u00e9 trouv\u00e9, un message vient d''\u00eatre envoy\u00e9.
-password.reset.failure=Si l''utilisateur a \u00e9t\u00e9 trouv\u00e9, un message vient d''\u00eatre envoy\u00e9.
-password.reset.email.generation.failure=Une erreur syst\u00e8me interne a emp\u00each\u00e9 la g\u00e9n\u00e9ration de l''email de r\u00e9initialisation du mot de passe.
-
-# --------------------------------------------------
-# RegisterAction
-# --------------------------------------------------
-assign.role.failure=impossible d''assigner le r\u00f4le utilisateur enregistr\u00e9 au nouvel utilisateur.
-cannot.register.user=Impossible de traiter la demande d''enregistrement du nouvel utilisateur.
-
-# --------------------------------------------------
-# AddAdminUserAction
-# --------------------------------------------------
-invalid.admin.credentials=Informations d''autorisations d''adminstration invalide.
-admin.user.already.exists=Un administrateur existe d\u00e9j\u00e0 dans la base de donn\u00e9e (quelqu''un a probablement cr\u00e9\u00e9 l''utilisateur avant vous).
-cannot.assign.admin.role=Impossible d''assigner le r\u00f4le d''administrateur syst\u00e8me.
-
-# --------------------------------------------------
-# AssignmentsAction
-# --------------------------------------------------
-rbac.edit.user.empty.principal=Impossible d''utiliser AssignmentsAction pour RBAC Edit User avec un principal vide.
-error.adding.selected.roles=Erreur lors de l''ajout des r\u00f4les s\u00e9lectionn\u00e9s : {0}
-error.removing.selected.roles=Erreur lors du retrait des r\u00f4les s\u00e9lectionn\u00e9s: {0}
-
-# --------------------------------------------------
-# EditRoleAction
-# --------------------------------------------------
-cannot.edit.null.role=Impossible d''\u00e9diter le nom de r\u00f4le null.
-cannot.edit.empty.role=Impossible d''\u00e9diter un nom de r\u00f4le vide.
-cannot.operate.null.role=Impossible d''op\u00e9rer sur un r\u00f4le null.
-
-# --------------------------------------------------
-# OperationsAction
-# --------------------------------------------------
-cannot.list.all.operations=Impossible d''\u00e9num\u00e9rer toutes les op\u00e9rations : {0}
-cannot.save.operation=Impossible d''enregistrer l''op\u00e9ration : {0}.
-cannot.remove.operation=Impossible de retirer l''op\u00e9ration : {0}.
-
-# --------------------------------------------------
-# PermissionsAction
-# --------------------------------------------------
-cannot.list.all.permissions=Impossible d''\u00e9num\u00e9rer toutes les permissions : {0}
-cannot.edit.null.permission=Impossible d''\u00e9diter un nom de permission null.
-cannot.edit.empty.permission=Impossible d''\u00e9diter un nom de permission vide.
-cannot.operate.null.permission=Impossible d''op\u00e9rer sur une permision qui n''existe pas.
-cannot.get.permission=Impossible de r\u00e9cuperer la permission ''{0}'': {1}
-save.permission.success=Permission ''{0}'' Sauvegard\u00e9e
-
-# --------------------------------------------------
-# ReportAction
-# --------------------------------------------------
-cannot.get.report=Impossible de trouver le rapport : {0}
-cannot.generate.report=Impossible de g\u00e9n\u00e9rer le rapport.
-
-# --------------------------------------------------
-# ResourcesAction
-# --------------------------------------------------
-cannot.list.all.resources=Impossible d''\u00e9num\u00e9rer toutes les ressources : {0}
-cannot.save.resource=Impossible d''enregistrer la ressource: {0}.
-cannot.remove.resource=Impossible de localiser la ressource \u00e0 retirer ''{0}''
-
-# --------------------------------------------------
-# RoleCreateAction
-# --------------------------------------------------
-cannot.add.null.permission=Impossible d''ajouter une permission null.
-cannot.add.empty.role=Impossible de cr\u00e9er un r\u00f4le avec un nom vide.
-
-# --------------------------------------------------
-# RolesAction
-# --------------------------------------------------
-cannot.list.all.roles=Impossible d''\u00e9num\u00e9rer toutes les r\u00f4les : {0}
-
-# --------------------------------------------------
-# UserDeleteAction
-# --------------------------------------------------
-cannot.remove.user.null.username=Impossible de supprimer l''utilisateur bas\u00e9 sur le nom d''utilisateur null.
-cannot.remove.user.empty.username=Impossible de supprimer l''utilisateur bas\u00e9 sur le nom d''utilisateur vide.
-cannot.remove.user.not.found=Impossible de localiser l''utilisateur ''{0}'' \u00e0 supprimer.
-cannot.remove.user.role=Impossible de retirer les r\u00f4les de l''utilisateur ''{0}'' parce que {1}
-cannot.remove.user.non.existent=Impossible de supprimer l''utilisateur inexistant ''{0}''
-
-# --------------------------------------------------
-# JSP Section
-#
-# General - These are localizations that are used by multiple JSPs.
-# If you can't find the text under each JSP, you can find it here.
-# --------------------------------------------------
-username=Nom d''utilisateur
-full.name=Nom complet
-email=Email
-email.address=Adresse email
-password=Mot de passe
-current.password=Mot de passe actuel
-new.password=Nouveau mot de passe
-confirm.password=Confirmer le mot de passe
-register=S''enregistrer
-login=S''authentifier
-logout=Se d\u00e9connecter
-submit=Envoyer
-remove=Retirer
-delete=Supprimer
-update=Mise \u00e0 jour
-search=Rechercher
-cancel=Annuler
-goback=Retour
-edit=\u00c9diter
-save=Sauvegarder
-name=Nom
-description=Description
-role.name=Nom du r\u00f4le
-role.description=Description du r\u00f4le
-remove.selected.roles=Retitrer les r\u00f4les s\u00e9lectionn\u00e9es
-role=R\u00f4le
-roles=R\u00f4les
-effective.roles=R\u00f4les affect\u00e9s
-permissions=Permissions
-operations=Op\u00e9rations
-resources=Ressources
-
-# --------------------------------------------------
-# accessDenied
-# --------------------------------------------------
-access.denied.page.title=Alerte s\u00e9curit\u00e9 - Acc\u00e8s interdit.
-access.denied.section.title=Alerte s\u00e9curit\u00e9 - Acc\u00e8s interdit.
-access.denied.message=L''action que vous avez tent\u00e9 d''effectuer requi\u00e8re des permissions que vous n''avez pas.<br>S''il vous pla\u00eet, contactez votre administrateur pour obtenir les droits appropri\u00e9s.
-
-# --------------------------------------------------
-# account
-# --------------------------------------------------
-account.details.page.title=D\u00e9tails du compte
-account.details.section.title=D\u00e9tails du compte
-
-# --------------------------------------------------
-# alert
-# --------------------------------------------------
-alert.page.title=Page d''alerte s\u00e9curit\u00e9s
-alert.message=Vous n'\u00eates pas autoris\u00e9 pour cette activit\u00e9.
-
-# --------------------------------------------------
-# generalError
-# --------------------------------------------------
-general.error.page.title=Une erreur est survenue
-general.error.section.title=Une erreur est survenue
-
-# --------------------------------------------------
-# login
-# --------------------------------------------------
-login.page.title=Page d''authentification
-login.section.title=S''authentifier
-login.remember.me=Se souvenir de moi
-login.need.an.account=Besoin d''un compte ?
-login.register=S''enregistrer !
-login.forgot.your.password=Mot de passe oubli\u00e9 ?
-login.request.password.reset=Demander une r\u00e9initialisation de votre mot de passe.
-
-# --------------------------------------------------
-# password
-# --------------------------------------------------
-password.page.title=Changer de mot de passe
-password.section.title=Changer de mot de passe
-password.existing=Mot de passe existant
-password.new=Nouveau mot de passe
-password.new.confirm=Confirmer le nouveau mot de passe
-password.change=Changer de mot de passe
-
-# --------------------------------------------------
-# passwordResetNotification
-# --------------------------------------------------
-password.reset.page.title=R\u00e9initialiser le mot de passe
-password.reset.message=R\u00e9initialisation du mot de passe r\u00e9ussie.
-password.reset.go.to=Aller \u00e0
-
-# --------------------------------------------------
-# register
-# --------------------------------------------------
-register.page.title=Page d''enregistrement
-register.section.title=Ouvrir un compte
-
-# --------------------------------------------------
-# requestPasswordReset
-# --------------------------------------------------
-request.password.reset.page.title=Demande de r\u00e9initialisation du mot de passe
-request.password.reset.section.title=Demande de r\u00e9initialisation du mot de passe
-request.password.reset=Demander la r\u00e9initialisations
-
-# --------------------------------------------------
-# requiresAuthentication
-# --------------------------------------------------
-requires.authentication.page.title=Alerte s\u00e9curit\u00e9 - L''action requiert une authentification
-requires.authentication.section.title=Alerte s\u00e9curit\u00e9 - L''action requiert une authentification
-requires.authentication.message=L''action que vous avez tent\u00e9 d''effectuer requi\u00e8re que vous soyez authentifi\u00e9.
-requires.authentication.go.ahead=Aller \u00e0 la page
-
-# --------------------------------------------------
-# validationNotification
-# --------------------------------------------------
-validation.notification.page.title=Page de notification de validation
-validation.notification.section.title=Rappel de validation
-validation.notification.message.1=Un email de validation vient d''\u00eatre envoy\u00e9 \u00e0 l''adresse que vous avez fournis ({0}). S''il vous pla\u00eet, v\u00e9rifier le lien de validation qui vient de vous \u00eatre envoy\u00e9.
-validation.notification.message.2=Ce compte ({0}) restera verrouill\u00e9 jusqu''\u00e0 ce qu''il soit valid\u00e9.
-
-# --------------------------------------------------
-# grantRoles
-# --------------------------------------------------
-grant=Promouvoir
-
-# --------------------------------------------------
-# securityLinks
-# --------------------------------------------------
-current.user=Utilisateur connect\u00e9 :
-unknown.user=Utilisateur inconnu
-edit.details=\u00c9diter les d\u00e9tails
-notify.password.expiration=Le mot de passe expirera le
-
-# --------------------------------------------------
-# userCredentials
-# --------------------------------------------------
-account.creation=Cr\u00e9ation de compte
-last.login=Derni\u00e8re authentification
-last.password.change=Dernier Changement de mot de passe
-
-# --------------------------------------------------
-# assignments
-# --------------------------------------------------
-assignments.page.title=[Admin] Edition de l''utilisateur
-assignments.section.title=[Admin] R\u00f4les de l''utilisateur
-assignments.no.roles=Aucun r\u00f4le d''assign\u00e9
-assignments.available.roles=R\u00f4les disponibles :
-assignments.assigned.roles=R\u00f4les assign\u00e9s :
-assignments.resource.roles=R\u00f4les pour les ressources :
-assignments.submit=Envoyer
-assignments.reset=R\u00e9initialiser
-assignments.add.roles=Ajouter les r\u00f4les s\u00e9lectionn\u00e9es
-assignments.remove.roles=Retitrer les r\u00f4les s\u00e9lectionn\u00e9es
-assignments.no.roles.to.grant=Aucun r\u00f4le de disponible \u00e0 promouvoir.
-
-# --------------------------------------------------
-# createAdmin
-# --------------------------------------------------
-create.admin.page.title=Cr\u00e9ation d''un administrateur
-create.admin.section.title=Cr\u00e9ation d''un administrateur
-create.admin=Cr\u00e9er l''administrateur
-
-# --------------------------------------------------
-# operationList
-# --------------------------------------------------
-operation.list.page.title=[Admin] Liste des op\u00e9rations
-operation.list.section.title=[Admin] Liste des op\u00e9rations
-operation.list.no.operations.available=Aucune op\u00e9ration disponible
-
-# --------------------------------------------------
-# permissionList
-# --------------------------------------------------
-permission.list.page.title=[Admin] Liste des permissions
-permission.list.section.title=[Admin] Liste des permissions
-permission.list.no.permissions.available=Aucune persmission disponible
-
-# --------------------------------------------------
-# resourceList
-# --------------------------------------------------
-resource.list.page.title=[Admin] Liste des ressources
-resource.list.section.title=[Admin] Liste des ressources
-resource.list.no.resources.available=Aucune ressource disponible
-
-# --------------------------------------------------
-# role
-# --------------------------------------------------
-role.page.title=[Admin] Visualisation des r\u00f4les
-role.section.title=Page de modification des r\u00f4les
-role.assignable=Assignable ?
-role.currently.assigned.permissions=Permissions actuellement assign\u00e9es :
-role.add.new.permission=Ajouter une nouvelle permission
-role.currently.assigned.roles=R\u00f4les actuellement assign\u00e9s :
-role.add.sub.role=Ajouter un sous-r\u00f4le
-role.operation=Op\u00e9ration
-role.resource=Ressource
-
-# --------------------------------------------------
-# roleEdit
-# --------------------------------------------------
-role.edit.no.parent.defined=Aucun r\u00f4le parent d\u00e9fini pour ce r\u00f4le
-role.edit.no.childrole.defined=Aucun r\u00f4le enfant d\u00e9fini pour ce r\u00f4le
-role.edit.users.defined.in.current.role=Utilisateurs d\u00e9fini avec ce r\u00f4le
-role.edit.users.defined.in.parent.roles=Utilisateurs d\u00e9fini avec un r\u00f4le parent
-role.edit.section.users=Liste des utilisateurs
-role.edit.no.user.defined=Aucun utilisateur d\u00e9fini pour ce r\u00f4le
-cannot.assign.role=Impossible de mettre a jour l''utilisateur ''{0}'' : {1}
-
-# --------------------------------------------------
-# roleCreate
-# --------------------------------------------------
-role.create.page.title=[Admin] Cr\u00e9ation d''un r\u00f4le
-role.create.section.title=[Admin] Cr\u00e9ation d''un r\u00f4le
-role.create.operation=Op\u00e9ration
-role.create.resource=Ressource
-role.create.no.permissions.defined=Aucune permission d\u00e9finie pour ce r\u00f4le
-role.create.add.permission=Ajouter permission
-
-# --------------------------------------------------
-# roleList
-# --------------------------------------------------
-role.list.page.title=[Admin] Liste des r\u00f4les
-role.list.section.title=[Admin] Liste des r\u00f4les
-role.list.no.roles.available=Aucun r\u00f4le disponible
-
-# --------------------------------------------------
-# roleModel
-# --------------------------------------------------
-role.model.page.title=[Admin] Mod\u00e8le des r\u00f4les
-role.model.section.title=[Admin] Mod\u00e8le des r\u00f4les
-role.model.message=Voici les ressources, les op\u00e9rations et les mod\u00e8les de r\u00f4le qui sont connus par le gestionnaire de r\u00f4le. Ce n''est pas le contenu courant de l''entrep\u00f4t de RBAC car il contient les \u00e9l\u00e9ments list\u00e9 ci-apr\u00e8s ET toutes les donn\u00e9es dynamiques cr\u00e9\u00e9es depuis la cr\u00e9ation de nouveaux r\u00f4les depuis les templates ci-apr\u00e8s.
-role.model.id=Id
-role.model.name=Nom
-role.model.name.prefix=Nom du pr\u00e9fixe
-role.model.permanent=Permanent
-role.model.assignable=Assignable
-role.model.delimeter=D\u00e9limiteur
-role.model.operation.id=Id de l''operation
-role.model.resource.id=Id de la ressource
-role.model.role.id=Id du R\u00f4le
-role.model.parent.roles=R\u00f4les parents
-role.model.child.roles=R\u00f4les enfants
-role.model.templates=Mod\u00e8les
-role.model.template.id=Id du Mod\u00e8le
-role.model.parent.templates=Mod\u00e8les parent
-role.model.child.templates=Mod\u00e8les enfants
-
-# --------------------------------------------------
-# roleSummary
-# --------------------------------------------------
-role.summary.page.title=[Admin] R\u00e9sum\u00e9 du r\u00f4le
-role.summary.section.title=[Admin] R\u00e9sum\u00e9 du r\u00f4le
-
-# --------------------------------------------------
-# systemInformation
-# --------------------------------------------------
-system.info.page.title=[Admin] Informations syst\u00e8mes
-system.info.section.title=Informations du syst\u00e8me de s\u00e9curit\u00e9
-
-# --------------------------------------------------
-# userCreate
-# --------------------------------------------------
-user.create.page.title=[Admin] Cr\u00e9ation d''utilisateur
-user.create.section.title=[Admin] Cr\u00e9ation d''utilisateur
-user.create=Cr\u00e9er l''utilisateur
-
-# --------------------------------------------------
-# userDelete
-# --------------------------------------------------
-user.delete.page.title=[Admin] Suppression de l''utilisateur
-user.delete.section.title=[Admin] Suppression de l''utilisateur
-user.delete.message=L''utilisateur suivant va \u00eatre supprim\u00e9
-user.delete=Supprimer l''utilisateur
-
-# --------------------------------------------------
-# userEdit
-# --------------------------------------------------
-user.edit.page.title=[Admin] \u00c9dition de l''utilisateur
-user.edit.section.title=[Admin] \u00c9dition de l''utilisateur
-user.edit.locked.user=Utilisateur verrouill\u00e9
-user.edit.force.user.change.password=Forcer l''utilisateur \u00e0 changer son mot de passe
-user.edit.roles=\u00c9diter les r\u00f4les
-
-# --------------------------------------------------
-# userFind
-# --------------------------------------------------
-user.find=Trouver un utilisateur
-
-# --------------------------------------------------
-# userList
-# --------------------------------------------------
-user.list.page.title=[Admin] Liste des utilisateurs
-user.list.section.title=[Admin] Liste des utilisateurs dans le r\u00f4le : {0}
-user.list.permanent=Permanent
-user.list.validated=Valid\u00e9
-user.list.locked=Verrouill\u00e9
-user.list.tasks=T\u00e2ches
-user.list.tools=Outils
-user.list.reports=Rapports
-user.list.message=Les outils suivants sont disponibles pour les administrateurs pour manipuler la liste des utilisateurs.
-user.list.create.new.user=Cr\u00e9er un nouvel utilisateur
-user.list.show.users.in.role=Afficher utilisateurs dans le r\u00f4le
-user.list.types=Types
-
-# --------------------------------------------------
-# backupRestore
-# --------------------------------------------------
-backupRestore.page.title=Sauvegarde et restauration
-backupRestore.section.backup.title=Sauvegarde
-backupRestore.section.restore.title=Restauration
-backupRestore.section.recent.backup=Sauvegardes r\u00e9centes
-backupRestore.backup.error = Fichier de sauvegarde non trouv\u00e9
-backupRestore.backup.empty.error = Le r\u00e9pertoire de sauvegarde est vide
-
-# --------------------------------------------------
-# Logging Section
-#
-# General - These are localizations that are used by multiple classes.
-# If you can't find the text under each class, you can find it here.
-# --------------------------------------------------
-log.password.reset.request=Demande de r\u00e9initialisation du mot de passe pour l''utilisateur '{}'
-log.password.change=Mot de passe chang\u00e9 pour l''utilisateur '{}'
-log.account.validation=Compte valid\u00e9 pour l''utilisateur '{}'
-log.account.create=Utilisateur cr\u00e9\u00e9 : '{}'
-log.account.edit=Utilisateur modifi\u00e9 : '{}'
-log.account.delete=Utilisateur supprim\u00e9 : '{}'
-log.login.success=Connexion r\u00e9ussie pour l''utilisateur '{}'
-log.logout.success=D\u00e9connexion de l''utilisateur '{}'
-log.login.fail=\u00c9chec de connexion pour l''utilisateur '{}'
-log.login.fail.locked=\u00c9chec de connexion pour l''utilisateur '{}' (compte v\u00e9rouill\u00e9)
-log.assign.role=R\u00f4le assign\u00e9 \u0224 l''utilisateur '{}': '{}'
-log.revoke.role=R\u00f4le retir\u00e9 \u0224 l''utilisateur '{}': '{}'
-log.role.create=R\u00f4le cr\u00e9\u00e9 : '{}'
-log.role.edit=R\u00f4le modifi\u00e9 : '{}'
-
-# --------------------------------------------------
-# changePasswordSuccess
-# --------------------------------------------------
-change.password.page.title=Changer le mot de passe
-change.password.success.section.title=Mot de passe chang\u00e9 avec succ\u00e8s
\ No newline at end of file
+++ /dev/null
-#*
- * 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.
- *#
-
-
-Welcome
-
-Username: $accountId
-
-This account was requested on $requestedOn
-
-Use the following URL to validate your account.
-
-$applicationUrl/$urlPath?validateMe=$authkey
-
-This url will be valid until $expiresOn
-
-Once validated, your account will only have the most basic rights on the system.
-Please contact the administrator to be assigned a more appropriate set of Roles
-and Permissions.
-
-Please keep this email for future reference.
-
-#if ( $feedback )
-Questions/Comments? $feedback
-#end
-
-
+++ /dev/null
-#*
- * 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.
- *#
-
-
-Password Reset
-
-Username: $accountId
-
-Someone requested a password reset for this account on $requestedOn
-
-Use the following URL to reset the password on your account.
-
-$applicationUrl/$urlPath?resetPassword=$authkey
-
-This url will be valid until $expiresOn
-
-#if ( $feedback )
-Questions/Comments? $feedback
-#end
-
-
--- /dev/null
+package org.apache.archiva.redback.integration;
+
+/*
+ * 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.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.archiva.redback.integration.HttpUtils;
+
+/**
+ * HttpUtilsTest
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class HttpUtilsTest
+ extends TestCase
+{
+ public void testComplexHeaderToProperties()
+ {
+ String rawheader = "realm=\"Somewhere Over The Rainbow\", domain = \"kansas.co.us\", nonce=\"65743ABCF";
+
+ Properties props = HttpUtils.complexHeaderToProperties( rawheader, ",", "=" );
+
+ assertNotNull( props );
+ assertEquals( 3, props.size() );
+ assertEquals( "Somewhere Over The Rainbow", props.get( "realm" ) );
+ assertEquals( "kansas.co.us", props.get( "domain" ) );
+ assertEquals( "65743ABCF", props.get( "nonce" ) );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.filter.authentication.digest;
+
+/*
+ * 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 junit.framework.TestCase;
+
+import org.codehaus.plexus.digest.Hex;
+
+public class HexTest
+ extends TestCase
+{
+ public void testEncoding()
+ {
+ String raw = "Lenore\nLenore";
+ String lenoreHex = "4c656e6f7265";
+ String expected = lenoreHex + "0a" + lenoreHex;
+
+ assertEquals( expected, Hex.encode( raw ) );
+ }
+
+ public void testTheRaven()
+ {
+ String raw = "Quoth the Raven, \"Nevermore.\"";
+ String expected = "51756f74682074686520526176656e2c20224e657665726d6f72652e22";
+
+ assertEquals( expected, Hex.encode( raw.getBytes() ) );
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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 junit.framework.TestCase;
+import net.sf.ehcache.CacheManager;
+import org.apache.archiva.redback.integration.mail.MailGenerator;
+import org.apache.archiva.redback.keys.AuthenticationKey;
+import org.apache.archiva.redback.keys.KeyManager;
+import org.apache.archiva.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
+import org.apache.archiva.redback.keys.KeyManagerException;
+import org.jpox.SchemaTool;
+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.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import java.net.URL;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+/**
+ * Test the Mailer class.
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class MailGeneratorTest
+ extends TestCase
+{
+ @Inject
+ @Named(value = "mailGenerator#velocity")
+ private MailGenerator generator;
+
+ @Inject
+ @Named(value = "mailGenerator#custom-url")
+ private MailGenerator customGenerator;
+
+ @Inject
+ @Named(value = "userSecurityPolicy")
+ private UserSecurityPolicy policy;
+
+ @Inject
+ @Named(value = "keyManager#memory")
+ private KeyManager keyManager;
+
+ @Inject
+ @Named(value = "jdoFactory#users")
+ DefaultConfigurableJdoFactory jdoFactory;
+
+ private Logger log = LoggerFactory.getLogger( getClass() );
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ CacheManager.getInstance().clearAll();
+ super.setUp();
+
+ jdoFactory.setPassword( "" );
+
+ jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Properties properties = jdoFactory.getProperties();
+
+ for ( Entry<Object, Object> entry : properties.entrySet() )
+ {
+ System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
+ }
+
+ SchemaTool.createSchemaTables( new URL[] { getClass()
+ .getResource( "/org/codehaus/plexus/redback/keys/jdo/package.jdo" ) }, new URL[] {}, null, false, null ); //$NON-NLS-1$
+
+ log.info( "jdoFactory driverName {} " , jdoFactory.getDriverName() );
+
+ PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
+
+ assertNotNull( pmf );
+
+ PersistenceManager pm = pmf.getPersistenceManager();
+
+ pm.close();
+
+ }
+
+ @Test
+ public void testGeneratePasswordResetMail()
+ throws KeyManagerException
+ {
+ AuthenticationKey authkey = keyManager.createKey( "username", "Password Reset Request",
+ policy.getUserValidationSettings().getEmailValidationTimeout() );
+
+ String content = generator.generateMail( "passwordResetEmail", authkey, "baseUrl" );
+
+ assertNotNull( content );
+ assertTrue( content.indexOf( '$' ) == -1 ); // make sure everything is properly populate
+ }
+
+ @Test
+ public void testGenerateAccountValidationMail()
+ throws KeyManagerException
+ {
+ AuthenticationKey authkey = keyManager.createKey( "username", "New User Email Validation",
+ policy.getUserValidationSettings().getEmailValidationTimeout() );
+
+ String content = generator.generateMail( "newAccountValidationEmail", authkey, "baseUrl" );
+
+ assertNotNull( content );
+ assertTrue( content.indexOf( '$' ) == -1 ); // make sure everything is properly populate
+ }
+
+ @Test
+ public void testGenerateAccountValidationMailCustomUrl()
+ throws Exception
+ {
+ AuthenticationKey authkey = keyManager.createKey( "username", "New User Email Validation",
+ policy.getUserValidationSettings().getEmailValidationTimeout() );
+
+ String content = customGenerator.generateMail( "newAccountValidationEmail", authkey, "baseUrl" );
+
+ assertNotNull( content );
+ assertTrue( content.indexOf( "baseUrl" ) == -1 ); // make sure everything is properly populate
+ assertTrue( content.indexOf( "MY_APPLICATION_URL/security" ) > 0 ); // make sure everything is properly populate
+ }
+
+ @Test
+ public void testGeneratePasswordResetMailCustomUrl()
+ throws Exception
+ {
+ AuthenticationKey authkey = keyManager.createKey( "username", "Password Reset Request",
+ policy.getUserValidationSettings().getEmailValidationTimeout() );
+
+ String content = customGenerator.generateMail( "passwordResetEmail", authkey, "baseUrl" );
+
+ assertNotNull( content );
+
+ log.info( "mail content " + content );
+
+ assertTrue( content.indexOf( "baseUrl" ) == -1 ); // make sure everything is properly populate
+ assertTrue( content.indexOf( "MY_APPLICATION_URL/security" ) > 0 ); // make sure everything is properly populate
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.integration.mail;
+
+/*
+ * 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.util.ArrayList;
+import java.util.List;
+
+import javax.mail.internet.MimeMessage;
+
+import org.springframework.mail.MailException;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 26 sept. 2008
+ * @version $Id$
+ */
+public class MockJavaMailSender
+ extends JavaMailSenderImpl
+ implements JavaMailSender
+{
+
+ List<MimeMessage> receivedEmails = new ArrayList<MimeMessage>();
+
+ /**
+ *
+ */
+ public MockJavaMailSender()
+ {
+
+ }
+
+ @Override
+ public void send( MimeMessage mimeMessage )
+ throws MailException
+ {
+ receivedEmails.add( mimeMessage );
+ }
+
+ public List<MimeMessage> getReceivedEmails()
+ {
+ return receivedEmails;
+ }
+
+}
+++ /dev/null
-package org.codehaus.redback.integration;
-
-/*
- * 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.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.codehaus.redback.integration.HttpUtils;
-
-/**
- * HttpUtilsTest
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class HttpUtilsTest
- extends TestCase
-{
- public void testComplexHeaderToProperties()
- {
- String rawheader = "realm=\"Somewhere Over The Rainbow\", domain = \"kansas.co.us\", nonce=\"65743ABCF";
-
- Properties props = HttpUtils.complexHeaderToProperties( rawheader, ",", "=" );
-
- assertNotNull( props );
- assertEquals( 3, props.size() );
- assertEquals( "Somewhere Over The Rainbow", props.get( "realm" ) );
- assertEquals( "kansas.co.us", props.get( "domain" ) );
- assertEquals( "65743ABCF", props.get( "nonce" ) );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.filter.authentication.digest;
-
-/*
- * 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 junit.framework.TestCase;
-
-import org.codehaus.plexus.digest.Hex;
-
-public class HexTest
- extends TestCase
-{
- public void testEncoding()
- {
- String raw = "Lenore\nLenore";
- String lenoreHex = "4c656e6f7265";
- String expected = lenoreHex + "0a" + lenoreHex;
-
- assertEquals( expected, Hex.encode( raw ) );
- }
-
- public void testTheRaven()
- {
- String raw = "Quoth the Raven, \"Nevermore.\"";
- String expected = "51756f74682074686520526176656e2c20224e657665726d6f72652e22";
-
- assertEquals( expected, Hex.encode( raw.getBytes() ) );
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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 junit.framework.TestCase;
-import net.sf.ehcache.CacheManager;
-import org.apache.archiva.redback.keys.AuthenticationKey;
-import org.apache.archiva.redback.keys.KeyManager;
-import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
-import org.apache.archiva.redback.keys.KeyManagerException;
-import org.jpox.SchemaTool;
-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.jdo.PersistenceManager;
-import javax.jdo.PersistenceManagerFactory;
-import java.net.URL;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-/**
- * Test the Mailer class.
- */
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
-public class MailGeneratorTest
- extends TestCase
-{
- @Inject
- @Named(value = "mailGenerator#velocity")
- private MailGenerator generator;
-
- @Inject
- @Named(value = "mailGenerator#custom-url")
- private MailGenerator customGenerator;
-
- @Inject
- @Named(value = "userSecurityPolicy")
- private UserSecurityPolicy policy;
-
- @Inject
- @Named(value = "keyManager#memory")
- private KeyManager keyManager;
-
- @Inject
- @Named(value = "jdoFactory#users")
- DefaultConfigurableJdoFactory jdoFactory;
-
- private Logger log = LoggerFactory.getLogger( getClass() );
-
- @Before
- public void setUp()
- throws Exception
- {
- CacheManager.getInstance().clearAll();
- super.setUp();
-
- jdoFactory.setPassword( "" );
-
- jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); //$NON-NLS-1$ //$NON-NLS-2$
-
- Properties properties = jdoFactory.getProperties();
-
- for ( Entry<Object, Object> entry : properties.entrySet() )
- {
- System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
- }
-
- SchemaTool.createSchemaTables( new URL[] { getClass()
- .getResource( "/org/codehaus/plexus/redback/keys/jdo/package.jdo" ) }, new URL[] {}, null, false, null ); //$NON-NLS-1$
-
- log.info( "jdoFactory driverName {} " , jdoFactory.getDriverName() );
-
- PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory();
-
- assertNotNull( pmf );
-
- PersistenceManager pm = pmf.getPersistenceManager();
-
- pm.close();
-
- }
-
- @Test
- public void testGeneratePasswordResetMail()
- throws KeyManagerException
- {
- AuthenticationKey authkey = keyManager.createKey( "username", "Password Reset Request",
- policy.getUserValidationSettings().getEmailValidationTimeout() );
-
- String content = generator.generateMail( "passwordResetEmail", authkey, "baseUrl" );
-
- assertNotNull( content );
- assertTrue( content.indexOf( '$' ) == -1 ); // make sure everything is properly populate
- }
-
- @Test
- public void testGenerateAccountValidationMail()
- throws KeyManagerException
- {
- AuthenticationKey authkey = keyManager.createKey( "username", "New User Email Validation",
- policy.getUserValidationSettings().getEmailValidationTimeout() );
-
- String content = generator.generateMail( "newAccountValidationEmail", authkey, "baseUrl" );
-
- assertNotNull( content );
- assertTrue( content.indexOf( '$' ) == -1 ); // make sure everything is properly populate
- }
-
- @Test
- public void testGenerateAccountValidationMailCustomUrl()
- throws Exception
- {
- AuthenticationKey authkey = keyManager.createKey( "username", "New User Email Validation",
- policy.getUserValidationSettings().getEmailValidationTimeout() );
-
- String content = customGenerator.generateMail( "newAccountValidationEmail", authkey, "baseUrl" );
-
- assertNotNull( content );
- assertTrue( content.indexOf( "baseUrl" ) == -1 ); // make sure everything is properly populate
- assertTrue( content.indexOf( "MY_APPLICATION_URL/security" ) > 0 ); // make sure everything is properly populate
- }
-
- @Test
- public void testGeneratePasswordResetMailCustomUrl()
- throws Exception
- {
- AuthenticationKey authkey = keyManager.createKey( "username", "Password Reset Request",
- policy.getUserValidationSettings().getEmailValidationTimeout() );
-
- String content = customGenerator.generateMail( "passwordResetEmail", authkey, "baseUrl" );
-
- assertNotNull( content );
-
- log.info( "mail content " + content );
-
- assertTrue( content.indexOf( "baseUrl" ) == -1 ); // make sure everything is properly populate
- assertTrue( content.indexOf( "MY_APPLICATION_URL/security" ) > 0 ); // make sure everything is properly populate
- }
-}
+++ /dev/null
-package org.codehaus.redback.integration.mail;
-
-/*
- * 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.util.ArrayList;
-import java.util.List;
-
-import javax.mail.internet.MimeMessage;
-
-import org.springframework.mail.MailException;
-import org.springframework.mail.javamail.JavaMailSender;
-import org.springframework.mail.javamail.JavaMailSenderImpl;
-
-/**
- * @author <a href="mailto:olamy@apache.org">olamy</a>
- * @since 26 sept. 2008
- * @version $Id$
- */
-public class MockJavaMailSender
- extends JavaMailSenderImpl
- implements JavaMailSender
-{
-
- List<MimeMessage> receivedEmails = new ArrayList<MimeMessage>();
-
- /**
- *
- */
- public MockJavaMailSender()
- {
-
- }
-
- @Override
- public void send( MimeMessage mimeMessage )
- throws MailException
- {
- receivedEmails.add( mimeMessage );
- }
-
- public List<MimeMessage> getReceivedEmails()
- {
- return receivedEmails;
- }
-
-}
--- /dev/null
+# 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.
+
+
+jdbc.url=jdbc:derby:target/database;create=true
+
+
+# --------------------------------------------------------------------
+# Application Configuration
+
+application.timestamp=EEE d MMM yyyy HH:mm:ss Z
+
+# --------------------------------------------------------------------
+# JDBC Setup
+
+jdbc.driver.name=org.apache.derby.jdbc.EmbeddedDriver
+jdbc.username=sa
+jdbc.password=
+
+# --------------------------------------------------------------------
+# Email Settings
+
+email.jndiSessionName=java:comp/env/mail/Session
+email.smtp.host=localhost
+email.smtp.port=25
+email.smtp.ssl.enabled=false
+email.smtp.tls.enabled=false
+email.smtp.username=
+email.smtp.password=
+
+#TODO: move description elsewhere, remove bad default
+# All emails sent by the system will be from the following address
+#email.from.address=${user.name}@localhost
+# All emails sent by the system will be from the following user name (used in conjunction with address)
+#email.from.name=Unconfigured Username
+
+# If all email addresses (from new user registration) require an account validation email.
+email.validation.required=true
+# Timeout (in minutes) for the key generated for an email validation to remain valid.
+# 2880 minutes = 48 hours
+email.validation.timeout=2880
+# The subject line for the email message.
+email.validation.subject=Welcome
+
+#TODO: move description elsewhere, remove bad default
+# Get the Feedback to use for any outgoing emails.
+# NOTE: if feedback.path starts with a "/" it is appended to the end of the value provided in application.url
+# This value can be in the format/syntax of "/feedback.action" or even "mailto:feedback@application.com"
+#email.feedback.path=/feedback.action
+
+#Set the application base URL. The default is to derive it from the HTTP request
+#application.url=http://myurl.mycompany.com
+
+# --------------------------------------------------------------------
+# Auto Login Settings
+
+security.rememberme.enabled=true
+# Timeout in minutes ( 525600 minutes = 1 year )
+security.rememberme.timeout=525600
+
+# Single Sign On
+# Timeout in minutes
+security.signon.timeout=30
+
+# --------------------------------------------------------------------
+# Default Username Values
+redback.default.admin=admin
+
+# --------------------------------------------------------------------
+# Security Policies
+
+#security.policy.password.encoder=
+security.policy.password.previous.count=6
+security.policy.password.expiration.enabled=true
+security.policy.password.expiration.days=90
+security.policy.password.expiration.notify.days=10
+security.policy.allowed.login.attempt=10
+
+# turn off the perclick enforcement of various security policies, slightly
+# more heavyweight since it will ensure that the User object on each click
+# is up to date
+security.policy.strict.enforcement.enabled=true
+security.policy.strict.force.password.change.enabled=true
+
+# --------------------------------------------------------------------
+# Password Rules
+security.policy.password.rule.alphanumeric.enabled=false
+security.policy.password.rule.alphacount.enabled=true
+security.policy.password.rule.alphacount.minimum=1
+security.policy.password.rule.characterlength.enabled=true
+security.policy.password.rule.characterlength.minimum=1
+security.policy.password.rule.characterlength.maximum=24
+security.policy.password.rule.musthave.enabled=true
+security.policy.password.rule.numericalcount.enabled=true
+security.policy.password.rule.numericalcount.minimum=1
+security.policy.password.rule.reuse.enabled=true
+security.policy.password.rule.nowhitespace.enabled=true
+
+# --------------------------------------------------------------------
+# ldap settings
+#
+ldap.bind.authenticator.enabled=false
+
+# ldap options for configuration via properties file
+#ldap.config.hostname=
+#ldap.config.port=
+#ldap.config.base.dn=
+#ldap.config.context.factory=
+#ldap.config.bind.dn=
+#ldap.config.password=
+#ldap.config.authentication.method=
+
+# config parameter for the ConfigurableUserManager
+user.manager.impl=cached
+
+
+
+++ /dev/null
-# 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.
-
-
-jdbc.url=jdbc:derby:target/database;create=true
-
-
-# --------------------------------------------------------------------
-# Application Configuration
-
-application.timestamp=EEE d MMM yyyy HH:mm:ss Z
-
-# --------------------------------------------------------------------
-# JDBC Setup
-
-jdbc.driver.name=org.apache.derby.jdbc.EmbeddedDriver
-jdbc.username=sa
-jdbc.password=
-
-# --------------------------------------------------------------------
-# Email Settings
-
-email.jndiSessionName=java:comp/env/mail/Session
-email.smtp.host=localhost
-email.smtp.port=25
-email.smtp.ssl.enabled=false
-email.smtp.tls.enabled=false
-email.smtp.username=
-email.smtp.password=
-
-#TODO: move description elsewhere, remove bad default
-# All emails sent by the system will be from the following address
-#email.from.address=${user.name}@localhost
-# All emails sent by the system will be from the following user name (used in conjunction with address)
-#email.from.name=Unconfigured Username
-
-# If all email addresses (from new user registration) require an account validation email.
-email.validation.required=true
-# Timeout (in minutes) for the key generated for an email validation to remain valid.
-# 2880 minutes = 48 hours
-email.validation.timeout=2880
-# The subject line for the email message.
-email.validation.subject=Welcome
-
-#TODO: move description elsewhere, remove bad default
-# Get the Feedback to use for any outgoing emails.
-# NOTE: if feedback.path starts with a "/" it is appended to the end of the value provided in application.url
-# This value can be in the format/syntax of "/feedback.action" or even "mailto:feedback@application.com"
-#email.feedback.path=/feedback.action
-
-#Set the application base URL. The default is to derive it from the HTTP request
-#application.url=http://myurl.mycompany.com
-
-# --------------------------------------------------------------------
-# Auto Login Settings
-
-security.rememberme.enabled=true
-# Timeout in minutes ( 525600 minutes = 1 year )
-security.rememberme.timeout=525600
-
-# Single Sign On
-# Timeout in minutes
-security.signon.timeout=30
-
-# --------------------------------------------------------------------
-# Default Username Values
-redback.default.admin=admin
-
-# --------------------------------------------------------------------
-# Security Policies
-
-#security.policy.password.encoder=
-security.policy.password.previous.count=6
-security.policy.password.expiration.enabled=true
-security.policy.password.expiration.days=90
-security.policy.password.expiration.notify.days=10
-security.policy.allowed.login.attempt=10
-
-# turn off the perclick enforcement of various security policies, slightly
-# more heavyweight since it will ensure that the User object on each click
-# is up to date
-security.policy.strict.enforcement.enabled=true
-security.policy.strict.force.password.change.enabled=true
-
-# --------------------------------------------------------------------
-# Password Rules
-security.policy.password.rule.alphanumeric.enabled=false
-security.policy.password.rule.alphacount.enabled=true
-security.policy.password.rule.alphacount.minimum=1
-security.policy.password.rule.characterlength.enabled=true
-security.policy.password.rule.characterlength.minimum=1
-security.policy.password.rule.characterlength.maximum=24
-security.policy.password.rule.musthave.enabled=true
-security.policy.password.rule.numericalcount.enabled=true
-security.policy.password.rule.numericalcount.minimum=1
-security.policy.password.rule.reuse.enabled=true
-security.policy.password.rule.nowhitespace.enabled=true
-
-# --------------------------------------------------------------------
-# ldap settings
-#
-ldap.bind.authenticator.enabled=false
-
-# ldap options for configuration via properties file
-#ldap.config.hostname=
-#ldap.config.port=
-#ldap.config.base.dn=
-#ldap.config.context.factory=
-#ldap.config.bind.dn=
-#ldap.config.password=
-#ldap.config.authentication.method=
-
-# config parameter for the ConfigurableUserManager
-user.manager.impl=cached
-
-
-
</property>
</bean>
- <bean name="mailGenerator#custom-url" class="org.codehaus.redback.integration.mail.VelocityMailGenerator">
+ <bean name="mailGenerator#custom-url" class="org.apache.archiva.redback.integration.mail.VelocityMailGenerator">
<property name="config" ref="userConfiguration#custom-url"/>
<property name="velocityEngine" ref="velocityEngine#redback"/>
</bean>
package org.codehaus.redback.rest.api.model;
-import org.codehaus.redback.integration.util.DateUtils;
+import org.apache.archiva.redback.integration.util.DateUtils;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import org.apache.archiva.redback.keys.memory.MemoryKeyManager;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.rest.api.model.User;
import org.codehaus.redback.rest.api.services.LoginService;
import org.codehaus.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.codehaus.redback.rest.api.model.ErrorMessage;
import org.codehaus.redback.rest.api.services.PasswordService;
import org.codehaus.redback.rest.api.services.RedbackServiceException;
import org.codehaus.plexus.redback.role.model.ModelApplication;
import org.codehaus.plexus.redback.role.model.ModelRole;
import org.codehaus.plexus.redback.role.model.ModelTemplate;
-import org.codehaus.redback.integration.model.AdminEditUserCredentials;
+import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.integration.util.RoleSorter;
+import org.apache.archiva.redback.integration.util.RoleSorter;
import org.codehaus.redback.rest.api.model.Application;
import org.codehaus.redback.rest.api.model.ApplicationRoles;
import org.codehaus.redback.rest.api.model.ErrorMessage;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.codehaus.redback.integration.mail.Mailer;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
+import org.apache.archiva.redback.integration.mail.Mailer;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
import org.codehaus.redback.rest.api.model.ErrorMessage;
import org.codehaus.redback.rest.api.model.Operation;
import org.apache.archiva.redback.policy.AccountLockedException;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticationException;
-import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
+import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticationException;
+import org.apache.archiva.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
import org.codehaus.redback.rest.services.RedbackAuthenticationThreadLocal;
import org.codehaus.redback.rest.services.RedbackRequestInformation;
import org.slf4j.Logger;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
+import org.apache.archiva.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
filterable="true"
showTitle="false"
showExports="false"
- view="org.codehaus.redback.integration.eXc.views.SecurityView"
- sortRowsCallback="org.codehaus.redback.integration.eXc.ProcessUserRowsCallback"
+ view="org.apache.archiva.redback.integration.eXc.views.SecurityView"
+ sortRowsCallback="org.apache.archiva.redback.integration.eXc.ProcessUserRowsCallback"
cellspacing="2"
cellpadding="3"
>
tooltip="Export Table to Excel format."/>
<ec:row>
<ec:column property="username" title="${username}"
- filterCell="org.codehaus.redback.integration.eXc.SecurityFilterCell">
+ filterCell="org.apache.archiva.redback.integration.eXc.SecurityFilterCell">
<img src="<c:url value="/images/redback/icon-user.gif"/>" />
<redback:ifAuthorized permission="user-management-user-edit" resource="${user.username}">
<s:url id="usereditUrl" action="useredit" includeParams="none">
</redback:elseAuthorized>
</ec:column>
<ec:column property="fullName" title="${fullName}" alias="fullname"
- filterCell="org.codehaus.redback.integration.eXc.SecurityFilterCell">
+ filterCell="org.apache.archiva.redback.integration.eXc.SecurityFilterCell">
<c:out value="${user.fullName}" />
</ec:column>
- <ec:column property="email" title="${email}" cell="org.codehaus.redback.integration.eXc.MailtoCell"
- filterCell="org.codehaus.redback.integration.eXc.SecurityFilterCell" />
- <ec:column property="permanent" cell="org.codehaus.redback.integration.eXc.CheckboxImageCell"
+ <ec:column property="email" title="${email}" cell="org.apache.archiva.redback.integration.eXc.MailtoCell"
+ filterCell="org.apache.archiva.redback.integration.eXc.SecurityFilterCell" />
+ <ec:column property="permanent" cell="org.apache.archiva.redback.integration.eXc.CheckboxImageCell"
style="text-align: center" title="${permanent}" filterable="false"/> <%-- Boolean's can't be filtered --%>
- <ec:column property="validated" cell="org.codehaus.redback.integration.eXc.CheckboxImageCell"
+ <ec:column property="validated" cell="org.apache.archiva.redback.integration.eXc.CheckboxImageCell"
style="text-align: center" title="${validated}" filterable="false"/> <%-- Boolean's can't be filtered --%>
- <ec:column property="locked" cell="org.codehaus.redback.integration.eXc.CheckboxImageCell"
+ <ec:column property="locked" cell="org.apache.archiva.redback.integration.eXc.CheckboxImageCell"
style="text-align: center" title="${locked}" filterable="false"/> <%-- Boolean's can't be filtered --%>
<ec:column title="${tasks}" alias="tasks" sortable="false" filterable="false" styleClass="tasks">
import org.apache.archiva.redback.policy.PasswordRuleViolations;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.codehaus.redback.integration.interceptor.SecureAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.interceptor.SecureAction;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
/**
* AbstractSecurityAction
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.model.UserCredentials;
+import org.apache.archiva.redback.integration.model.UserCredentials;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.integration.util.RoleSorter;
+import org.apache.archiva.redback.integration.util.RoleSorter;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.EditUserCredentials;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.EditUserCredentials;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.util.AutoLoginCookies;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.util.AutoLoginCookies;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.SessionMap;
import org.codehaus.plexus.cache.Cache;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.util.AutoLoginCookies;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.util.AutoLoginCookies;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.User;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.mail.Mailer;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.mail.Mailer;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.mail.Mailer;
-import org.codehaus.redback.integration.model.CreateUserCredentials;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.mail.Mailer;
+import org.apache.archiva.redback.integration.model.CreateUserCredentials;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.EditUserCredentials;
-import org.codehaus.redback.integration.util.AutoLoginCookies;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.EditUserCredentials;
+import org.apache.archiva.redback.integration.util.AutoLoginCookies;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.rbac.Resource;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.codehaus.plexus.redback.struts2.model.ApplicationRoleDetails.RoleTableCell;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.AdminEditUserCredentials;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.management.DataManagementTool;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.redback.integration.interceptor.SecureAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureAction;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.rbac.Resource;
import org.codehaus.plexus.redback.struts2.action.RedbackActionSupport;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
-import org.codehaus.redback.integration.util.OperationSorter;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.util.OperationSorter;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.codehaus.plexus.redback.struts2.action.RedbackActionSupport;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
-import org.codehaus.redback.integration.util.PermissionSorter;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.util.PermissionSorter;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.struts2.ServletActionContext;
import org.apache.archiva.redback.rbac.Resource;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.reports.Report;
-import org.codehaus.redback.integration.reports.ReportException;
-import org.codehaus.redback.integration.reports.ReportManager;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.reports.Report;
+import org.apache.archiva.redback.integration.reports.ReportException;
+import org.apache.archiva.redback.integration.reports.ReportManager;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import com.opensymphony.module.sitemesh.filter.PageResponseWrapper;
import org.springframework.context.annotation.Scope;
import org.apache.archiva.redback.rbac.Resource;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
-import org.codehaus.redback.integration.util.ResourceSorter;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.util.ResourceSorter;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
import org.codehaus.plexus.redback.struts2.action.AuditEvent;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.SimplePermission;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.SimplePermission;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.role.RoleManager;
import org.codehaus.plexus.redback.role.model.RedbackRoleModel;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.rbac.Role;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.codehaus.plexus.redback.struts2.action.AbstractUserCredentialsAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.codehaus.plexus.redback.struts2.action.AbstractSecurityAction;
import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.registry.Registry;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.codehaus.plexus.redback.struts2.action.AuditEvent;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.CreateUserCredentials;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.CreateUserCredentials;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.codehaus.plexus.redback.struts2.action.CancellableAction;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.model.AdminEditUserCredentials;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserQuery;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
-import org.codehaus.redback.integration.reports.Report;
-import org.codehaus.redback.integration.reports.ReportManager;
-import org.codehaus.redback.integration.role.RoleConstants;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.reports.Report;
+import org.apache.archiva.redback.integration.reports.ReportManager;
+import org.apache.archiva.redback.integration.role.RoleConstants;
import org.extremecomponents.table.context.Context;
import org.extremecomponents.table.context.HttpServletRequestContext;
import org.extremecomponents.table.limit.FilterSet;
import java.util.Map;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.redback.integration.checks.xwork.XworkActionConfig;
-import org.codehaus.redback.integration.checks.xwork.XworkPackageConfig;
+import org.apache.archiva.redback.integration.checks.xwork.XworkActionConfig;
+import org.apache.archiva.redback.integration.checks.xwork.XworkPackageConfig;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import java.util.List;
import org.apache.archiva.redback.system.check.EnvironmentCheck;
-import org.codehaus.redback.integration.checks.xwork.XworkPackageConfig;
+import org.apache.archiva.redback.integration.checks.xwork.XworkPackageConfig;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationManager;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.util.AutoLoginCookies;
+import org.apache.archiva.redback.integration.util.AutoLoginCookies;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
+import org.apache.archiva.redback.integration.checks.security.AdminAutoCreateCheck;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.commons.lang.StringUtils;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.UserManager;
-import org.codehaus.redback.integration.checks.security.AdminAutoCreateCheck;
-import org.codehaus.redback.integration.util.AutoLoginCookies;
+import org.apache.archiva.redback.integration.util.AutoLoginCookies;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.system.SecuritySystemConstants;
-import org.codehaus.redback.integration.interceptor.SecureAction;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.interceptor.SecureAction;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.codehaus.plexus.redback.struts2.model.ApplicationRoleDetails;
import org.codehaus.plexus.redback.struts2.model.ApplicationRoleDetails.RoleTableCell;
-import org.codehaus.redback.integration.interceptor.SecureActionBundle;
-import org.codehaus.redback.integration.interceptor.SecureActionException;
+import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
+import org.apache.archiva.redback.integration.interceptor.SecureActionException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.apache.archiva.redback.users.memory.SimpleUser;
-import org.codehaus.redback.integration.model.AdminEditUserCredentials;
+import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;