diff options
author | Olivier Lamy <olamy@apache.org> | 2012-10-09 07:59:02 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-10-09 07:59:02 +0000 |
commit | 0986c8885199366060dc37a7780a861f69685ced (patch) | |
tree | a8c952039e2ab2189e442aace57673d55d0ee2b4 /redback-integrations/redback-struts2 | |
parent | ad474747bd6fa0eb5edca39eaeb2bdbdc8784559 (diff) | |
download | archiva-0986c8885199366060dc37a7780a861f69685ced.tar.gz archiva-0986c8885199366060dc37a7780a861f69685ced.zip |
[MRM-1686] stop support of struts2 webapp.
move redback part to retired.
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1395894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'redback-integrations/redback-struts2')
143 files changed, 0 insertions, 15763 deletions
diff --git a/redback-integrations/redback-struts2/pom.xml b/redback-integrations/redback-struts2/pom.xml deleted file mode 100644 index af07db0dd..000000000 --- a/redback-integrations/redback-struts2/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-integrations</artifactId> - <version>2.1-SNAPSHOT</version> - </parent> - <artifactId>redback-struts2</artifactId> - <name>Redback :: Integration :: Struts 2</name> - <packaging>pom</packaging> - - <properties> - <struts.version>2.2.3.1</struts.version> - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-spring-plugin</artifactId> - <version>${struts.version}</version> - </dependency> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - <version>${struts.version}</version> - </dependency> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-junit-plugin</artifactId> - <version>${struts.version}</version> - </dependency> - <dependency> - <groupId>org.apache.struts.xwork</groupId> - <artifactId>xwork-core</artifactId> - <version>${struts.version}</version> - </dependency> - <dependency> - <groupId>ognl</groupId> - <artifactId>ognl</artifactId> - <version>3.0.2</version> - </dependency> - </dependencies> - </dependencyManagement> - - <modules> - <module>redback-struts2-integration</module> - <module>redback-struts2-content</module> - </modules> - -</project> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/pom.xml b/redback-integrations/redback-struts2/redback-struts2-content/pom.xml deleted file mode 100644 index 0cbb36943..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-struts2</artifactId> - <version>2.1-SNAPSHOT</version> - </parent> - <artifactId>redback-struts2-content</artifactId> - <name>Redback :: Integration :: Struts 2 Content War</name> - <packaging>war</packaging> - <dependencies> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-struts2-integration</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-common-integrations</artifactId> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - <dependency> - <groupId>commons-digester</groupId> - <artifactId>commons-digester</artifactId> - </dependency> - <dependency> - <groupId>ognl</groupId> - <artifactId>ognl</artifactId> - </dependency> - <dependency> - <groupId>jpox</groupId> - <artifactId>jpox</artifactId> - <scope>compile</scope> - <exclusions> - <!-- targeting JDK 1.4 we don't need this --> - <exclusion> - <groupId>javax.sql</groupId> - <artifactId>jdbc-stdext</artifactId> - </exclusion> - <exclusion> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </exclusion> - - <exclusion> - <groupId>javax.resource</groupId> - <artifactId>connector</artifactId> - </exclusion> - <exclusion> - <groupId>javax.transaction</groupId> - <artifactId>jta</artifactId> - </exclusion> - - </exclusions> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <configuration> - <warSourceExcludes>WEB-INF/lib/**</warSourceExcludes> - </configuration> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>jspc-maven-plugin</artifactId> - <version>1.4.6</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - <configuration> - <warSourceDirectory>${project.build.directory}/${project.build.finalName}/</warSourceDirectory> - <!-- - Uncomment outputWebXml if you want the generated web.xml to - be placed in the working directory that the war:war mojo uses. - --> - <!-- - <outputWebXml>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</outputWebXml> - --> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/resources/struts-security.xml b/redback-integrations/redback-struts2/redback-struts2-content/src/main/resources/struts-security.xml deleted file mode 100644 index 7d32b6d63..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/resources/struts-security.xml +++ /dev/null @@ -1,348 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" - "http://struts.apache.org/dtds/struts-2.0.dtd"> - -<!-- ================================================================== - Redback Security Tools - - This should contain the /security namespaced action configurations. - - These configurations will likely not need changing. - - These configurations point to the overlaid jsp files. - ================================================================== --> - -<struts> - <!-- ================================================================== - Security Tools for Users - - All Users should be able to access and use the actions contained - within this package. - ================================================================== --> - - <package name="security" extends="struts-default" namespace="/security"> - <result-types> - <result-type name="security-external" class="securityExternalResult" /> - </result-types> - - <interceptors> - <interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/> - <interceptor name="redbackEnvCheck" class="redbackEnvironmentCheckInterceptor"/> - <interceptor name="redbackAutoLogin" class="redbackAutoLoginInterceptor"/> - <interceptor name="redbackPolicyEnforcement" class="redbackPolicyEnforcementInterceptor"/> - <interceptor name="redbackSecureActions" class="redbackSecureActionInterceptor"/> - - <!-- - Stacks are order dependent and fail silently by not running the referenced stack. - Make sure that redbackCommonStack remains above is usages. - --> - <interceptor-stack name="redbackCommonStack"> - <interceptor-ref name="redbackEnvCheck"/> - <interceptor-ref name="redbackForceAdminUser"/> - <interceptor-ref name="redbackAutoLogin"/> - <interceptor-ref name="redbackPolicyEnforcement"/> - <interceptor-ref name="redbackSecureActions"> - <param name="enableReferrerCheck">true</param> - </interceptor-ref> - </interceptor-stack> - - <interceptor-stack name="securedStack"> - <interceptor-ref name="defaultStack"/> - <interceptor-ref name="redbackCommonStack"/> - <interceptor-ref name="tokenSession"> - <param name="excludeMethods">*</param> - </interceptor-ref> - </interceptor-stack> - - <interceptor-stack name="securedPrepareParamsStack"> - <interceptor-ref name="paramsPrepareParamsStack"/> - <interceptor-ref name="redbackCommonStack"/> - </interceptor-stack> - - </interceptors> - - <default-interceptor-ref name="securedStack"/> - - <global-results> - <result name="security-admin-user-needed" type="redirectAction"> - <param name="actionName">addadmin</param> - <param name="namespace">/security</param> - </result> - <result name="requires-authentication">/WEB-INF/jsp/redback/requiresAuthentication.jsp</result> - <result name="requires-authorization">/WEB-INF/jsp/redback/accessDenied.jsp</result> - <result name="security-must-change-password" type="redirectAction"> - <param name="actionName">password</param> - <param name="namespace">/security</param> - </result> - <result name="security-resend-validation-email" type="redirectAction"> - <param name="actionName">userlist</param> - <param name="namespace">/security</param> - </result> - <result name="invalid.token">/WEB-INF/jsp/redback/invalidToken.jsp</result> - </global-results> - - <action name="login" class="redback-login" method="show"> - <result name="input">/WEB-INF/jsp/redback/login.jsp</result> - <result name="error">/WEB-INF/jsp/redback/login.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-login-cancel</param> - </result> - <result name="security-login-locked" type="security-external"> - <param name="externalResult">security-login-locked</param> - </result> - </action> - - <action name="logout" class="redback-logout" method="logout"> - <result name="security-logout" type="security-external"> - <param name="externalResult">security-logout</param> - </result> - </action> - - <action name="register" class="redback-register" method="show"> - <result name="input">/WEB-INF/jsp/redback/register.jsp</result> - <result name="error">/WEB-INF/jsp/redback/register.jsp</result> - <result name="validation-note">/WEB-INF/jsp/redback/validationNotification.jsp</result> - <result name="security-register-success" type="security-external"> - <param name="externalResult">security-register-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-register-cancel</param> - </result> - </action> - - <action name="account" class="redback-account" method="show"> - <result name="input">/WEB-INF/jsp/redback/account.jsp</result> - <result name="error">/WEB-INF/jsp/redback/account.jsp</result> - <result name="security-account-success" type="security-external"> - <param name="externalResult">security-account-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-account-cancel</param> - </result> - </action> - - <action name="password" class="redback-password" method="show"> - <result name="input">/WEB-INF/jsp/redback/password.jsp</result> - <result name="error">/WEB-INF/jsp/redback/password.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="security-register-success" type="security-external"> - <param name="externalResult">security-register-success</param> - </result> - <result name="success" type="redirect">${targetUrl}</result> - <result name="cancel" type="redirectAction"> - <param name="actionName">logout</param> - <param name="namespace">/security</param> - </result> - <result name="security-change-password-success">/WEB-INF/jsp/redback/changePasswordSuccess.jsp</result> - </action> - - <action name="passwordReset" class="redback-password-reset" method="show"> - <result name="input">/WEB-INF/jsp/redback/requestPasswordReset.jsp</result> - <result name="none">/WEB-INF/jsp/redback/login.jsp</result> - </action> - - <action name="addadmin" class="redback-admin-account" method="show"> - <interceptor-ref name="defaultStack"/> - <result name="input">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result> - <result name="login-error">/WEB-INF/jsp/redback/login.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="security-login-locked" type="security-external"> - <param name="externalResult">security-login-locked</param> - </result> - </action> - - <!-- ================================================================== - Security Tools for Administrators - - Only Administrators should be able to access and use these actions - ================================================================== --> - - <action name="systeminfo" class="redback-sysinfo" method="show"> - <result>/WEB-INF/jsp/redback/admin/systemInformation.jsp</result> - </action> - - <action name="adminConsole" class="redback-admin-console" method="show"> - <result>/WEB-INF/jsp/redback/admin/console.jsp</result> - </action> - - <action name="report" class="redback-report" method="generate"> - <result name="error" type="redirectAction">userlist</result> - </action> - - <action name="userlist" class="redback-admin-user-list" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/userList.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/userList.jsp</result> - </action> - - <action name="useredit" class="redback-admin-user-edit" method="edit"> - <result name="input">/WEB-INF/jsp/redback/admin/userEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/userEdit.jsp</result> - <result name="confirm">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result> - <result name="confirmError">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result> - <result name="success" type="redirectAction">userlist</result> - <result name="cancel" type="redirectAction">userlist</result> - </action> - - <action name="usercreate" class="redback-admin-user-create" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/userCreate.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/userCreate.jsp</result> - <result name="success" type="redirectAction"> - <param name="actionName">assignments</param> - <param name="principal">${user.username}</param> - </result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="userdelete" class="redback-admin-user-delete" method="confirm"> - <result name="input">/WEB-INF/jsp/redback/admin/userDelete.jsp</result> - <result name="error" type="redirectAction">userlist</result> - <result name="success" type="redirectAction">userlist</result> - <result name="cancel" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <!-- ==== RBAC Actions ========================================== --> - - <!-- This action is meant to be embedded within the User Edit action output jsp. - It is injected using the <ww:action> taglib --> - <action name="assignments" class="redback-assignments" method="show"> - <interceptor-ref name="securedStack"/> - <result name="input">/WEB-INF/jsp/redback/admin/assignments.jsp</result> - <result name="error">/WEB-INF/jsp/redback/include/error.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/assignments.jsp</result> - </action> - - <action name="addRolesToUser" class="redback-assignments" method="edituser"> - <result name="success" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="removeRolesFromUser" class="redback-assignments" method="edituser"> - <result name="success" type="redirectAction">userlist</result> - </action> - - <action name="rolecreate" class="redback-role-create" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result> - <result name="success" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="role" class="redback-role-edit" method="input"> - <result name="input">/WEB-INF/jsp/redback/admin/role.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/role.jsp</result> - <result name="success" type="redirectAction">roles</result> - </action> - - <action name="roleedit" class="redback-role-edit" method="edit"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success" type="redirectAction">roles</result> - </action> - - <action name="rolesave" class="redback-role-edit" method="save"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success" type="redirectAction">roles</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleusersadd" class="redback-role-edit" method="addUsers"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleusersremove" class="redback-role-edit" method="removeUsers"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleSummary" class="redback-roles" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/roleSummary.jsp</result> - </action> - - <action name="roles" class="redback-roles" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/roleList.jsp</result> - </action> - - <action name="permissions" class="redback-permissions" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/permissionList.jsp</result> - </action> - - <action name="operations" class="redback-operations" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/operationList.jsp</result> - </action> - - <action name="resources" class="redback-resources" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/resourceList.jsp</result> - </action> - - <action name="roleModel" class="redback-role-model" method="view"> - <result name="success">/WEB-INF/jsp/redback/admin/roleModel.jsp</result> - </action> - - <!-- - Backup Restore actions - --> - - <action name="backupRestore" class="backup-restore" method="view"> - <result>/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - </action> - - <action name="backup" class="backup-restore" method="backup"> - <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - <result type="redirectAction">backupRestore</result> - </action> - - <action name="restore" class="backup-restore" method="restore"> - <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - <result name="success" type="redirectAction">backupRestore</result> - </action> - - </package> - -</struts> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/accessDenied.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/accessDenied.jsp deleted file mode 100644 index da3af01d1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/accessDenied.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="access.denied.page.title"/></title> -</head> - -<body> - -<h4><s:text name="access.denied.section.title"/></h4> - -<div id="results"> - <%-- This is where the "Account Created Successfully" type message goes. --%> - <div class="success"> - <s:actionmessage /> - </div> - <%-- This is where errors from the action and other non-form field specific errors appear. --%> - <div class="errors"> - <s:actionerror /> - </div> -</div> - -<p> - <s:text name="access.denied.message"/> -</p> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/account.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/account.jsp deleted file mode 100644 index 0a424ed84..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/account.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="account.details.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="account.details.section.title"/></h2> - -<s:form action="account" namespace="/security" theme="xhtml" - id="registerForm" method="post" name="register" cssClass="security register"> - <%@ include file="/WEB-INF/jsp/redback/include/userCredentials.jsp" %> - <redback:isReadOnlyUserManager> - <s:submit value="%{getText('goback')}" method="cancel" /> - </redback:isReadOnlyUserManager> - <redback:isNotReadOnlyUserManager> - <s:submit value="%{getText('submit')}" method="submit" /> - <s:submit value="%{getText('cancel')}" method="cancel" /> - </redback:isNotReadOnlyUserManager> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/adminConsole.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/adminConsole.jsp deleted file mode 100644 index be439a978..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/adminConsole.jsp +++ /dev/null @@ -1,26 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>Insert title here</title> -</head> -<body> - -</body> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/assignments.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/assignments.jsp deleted file mode 100644 index 3748dd337..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/assignments.jsp +++ /dev/null @@ -1,176 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="assignments.page.title"/></title> -</head> - -<body> - -<h2><s:text name="assignments.section.title"/></h2> - - <div class="axial"> - <table border="1" cellspacing="2" cellpadding="3" width="100%"> - <s:label label="%{getText('username')}" name="principal"/> - <s:label label="%{getText('full.name')}" name="user.fullName"/> - <s:label label="%{getText('email')}" name="user.email"/> - </table> - </div> - -<!--<h3><s:text name="assignments.available.roles"/></h3>--> - - <s:form action="addRolesToUser" namespace="/security" name="addRoles"> - <s:hidden name="principal"/> - <s:hidden name="addRolesButton" value="true"/> - <s:token/> - - <s:iterator id="application" value="applicationRoleDetails"> - - <h3><c:out value="${application.name}" /></h3> - <c:if test="${!empty application.description}"> - <p><i><c:out value="${application.description}" /></i></p> - </c:if> - - <c:if test="${!empty assignedRoles}"> - - <h5><s:text name="assignments.assigned.roles"/></h5> - <table> - <s:iterator id="assignedRole" value="assignedRoles"> - <s:checkbox label="%{assignedRole}" name="addNDSelectedRoles" fieldValue="%{assignedRole}"/> - </s:iterator> - </table> - - </c:if> - <c:if test="${!empty availableRoles}"> - <h5><s:text name="assignments.available.roles"/></h5> - <table> - <s:iterator id="availableRole" value="availableRoles"> - <s:checkbox label="%{availableRole}" name="addNDSelectedRoles" value="false" fieldValue="%{availableRole}"/> - </s:iterator> - </table> - </c:if> - - <c:if test="${!empty table}"> - <h5><s:text name="assignments.resource.roles"/></h5> - <table> - <tr> - <td></td> - <s:iterator id="column" value="tableHeader"> - <td>${column.namePrefix}</td> - </s:iterator> - </tr> - - <c:forEach var="row" items="${table}"> - <tr> - <c:forEach var="column" items="${row}"> - - <c:choose> - <c:when test="${column.label}"> - <td>${column.name}</td> - </c:when> - <c:when test="${column.assigned}"> - <td> - <center> - <input type="checkbox" name="addDSelectedRoles" value="${column.name}" checked="checked"/> - </center> - </td> - </c:when> - <c:when test="${column.effectivelyAssigned}"> - <td> - <center> - <input type="checkbox" name="addDSelectedRoles" value="${column.name}" disabled="disabled"/> - </center> - </td> - </c:when> - <c:otherwise> - <td> - <center> - <input type="checkbox" name="addDSelectedRoles" value="${column.name}"/> - </center> - </td> - </c:otherwise> - </c:choose> - - </c:forEach> - </tr> - </c:forEach> - </table> - </c:if> - </s:iterator> - <%-- - <h4>Global Roles</h4> - <s:checkboxlist list="nondynamicroles" name="addNDSelectedRoles" value="NDRoles" theme="redback"/> - <br/> - - <h4>Resource Roles</h4> - <c:choose> - <c:when test="${!empty dynamicroles}"> - <c:set var="numtemplates" value="0"/> - <table border="1"> - <tr> - <td> </td> - <s:iterator id="template" value="templates"> - <td>${template.namePrefix}</td> - <c:set var="numtemplates" value="${numtemplates + 1}"/> - </s:iterator> - </tr> - <tr> - <c:set var="count" value="0"/> - <s:iterator id="dynamicrole" value="dynamicroles" status="row_status"> - <c:if test="${count == 0}"> - <td>${dynamicrole.resource}</td> - </c:if> - <c:set var="chkbx" value="<input type='checkbox' name='addDSelectedRoles' value='${dynamicrole.name}'/>"/> - <s:iterator id="drole" value="DRoles"> - <c:if test="${(drole == dynamicrole.name)}"> - <c:set var="chkbx" value="<input type='checkbox' name='addDSelectedRoles' value='${dynamicrole.name}' checked='yes'/>"/> - </c:if> - </s:iterator> - <td><center>${chkbx}</center></td> - <c:set var="count" value="${count + 1}"/> - <c:if test="${count == numtemplates}"> - <c:choose> - <c:when test="${row_status.last}"> - </tr> - </c:when> - <c:otherwise> - </tr><tr> - </c:otherwise> - </c:choose> - <c:set var="count" value="0"/> - </c:if> - </s:iterator> - </table> - </c:when> - <c:otherwise> - <p><em><s:text name="assignments.no.roles.to.grant"/></em></p> - </c:otherwise> - </c:choose> ---%> - <br/> - <s:submit value="%{getText('assignments.submit')}" name="submitRolesButton" theme="simple" /> - <br/> - <s:reset type="button" value="%{getText('assignments.reset')}" name="resetRolesButton" theme="simple" /> - </s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/backupRestore.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/backupRestore.jsp deleted file mode 100644 index 0be505473..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/backupRestore.jsp +++ /dev/null @@ -1,109 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> -<%@ taglib uri="/struts-tags" prefix="s"%> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> - <head> - <title><s:text name="backupRestore.page.title"/></title> - </head> - <body> - <div id="h3"> - <h3><s:text name="backupRestore.section.backup.title"/></h3> - - <c:if test="${!empty actionErrors}"> - <div class="errormessage"> - <s:iterator value="actionErrors"> - <p><s:text name="<s:property/>" /></p> - </s:iterator> - </div> - </c:if> - - <p> - You can back up the application data for this installation to prevent data loss in the case of system failures. - The application will be inaccessible while the backup takes place. - </p> - <p> - A backup will be stored on the server in a dated subdirectory of the backup directory: - <code> - <s:property value="backupDirectory" /> - </code> - </p> - - <s:form action="backup" method="post" > - <s:submit value="Create Backup" theme="simple"/> - </s:form> - </div> - - <div id="h3"> - <h3><s:text name="backupRestore.section.restore.title"/></h3> - <p> - You can reset the system to a previous state by using the - restore function, or use it to import data from another version of this application. - </p> - <p> - You can specify the directory where the backup files are located, or select from one of the recent backups in the configured - backup directory. - </p> - - <s:form action="restore" method="post" validate="true"> - <table> - <s:textfield name="restoreDirectory" label="Backup directory" - size="70" required="true" /> - <s:submit value="Restore Backup" theme="simple" /> - </table> - </s:form> - </div> - - <div id="h3"> - <h4><s:text name="backupRestore.section.recent.backup"/></h4> - - <s:set name="previousBackups" value="previousBackups" /> - <c:choose> - <c:when test="${empty(previousBackups)}"> - <div class="warningmessage"> - No previous backups found in the default backup directory. - </div> - </c:when> - <c:otherwise> - <table> - <c:forEach var="backup" items="${previousBackups}"> - <tr> - <td> - <fmt:formatDate value="${backup.date}" pattern="EEE MMM dd, yyyy 'at' HH:mm:ss" /> - </td> - <td> - <c:if test="${backup.userDatabase}"> - <c:set var="url"> - <s:url action="restore"> - <s:param name="restoreDirectory">${backup.directory}</s:param> - <s:param name="userDatabase" value="true" /> - </s:url> - </c:set> - <a href="${url}">Restore Users</a> - </c:if> - </td> - </tr> - </c:forEach> - </table> - </c:otherwise> - </c:choose> - </div> - </body> -</s:i18n> -</html> - diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp deleted file mode 100644 index c1a58920a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp +++ /dev/null @@ -1,63 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="user.edit.confirm.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="user.edit.confirm.section.title"/></h2> - -<redback:ifAuthorized permission="user-management-user-edit" resource="${user.username}"> - - <s:form action="useredit" namespace="/security" theme="xhtml" - id="userEditForm" method="post" cssClass="security userEdit"> - <redback:isNotReadOnlyUserManager> - <p> - You must re-confirm your password to proceed with the request to - <strong>edit the account information</strong> for user: <strong>${user.username}</strong> - </p> - - <s:password label="%{getText('user.admin.password')}" name="userAdminPassword" size="20" required="true"/> - <s:hidden label="Username" name="username" /> - <s:hidden name="user.username" value="%{user.username}"/> - <s:hidden name="user.fullName" value="%{user.fullName}"/> - <s:hidden name="user.email" value="%{user.email}"/> - <s:hidden name="user.password" value="%{user.password}"/> - <s:hidden name="user.confirmPassword" value="%{user.confirmPassword}"/> - <s:hidden name="user.timestampAccountCreation" value="%{user.timestampAccountCreation}"/> - <s:hidden name="user.timestampLastLogin" value="%{user.timestampLastLogin}"/> - <s:hidden name="user.timestampLastPasswordChange" value="%{user.timestampLastPasswordChange}"/> - <s:hidden name="user.locked" value="%{user.locked}"/> - <s:hidden name="user.passwordChangeRequired" value="%{user.passwordChangeRequired}"/> - <s:hidden name="method:confirmAdminPassword" value="Submit"/> - <s:submit id="confirmUserAdminSubmit" value="%{getText('submit')}" method="confirmAdminPassword" /> - <s:submit id="cancelUserAdminSubmit" value="%{getText('cancel')}" method="cancel" /> - </redback:isNotReadOnlyUserManager> - </s:form> -</redback:ifAuthorized> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/createAdmin.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/createAdmin.jsp deleted file mode 100644 index 1a290f20e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/createAdmin.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="create.admin.page.title"/></title> -</head> - -<body> - -<c:import url="/WEB-INF/jsp/redback/include/formValidationResults.jsp" /> - -<h2><s:text name="create.admin.section.title"/></h2> - -<s:form action="addadmin!submit" namespace="/security" theme="xhtml" - id="adminCreateForm" method="post" name="admincreate" cssClass="security adminCreate"> - <c:import url="/WEB-INF/jsp/redback/include/userCredentials.jsp" /> - <s:submit value="%{getText('create.admin')}" /> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/operationList.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/operationList.jsp deleted file mode 100644 index 7aa2a818d..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/operationList.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="operation.list.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" %> - -<h2><s:text name="operation.list.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<s:form action="operations!remove" method="post" theme="simple"> - - <table> - - <c:choose> - <c:when test="${!empty allOperations}"> - <thead> - <tr> - <th> </th> - <th><s:text name="name"/></th> - <th><s:text name="description"/></th> - </tr> - </thead> - - <c:forEach var="operation" items="${allOperations}"> - <tr> - <td> - <s:checkbox name="selectedOperations" fieldValue="%{operation.name}" /> - </td> - <td> - <s:url id="operationUrl" action="operation-edit"> - <s:param name="operationName">${operation.name}</s:param> - </s:url> - <s:a href="%{operationUrl}"><c:out value="${operation.name}" /></s:a> - </td> - <td> - <c:out value="${operation.description}" /> - </td> - </tr> - </c:forEach> - </c:when> - <c:otherwise> - <p><em><s:text name="operation.list.no.operations.available"/></em></p> - </c:otherwise> - </c:choose> - - <tr> - <td colspan="3"> - <s:submit value="%{getText('remove.selected.roles')}" /> - </td> - </tr> - - </table> - -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/permissionList.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/permissionList.jsp deleted file mode 100644 index a316cbae8..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/permissionList.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="permission.list.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" %> - -<h2><s:text name="permission.list.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<s:form action="permissions!remove" method="post" theme="simple"> - - <table> - - <c:choose> - <c:when test="${!empty allPermissions}"> - <thead> - <tr> - <th> </th> - <th><s:text name="name"/></th> - <th><s:text name="description"/></th> - </tr> - </thead> - - <c:forEach var="permission" items="${allPermissions}"> - <tr> - <td> - <s:checkbox name="selectedPermissions" fieldValue="%{permission.name}" /> - </td> - <td> - <s:url id="permissionUrl" action="permission-edit"> - <s:param name="permissionName">${permission.name}</s:param> - </s:url> - <s:a href="%{permissionUrl}"><c:out value="${permission.name}" /></s:a> - </td> - <td> - <c:out value="${permission.description}" /> - </td> - </tr> - </c:forEach> - </c:when> - <c:otherwise> - <p><em><s:text name="permission.list.no.permissions.available"/></em></p> - </c:otherwise> - </c:choose> - - <tr> - <td colspan="3"> - <s:submit value="%{getText('remove.selected.roles')}" /> - </td> - </tr> - - </table> - -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/resourceList.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/resourceList.jsp deleted file mode 100644 index 114a49c59..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/resourceList.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="resource.list.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" %> - -<h2><s:text name="resource.list.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<s:form action="resources!remove" method="post" theme="simple"> - - <table> - - <c:choose> - <c:when test="${!empty allResources}"> - <thead> - <tr> - <th> </th> - <th><s:text name="name"/></th> - <th><s:text name="description"/></th> - </tr> - </thead> - - <c:forEach var="resource" items="${allResources}"> - <tr> - <td> - <s:checkbox name="selectedResources" fieldValue="%{resource.identifier}" /> - </td> - <td> - <s:url id="resourceUrl" action="resource-edit"> - <s:param name="resourceIdentifier">${resource.identifier}</s:param> - </s:url> - <s:a href="%{resourceUrl}"><c:out value="${resource.identifier}" /></s:a> - </td> - <td> - <c:out value="${resource.pattern}" /> - </td> - </tr> - </c:forEach> - </c:when> - <c:otherwise> - <p><em><s:text name="resource.list.no.resources.available"/></em></p> - </c:otherwise> - </c:choose> - - <tr> - <td colspan="3"> - <s:submit value="%{getText('remove.selected.roles')}" /> - </td> - </tr> - - </table> - -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/role.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/role.jsp deleted file mode 100644 index 7dd878ca7..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/role.jsp +++ /dev/null @@ -1,132 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.page.title"/></title> -</head> - -<body> - - <%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - <h2><s:text name="role"/></h2> - - <div class="axial"> - <table border="1" cellspacing="2" cellpadding="3" width="100%"> - <s:label label="%{getText('name')}" name="name"/> - <s:label label="%{getText('description')}" name="description"/> - </table> - </div> - - <div class="functnbar3"> - <s:form action="roleedit" namespace="/security"> - <s:hidden name="name" /> - <s:submit value="%{getText('edit')}" theme="simple" /> - </s:form> - </div> - - <h3><s:text name="role.model.parent.roles"/></h3> - <c:if test="${empty parentRoleNames}"> - <s:text name="role.edit.no.parent.defined"/> - </c:if> - <c:if test="${!empty parentRoleNames}"> - <ul> - <s:iterator id="parentRoleName" value="parentRoleNames"> - <s:url id="roleUrl" action="role" includeParams="none"> - <s:param name="name">${parentRoleName}</s:param> - </s:url> - <li><s:a href="%{roleUrl}">${parentRoleName}</s:a></li> - </s:iterator> - </ul> - </c:if> - - <h3><s:text name="role.model.child.roles"/></h3> - <c:if test="${empty childRoleNames}"> - <s:text name="role.edit.no.childrole.defined"/> - </c:if> - <c:if test="${!empty childRoleNames}"> - <ul> - <s:iterator id="childRoleName" value="childRoleNames"> - <s:url id="roleUrl" action="role" includeParams="none"> - <s:param name="name">${childRoleName}</s:param> - </s:url> - <li><s:a href="%{roleUrl}"><c:out value="${childRoleName}" /></s:a></li> - </s:iterator> - </ul> - </c:if> - - <h3><s:text name="permissions"/></h3> - <c:if test="${empty permissions}"> - <s:text name="role.create.no.permissions.defined"/> - </c:if> - <c:if test="${!empty permissions}"> - <!-- ec on redback should not be dependent on the resource bundle of the project using it --> - <s:set name="role_name" value="%{getText('name')}"/> - <s:set name="role_operation" value="%{getText('role.operation')}"/> - <s:set name="role_resource" value="%{getText('role.resource')}"/> - <ec:table var="permission" - items="permissions" - autoIncludeParameters="false" - cellspacing="2" - cellpadding="3" - showExports="flase" - showPagination="false" - showTitle="false" - showStatusBar="false" - filterable="false"> - <ec:row> - <ec:column property="name" title="${role_name}"/> - <ec:column property="operation.name" title="${role_operation}"/> - <ec:column property="resource.identifier" title="${role_resource}"/> - </ec:row> - </ec:table> - </c:if> - - <h3><s:text name="role.edit.section.users"/></h3> - <c:if test="${!empty parentUsers}"> - <h4><s:text name="role.edit.users.defined.in.parent.roles"/></h4> - <ul> - <s:iterator id="user" value="parentUsers"> - <s:url id="usereditUrl" action="useredit" includeParams="none"> - <s:param name="username">${user.username}</s:param> - </s:url> - <li><s:a href="%{usereditUrl}"><c:out value="${user.fullName}" /> (<c:out value="${user.username}" /> - <c:out value="${user.email}" />)</s:a></li> - </s:iterator> - </ul> - </c:if> - <h4><s:text name="role.edit.users.defined.in.current.role"/></h4> - <c:if test="${empty users}"> - <s:text name="role.edit.no.user.defined"/> - </c:if> - <c:if test="${!empty users}"> - <ul> - <s:iterator id="user" value="users"> - <s:url id="usereditUrl" action="useredit" includeParams="none"> - <s:param name="username">${user.username}</s:param> - </s:url> - <li><s:a href="%{usereditUrl}"><c:out value="${user.fullName}" /> (<c:out value="${user.username}" /> - <c:out value="${user.email}" />)</s:a></li> - </s:iterator> - </ul> - </c:if> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleCreate.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleCreate.jsp deleted file mode 100644 index cf6fe445b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleCreate.jsp +++ /dev/null @@ -1,105 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.create.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="role.create.section.title"/></h2> - -<s:form action="rolecreate!submit" method="post" theme="xhtml" - name="roleCreateForm" cssClass="securiy rolecreate"> - <s:token/> - <s:textfield label="%{getText('role.name')}" name="roleName" /> - <s:textfield label="%{getText('role.description')}" name="description" maxlength="255"/> - <tr> - <td valign="top"><s:text name="permissions"/></td> - <td> - - <table cellspacing="0" cellpadding="2" class="permission"> - <thead> - <tr> - <th><s:text name="name"/></th> - <th><s:text name="role.create.operation"/></th> - <th><s:text name="role.create.resource"/></th> - </tr> - </thead> - <c:choose> - <c:when test="${!empty permissions}"> - <c:forEach var="permission" varStatus="loop" items="${permissions}"> - <tr> - <td> - <input type="text" name="permissions(${loop.index}).name" - value="${permission.name}" /> - </td> - <td> - <input type="text" name="permissions(${loop.index}).operationName" - value="${permission.operationName}" /> - </td> - <td> - <input type="text" name="permissions(${loop.index}).resourceIdentifier" - value="${permission.resourceIdentifier}" /> - </td> - </tr> - </c:forEach> - </c:when> - <c:otherwise> - <em><s:text name="role.create.no.permissions.defined"/></em> - </c:otherwise> - </c:choose> - - <tr class="addPermission"> - <td> - <s:textfield name="addpermission.name" theme="simple"/> - </td> - <td> - <s:textfield name="addpermission.operationName" theme="simple" /> - </td> - <td> - <s:textfield name="addpermission.resourceIdentifier" theme="simple" /> - </td> - <td> - <s:submit value="%{getText('role.create.add.permission')}" - onclick="setSubmitMode('addPermission')" /> - </td> - </tr> - </table> - - </td> - </tr> - <s:hidden name="submitMode" value="normal" /> - <s:submit value="%{getText('submit')}" onclick="setSubmitMode('normal')" /> -</s:form> - -<script language="javascript"> - function setSubmitMode(mode) - { - document.forms["roleCreateForm"].submitMode.value = mode; - } -</script> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleEdit.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleEdit.jsp deleted file mode 100644 index 13e3a8cb0..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleEdit.jsp +++ /dev/null @@ -1,157 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.page.title"/></title> -</head> - -<body> - - <%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - <h2><s:text name="role"/></h2> - - <s:actionerror/> - - <s:form action="rolesave" name="rolesave" namespace="/security"> - <s:hidden name="name"/> - <s:hidden name="usersList"/> - <s:token/> - <div class="axial"> - <table border="1" cellspacing="2" cellpadding="3" width="100%"> - <s:label label="%{getText('name')}" name="name"/> - <s:textfield label="%{getText('description')}" name="newDescription" maxlength="255"/> - </table> - </div> - <div class="functnbar3"> - <s:submit value="%{getText('save')}" theme="simple"/> - </div> - </s:form> - - <h3><s:text name="role.model.parent.roles"/></h3> - <c:if test="${empty parentRoleNames}"> - <s:text name="role.edit.no.parent.defined"/> - </c:if> - <c:if test="${!empty parentRoleNames}"> - <ul> - <s:iterator id="parentRoleName" value="parentRoleNames"> - <s:url id="roleeditUrl" action="roleedit" includeParams="none"> - <s:param name="name">${parentRoleName}</s:param> - </s:url> - <li><s:a href="%{roleeditUrl}"><c:out value="${parentRoleName}"/></s:a></li> - </s:iterator> - </ul> - </c:if> - - <h3><s:text name="role.model.child.roles"/></h3> - <c:if test="${empty childRoleNames}"> - <s:text name="role.edit.no.childrole.defined"/> - </c:if> - <c:if test="${!empty childRoleNames}"> - <ul> - <s:iterator id="childRoleName" value="childRoleNames"> - <s:url id="roleeditUrl" action="roleedit" includeParams="none"> - <s:param name="name">${childRoleName}</s:param> - </s:url> - <li><s:a href="%{roleeditUrl}"><c:out value="${childRoleName}" /></s:a></li> - </s:iterator> - </ul> - </c:if> - - <h3><s:text name="permissions"/></h3> - <c:if test="${empty permissions}"> - <s:text name="role.create.no.permissions.defined"/> - </c:if> - <c:if test="${!empty permissions}"> - <!-- ec on redback should not be dependent on the resource bundle of the project using it --> - <s:set name="role_name" value="%{getText('name')}"/> - <s:set name="role_operation" value="%{getText('role.operation')}"/> - <s:set name="role_resource" value="%{getText('role.resource')}"/> - <ec:table var="permission" - items="permissions" - autoIncludeParameters="false" - cellspacing="2" - cellpadding="3" - showExports="flase" - showPagination="false" - showTitle="false" - showStatusBar="false" - filterable="false"> - <ec:row> - <ec:column property="name" title="${role_name}"/> - <ec:column property="operation.name" title="${role_operation}"/> - <ec:column property="resource.identifier" title="${role_resource}"/> - </ec:row> - </ec:table> - </c:if> - - <h3><s:text name="role.edit.section.users"/></h3> - - <c:if test="${!empty parentUsers}"> - <h4><s:text name="role.edit.users.defined.in.parent.roles"/></h4> - <ul> - <s:iterator id="user" value="parentUsers"> - <s:url id="usereditUrl" action="useredit" includeParams="none"> - <s:param name="username">${user.username}</s:param> - </s:url> - <li><s:a href="%{usereditUrl}"><c:out value="${user.fullName}"/> (<c:out value="${user.username}"/> - <c:out value="${user.email}"/>)</s:a></li> - </s:iterator> - </ul> - </c:if> - <h4><s:text name="role.edit.users.defined.in.current.role"/></h4> - <form name="roleusers"> - <input type="hidden" name="name" value="${name}"/> - <s:token/> - <table style="width:100%"> - <tr> - <td style="width:40%"> - <select size="20" multiple="multiple" id="allUsers" name="availableUsers" style="width: 100%"> - <s:iterator id="user" value="allUsers"> - <option value="<c:out value="${user.username}" />"><c:out value="${user.fullName}"/> - <c:out value="${user.username}"/></option> - </s:iterator> - </select> - </td> - <td style="text-align: center"> - <input type="submit" value="-->" onclick="this.form.action='roleusersadd.action'; this.form.submit();"/> - <br/> - <input type="submit" value="<--" onclick="this.form.action='roleusersremove.action'; this.form.submit();"/> - </td> - <td style="width:40%"> - <c:if test="${!empty users}"> - <select size="20" multiple="multiple" id="users" name="currentUsers" style="width: 100%"> - <s:iterator id="user" value="users"> - <option value="<c:out value="${user.username}" />"><c:out value="${user.fullName}"/> - <c:out value="${user.username}"/></option> - </s:iterator> - </select> - </c:if> - <c:if test="${empty users}"> - <select size="20" multiple="multiple" id="users" name="usersList" style="width: 100%"> - </select> - </c:if> - </td> - </tr> - </table> - </form> - -</body> -</s:i18n> -</html> -
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleList.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleList.jsp deleted file mode 100644 index 3f4f6d80f..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleList.jsp +++ /dev/null @@ -1,67 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.list.page.title"/></title> -</head> - -<body> - -<!-- %@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" % --> - -<h2><s:text name="role.list.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - <table width="100%"> - - <c:choose> - <c:when test="${!empty allRoles}"> - <thead> - <tr> - <th width="49%"><s:text name="role.name"/></th> - <th width="49%"><s:text name="role.description"/></th> - </tr> - </thead> - - <c:forEach var="role" items="${allRoles}"> - <tr> - <td> - <s:url id="roleUrl" action="role"> - <s:param name="name">${role.name}</s:param> - </s:url> - <s:a href="%{roleUrl}"><c:out value="${role.name}" /></s:a> - </td> - <td> - <c:out value="${role.description}" /> - </td> - </tr> - </c:forEach> - </c:when> - <c:otherwise> - <p><em><s:text name="role.list.no.roles.available"/></em></p> - </c:otherwise> - </c:choose> - </table> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleModel.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleModel.jsp deleted file mode 100644 index b2a4f8450..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleModel.jsp +++ /dev/null @@ -1,163 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.model.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" %> - -<h2><s:text name="role.model.section.title"/></h2> - - <p><s:text name="role.model.message"/></p> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - <h4>${model.application}</h4> - - <h5><s:text name="resources"/>:</h5> - <ul> - <s:iterator id="resource" value="model.resources"> - <li> - <s:text name="role.model.id"/>: ${resource.id}<br/> - <s:text name="role.model.name"/>: ${resource.name}<br/> - <s:text name="role.model.permanent"/>: ${resource.permanent}<br/> - <br/> - </li> - </s:iterator> - </ul> - - <h5><s:text name="operations"/>:</h5> - <ul> - <s:iterator id="operation" value="model.operations"> - <li> - <s:text name="role.model.id"/>: ${operation.id}<br/> - <s:text name="role.model.name"/>: ${operation.name}<br/> - <s:text name="role.model.permanent"/>: ${operation.permanent}<br/> - <br/> - </li> - </s:iterator> - </ul> - - <h5><s:text name="roles"/>:</h5> - <ul> - <s:iterator id="role" value="model.roles"> - <li> - <s:text name="role.model.id"/>: ${role.id}<br/> - <s:text name="role.model.name"/>: ${role.name}<br/> - <s:text name="role.model.permanent"/>: ${role.permanent}<br/> - <s:text name="role.model.assignable"/>: ${role.assignable}<br/> - <s:text name="permissions"/>: - <ul> - <s:iterator id="permission" value="#role.permissions"> - <li> - <s:text name="role.model.id"/>: ${permission.id}<br/> - <s:text name="role.model.name"/>: ${permission.name}<br/> - <s:text name="role.model.permanent"/>: ${permission.permanent}<br/> - <s:text name="role.model.operation.id"/>: ${permission.operation}<br/> - <s:text name="role.model.resource.id"/>: ${permission.resource}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.child.roles"/>: - <ul> - <s:iterator id="childRole" value="#role.childRoles"> - <li> - <s:text name="role.model.role.id"/>: ${childRole}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.parent.roles"/>: - <ul> - <s:iterator id="parentRole" value="#role.parentRoles"> - <li> - <s:text name="role.model.role.id"/>: ${parentRole}<br/> - </li> - </s:iterator> - </ul> - </li> - <br/> - </s:iterator> - </ul> - - <h5><s:text name="role.model.templates"/>:</h5> - <ul> - <s:iterator id="template" value="model.templates"> - <li> - <s:text name="role.model.id"/>: ${template.id}<br/> - <s:text name="role.model.name.prefix"/>: ${template.namePrefix}<br/> - <s:text name="role.model.permanent"/>: ${template.permanent}<br/> - <s:text name="role.model.assignable"/>: ${template.assignable}<br/> - <s:text name="role.model.delimeter"/>: ${template.delimiter}<br/> - <s:text name="permissions"/>: - <ul> - <s:iterator id="permission" value="#template.permissions"> - <li> - <s:text name="role.model.id"/>: ${permission.id}<br/> - <s:text name="role.model.name"/>: ${permission.name}<br/> - <s:text name="role.model.permanent"/>: ${permission.permanent}<br/> - <s:text name="role.model.operation.id"/>: ${permission.operation}<br/> - <s:text name="role.model.resource.id"/>: ${permission.resource}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.child.roles"/>: - <ul> - <s:iterator id="childRole" value="#template.childRoles"> - <li> - <s:text name="role.model.role.id"/>: ${childRole}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.parent.roles"/>: - <ul> - <s:iterator id="parentRole" value="#template.parentRoles"> - <li> - <s:text name="role.model.role.id"/>: ${parentRole}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.child.templates"/>: - <ul> - <s:iterator id="childTemplate" value="#template.childTemplates"> - <li> - <s:text name="role.model.template.id"/>: ${childTemplate}<br/> - </li> - </s:iterator> - </ul> - <s:text name="role.model.parent.templates"/>: - <ul> - <s:iterator id="parentTemplate" value="#template.parentTemplates"> - <li> - <s:text name="role.model.template.id"/>: ${parentTemplate}<br/> - </li> - </s:iterator> - </ul> - </li> - <br/> - </s:iterator> - </ul> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleSummary.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleSummary.jsp deleted file mode 100644 index 2d198fb17..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/roleSummary.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="role.summary.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/rbacListNavigation.jsp" %> - -<h2><s:text name="role.summary.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - <ul> - <s:iterator id="role" value="allRoles"> - <li><s:text name="role"/>: <c:out value="${role.name}"/></li> - <ul> - <s:iterator id="permission" value="#role.permissions"> - <li>P[<c:out value="${permission.name}"/>] (<c:out value="${permission.operation.name}"/>, <c:out value="${permission.resource.identifier}"/>)</li> - </s:iterator> - </ul> - </s:iterator> - </ul> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/systemInformation.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/systemInformation.jsp deleted file mode 100644 index 5cff8d1b6..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/systemInformation.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="system.info.page.title"/></title> -</head> - -<body> - -<h4><s:text name="system.info.section.title"/></h4> - -<pre> -${details} -</pre> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userCreate.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userCreate.jsp deleted file mode 100644 index 1f7651aad..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userCreate.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="user.create.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="user.create.section.title"/></h2> - -<s:form action="usercreate!submit" namespace="/security" theme="xhtml" - id="userCreateForm" method="post" name="usercreate" cssClass="security userCreate"> - <%@ include file="/WEB-INF/jsp/redback/include/userCredentials.jsp" %> - <s:submit value="%{getText('user.create')}" id="userCreateSubmit" /> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userDelete.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userDelete.jsp deleted file mode 100644 index 9c97ce5e8..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userDelete.jsp +++ /dev/null @@ -1,45 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="user.delete.page.title"/></title> -</head> - -<body> - -<h2><s:text name="user.delete.section.title"/></h2> - -<s:form action="userdelete!submit" namespace="/security"> - <p> - <s:text name="user.delete.message"/>: - </p> - <p> - <s:text name="username"/>: <s:property value="user.username"/><br/> - <s:text name="full.name"/>: <s:property value="user.fullName"/><br/> - <s:text name="email"/>: <s:property value="user.email"/><br/> - </p> - <s:hidden label="Username" name="username" /> - <s:token/> - <s:submit value="%{getText('user.delete')}" theme="simple" id="userDeleteSubmit"/> - <s:submit value="%{getText('cancel')}" action="userdelete!cancel" theme="simple"/> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userEdit.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userEdit.jsp deleted file mode 100644 index 70954ecc0..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userEdit.jsp +++ /dev/null @@ -1,75 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib prefix="redback" uri="/redback/taglib-1.0"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="user.edit.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="user.edit.section.title"/></h2> - - <redback:ifAuthorized permission="user-management-user-edit" resource="${user.username}"> - <s:form action="useredit" namespace="/security" theme="xhtml" - id="userEditForm" method="post" name="useredit" cssClass="security userEdit"> - <%@ include file="/WEB-INF/jsp/redback/include/userCredentials.jsp" %> - <redback:isNotReadOnlyUserManager> - <s:checkbox label="%{getText('user.edit.locked.user')}" name="user.locked" /> - <s:checkbox label="%{getText('user.edit.force.user.change.password')}" name="user.passwordChangeRequired" /> - <s:hidden label="Username" name="username" /> - <s:submit value="%{getText('update')}" method="submit" /> - <s:submit value="%{getText('cancel')}" method="cancel" /> - </redback:isNotReadOnlyUserManager> - </s:form> - - <c:if test="${ emailValidationRequired}"> - <p> - <s:form action="register!resendRegistrationEmail" namespace="/security" theme="xhtml" - id="resendRegistationForm" method="post" name="resendRegistration" cssClass="security userEdit"> - <s:hidden label="Username" name="username" /> - <s:submit value="Resend Validation" method="submit" /> - </s:form> - </p> - </c:if> - </redback:ifAuthorized> - - <redback:ifAuthorized permission="user-management-user-role" resource="${user.username}"> - <c:if test="${!empty effectivelyAssignedRoles}"> - <h3><s:text name="effective.roles"/></h3> - - <ul> - <s:iterator id="role" value="effectivelyAssignedRoles"> - <li>${role.name}</li> - </s:iterator> - </ul> - - </c:if> - - <s:url id="assignmentUrl" action="assignments" includeParams="none"> - <s:param name="username">${user.username}</s:param> - </s:url> - <s:a href="%{assignmentUrl}"><s:text name="user.edit.roles"/></s:a> - </redback:ifAuthorized> -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userFind.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userFind.jsp deleted file mode 100644 index 7759f6c48..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userFind.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> - -<s:form cssClass="find" action="user" name="find" method="post" namespace="/security/admin"> - <s:textfield label="%{getText('user.find')}" name="username" /> - <s:submit value="%{getText('search')}" /> -</s:form> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userList.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userList.jsp deleted file mode 100644 index da4645e37..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/admin/userList.jsp +++ /dev/null @@ -1,217 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/redback/taglib-1.0" prefix="redback" %> -<%@ taglib uri="http://www.extremecomponents.org" prefix="ec" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="user.list.page.title"/></title> - <link rel="stylesheet" type="text/css" href="<s:url value="/css/redback/table.css"/>" media="screen"/> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<!-- ec on redback should not be dependent on the resource bundle of the project using it --> -<s:set name="username" value="%{getText('username')}"/> -<s:set name="fullName" value="%{getText('full.name')}"/> -<s:set name="email" value="%{getText('email')}"/> -<s:set name="permanent" value="%{getText('user.list.permanent')}"/> -<s:set name="validated" value="%{getText('user.list.validated')}"/> -<s:set name="locked" value="%{getText('user.list.locked')}"/> -<s:set name="tasks" value="%{getText('user.list.tasks')}"/> - -<h2><s:text name="user.list.section.title"><s:param>${roleName}</s:param></s:text></h2> - -<table class="outerTableRegion" cellpadding="0" cellspacing="0"> -<tr> -<td><ec:table - var="user" - items="users" - action="${pageContext.request.contextPath}/security/userlist!show.action" - imagePath="${pageContext.request.contextPath}/images/redback/table/*.gif" - autoIncludeParameters="false" - title="Users" - filterable="true" - showTitle="false" - showExports="false" - view="org.apache.archiva.redback.integration.eXc.views.SecurityView" - sortRowsCallback="org.apache.archiva.redback.integration.eXc.ProcessUserRowsCallback" - cellspacing="2" - cellpadding="3" - > - <%-- TODO: Fix export download. --%> - <ec:export - view="csv" - fileName="users.csv" - imageName="csv" - tooltip="Export Table to CSV (Comma Seperated Values)."/> - <ec:export - view="xls" - fileName="users.xls" - imageName="xls" - tooltip="Export Table to Excel format."/> - <ec:row> - <ec:column property="username" title="${username}" - 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"> - <s:param name="username">${user.username}</s:param> - </s:url> - <s:a href="%{usereditUrl}"><c:out value="${user.username}" /></s:a> - </redback:ifAuthorized> - <redback:elseAuthorized> - <redback:ifAuthorized permission="user-management-user-role" resource="${user.username}"> - <s:url id="usereditUrl" action="useredit" includeParams="none"> - <s:param name="username">${user.username}</s:param> - </s:url> - <s:a href="%{usereditUrl}"><c:out value="${user.username}" /></s:a> - </redback:ifAuthorized> - <redback:elseAuthorized> - <c:out value="${user.username}" /> - </redback:elseAuthorized> - </redback:elseAuthorized> - </ec:column> - <ec:column property="fullName" title="${fullName}" alias="fullname" - filterCell="org.apache.archiva.redback.integration.eXc.SecurityFilterCell"> - <c:out value="${user.fullName}" /> - </ec:column> - <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.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.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"> - <c:if test="${user.permanent eq false}"> - <redback:ifAuthorized permission="user-management-user-delete" resource="${user.username}"> - <s:token/> - <s:url id="userdeleteUrl" action="userdelete"> - <s:param name="username">${user.username}</s:param> - <s:param name="struts.token.name">struts.token</s:param> - <s:param name="struts.token"><s:property value="struts.token"/></s:param> - </s:url> - <s:a href="%{userdeleteUrl}" title="delete user"> - <img src="<c:url value="/images/redback/delete.gif"/>" border="none"/> - </s:a> - </redback:ifAuthorized> - </c:if> - </ec:column> - </ec:row> -</ec:table></td> -</tr> - -<%-- -<tr><td></td></tr> -<tr> - -<td> - <redback:ifAuthorized permission="user-management-user-create"> - <div class="task createUser"> - <s:form action="usercreate!show" namespace="/security" theme="simple" method="post"> - <s:submit cssClass="button" value="Create New User" /> - </s:form> - </div> - </redback:ifAuthorized> -</td> -</tr> --%> -</table> - -<br> -<br> -<b><s:text name="user.list.tools"/></b> -<br> - -<table class="tools" border="0" cellspacing="1" cellpadding="0"> - -<tr> - <th class="toolHeading"><s:text name="user.list.tasks"/></th> - <th class="toolHeading column"><s:text name="user.list.reports"/></th> -</tr> - -<tr> - <td valign="top"> - <p class="description"><s:text name="user.list.message"/></p> - - <redback:isNotReadOnlyUserManager> - <redback:ifAuthorized permission="user-management-user-create"> - <div class="task createUser"> - <s:form action="usercreate!show" namespace="/security" theme="simple" method="post"> - <s:token/> - <s:submit cssClass="button" value="%{getText('user.list.create.new.user')}" id="userCreateButton"/> - </s:form> - </div> - </redback:ifAuthorized> - </redback:isNotReadOnlyUserManager> - - <div class="task showRoles"> - <s:form action="userlist!show" namespace="/security" theme="simple" method="get"> - <s:submit cssClass="button" value="%{getText('user.list.show.users.in.role')}" /> - <s:select list="roles" - name="roleName" - value="roleName" - listKey="name" - listValue="name" - headerKey="" - headerValue="Any"/> - </s:form> - </div> - - </td> - - <td valign="top" class="column"> - <table cellspacing="0" cellpadding="0" border="0" class="reports"> - <tr> - <th><s:text name="name"/></th> - <th><s:text name="user.list.types"/></th> - </tr> - - <c:forEach items="${reportMap}" var="reportEntry"> - <tr> - <td class="reportName" nowrap="nowrap"> - <c:forEach items="${reportEntry.value}" var="report" varStatus="status"> - <c:if test="${status.first}"> - ${report.value.name} - </c:if> - </c:forEach> - </td> - <td class="reportViews"> - <c:forEach items="${reportEntry.value}" var="report" varStatus="status"> - <a href="<c:url value="/security/report!generate.action?reportId=${report.value.id}&reportType=${report.value.type}"/>" - title="${report.value.name} Report (${report.value.type} type)"><img - src="<c:url value="/images/redback/table/${report.value.type}.gif"/>" /></a> - </c:forEach> - </td> - </tr> - </c:forEach> - </table> - </td> -</tr> - -</table> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/alert.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/alert.jsp deleted file mode 100644 index f596548c4..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/alert.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="alert.page.title"/></title> -</head> - -<body> - -<div id="contentArea"> - <div id="searchBox"> - <div id="results"> - <s:text name="alert.message"/> - </div> - </div> -</div> - -<div class="clear"> - <hr/> -</div> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/changePasswordSuccess.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/changePasswordSuccess.jsp deleted file mode 100644 index 69334da0a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/changePasswordSuccess.jsp +++ /dev/null @@ -1,29 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - -<html> - <s:i18n name="org.apache.archiva.redback.struts2.default"> - <head> - <title><s:text name="change.password.page.title"/></title> - </head> - - <body> - <p><h4><s:text name="change.password.success.section.title"/></h4></p> - </body> - - </s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/generalError.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/generalError.jsp deleted file mode 100644 index 499f84312..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/generalError.jsp +++ /dev/null @@ -1,36 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="general.error.page.title"/></title> -</head> - -<body> - -<h1><s:text name="general.error.page.section"/></h1> - -<s:actionerror /> - -<s:actionmessage /> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/error.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/error.jsp deleted file mode 100644 index a993c975d..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/error.jsp +++ /dev/null @@ -1,19 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<s:actionerror/> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/formValidationResults.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/formValidationResults.jsp deleted file mode 100644 index 70c8145e1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/formValidationResults.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - -<div id="results"> - <%-- This is where the "Account Created Successfully" type message goes. --%> - <div class="success"> - <s:actionmessage /> - </div> - <%-- This is where errors from the action and other non-form field specific errors appear. --%> - <div class="errors"> - <s:actionerror /> - </div> -</div> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/grantRoles.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/grantRoles.jsp deleted file mode 100644 index 61b5953cb..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/grantRoles.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> -<%@ taglib uri="/struts-tags" prefix="s" %> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - <s:set name="availableRoles" value="#availableRoles"/> - <s:form action="user" name="grantRole" method="post" namespace="/security/admin"> - <s:hidden name="principal">${username}"</s:hidden> - <s:select name="roleName" list="availableRoles" labelposition="top" /> - <s:submit value="%{getText('grant')}" /> - </s:form> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/rbacListNavigation.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/rbacListNavigation.jsp deleted file mode 100644 index 541bba47e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/rbacListNavigation.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> - -<div class="rbac-navigation-bar"> - -<s:url id="rolesUrl" action="roles" namespace="/security" method="list"/> -<s:url id="permissionsUrl" action="permissions" namespace="/security" method="list"/> -<s:url id="operationsUrl" action="operations" namespace="/security" method="list"/> -<s:url id="resourcesUrl" action="resources" namespace="/security" method="list"/> - -<s:a href="%{rolesUrl}"><s:text name="roles"/></s:a> | -<s:a href="%{permissionsUrl}"><s:text name="permissions"/></s:a> | -<s:a href="%{operationsUrl}"><s:text name="operations"/></s:a> | -<s:a href="%{resourcesUrl}"><s:text name="resources"/></s:a> - -</div> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/removeRoles.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/removeRoles.jsp deleted file mode 100644 index 7c5dee244..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/removeRoles.jsp +++ /dev/null @@ -1,21 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> -<%@ taglib uri="/struts-tags" prefix="s" %> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - <s:form action="user" name="removeRole" method="post" namespace="/security/admin"> - <s:hidden name="principal">${username}</s:hidden> - <s:select name="roleName" list="assignedRoles" labelposition="top" /> - <s:submit value="%{getText('remove')}" /> - </s:form> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/roleRow.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/roleRow.jsp deleted file mode 100644 index 9e7fcdfb1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/roleRow.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags"%> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - - <td> - <c:out value="${role.name}" /> - </td> - - <td> - <c:out value="${role.description}" /> - </td> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/securityLinks.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/securityLinks.jsp deleted file mode 100644 index 5aeb799dd..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/securityLinks.jsp +++ /dev/null @@ -1,54 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib uri="/struts-tags" prefix="s" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/redback/taglib-1.0" prefix="redback" %> - -<span class="securityLinks"> - -<c:choose> - <c:when test="${sessionScope.securitySession.authenticated != true}"> - <s:url id="loginUrl" action="login" namespace="/security" includeParams="none"/> - <s:url id="registerUrl" action="register" namespace="/security" includeParams="none"/> - <s:a id="loginLink" href="%{loginUrl}"><s:text name="login"/></s:a><redback:isNotReadOnlyUserManager> - <s:a id="registerLink" href="%{registerUrl}"><s:text name="register"/></s:a></redback:isNotReadOnlyUserManager> - </c:when> - <c:otherwise> - <s:url id="logoutUrl" action="logout" namespace="/security" includeParams="none"/> - <s:url id="accountUrl" action="account" namespace="/security" includeParams="none" /> - - <s:text name="current.user"/> - <c:choose> - <c:when test="${sessionScope.securitySession.user != null}"> - <span class="fullname"><s:a href="%{accountUrl}" cssClass="edit"><c:out value="${sessionScope.securitySession.user.fullName}" /></s:a></span> - (<span class="username"><c:out value="${sessionScope.securitySession.user.username}" /></span>) - </c:when> - <c:otherwise> - <span class="fullname"><s:text name="%{unknown.user}"/></span> - </c:otherwise> - </c:choose> - - <redback:isNotReadOnlyUserManager> - - <s:a id="editUserLink" href="%{accountUrl}" cssClass="edit"><s:text name="edit.details"/></s:a> - </redback:isNotReadOnlyUserManager> - - <s:a id="logoutLink" href="%{logoutUrl}" cssClass="logout"><s:text name="logout"/></s:a> - - <c:if test="${sessionScope.passwordExpirationNotification != null}"> - - <s:text name="notify.password.expiration"/> ${sessionScope.passwordExpirationNotification} - </c:if> - </c:otherwise> -</c:choose> - -</span> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/userCredentials.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/userCredentials.jsp deleted file mode 100644 index 4b18f9612..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/include/userCredentials.jsp +++ /dev/null @@ -1,75 +0,0 @@ -<%-- - ~ Copyright 2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/redback/taglib-1.0" prefix="redback" %> - -<c:choose> - <c:when test="${user.edit}"> - <s:label label="%{getText('username')}" name="user.username" /> - <s:hidden name="user.username" /> - </c:when> - <c:otherwise> - <redback:isReadOnlyUserManager> - <s:label label="%{getText('username')}" name="user.username" /> - </redback:isReadOnlyUserManager> - <redback:isNotReadOnlyUserManager> - <s:textfield label="%{getText('username')}" name="user.username" size="30" required="true"/> - </redback:isNotReadOnlyUserManager> - </c:otherwise> -</c:choose> - - - - <redback:isReadOnlyUserManager> - <s:label label="%{getText('full.name')}" name="user.fullName" /> - </redback:isReadOnlyUserManager> - <redback:isNotReadOnlyUserManager> - <s:textfield label="%{getText('full.name')}" name="user.fullName" size="30" required="true"/> - </redback:isNotReadOnlyUserManager> - - <redback:isReadOnlyUserManager> - <s:label label="%{getText('email.address')}" name="user.email" /> - </redback:isReadOnlyUserManager> - <redback:isNotReadOnlyUserManager> - <s:textfield label="%{getText('email.address')}" name="user.email" size="50" required="true"/> - </redback:isNotReadOnlyUserManager> - - <redback:isNotReadOnlyUserManager> - <c:choose> - <c:when test="${self}"> - <s:password label="%{getText('current.password')}" name="oldPassword" size="20" required="true"/> - <s:password label="%{getText('new.password')}" name="user.password" size="20" required="true"/> - </c:when> - <c:otherwise> - <s:password label="%{getText('password')}" name="user.password" size="20" required="true"/> - </c:otherwise> - </c:choose> - <s:password label="%{getText('confirm.password')}" name="user.confirmPassword" size="20" required="true"/> - </redback:isNotReadOnlyUserManager> - -<s:if test="%{user.timestampAccountCreation != null}"> - <s:label label="%{getText('account.creation')}" name="user.timestampAccountCreation" /> -</s:if> - -<s:if test="%{user.timestampLastLogin != null}"> - <s:label label="%{getText('last.login')}" name="user.timestampLastLogin" /> -</s:if> - -<s:if test="%{user.timestampLastPasswordChange != null}"> - <s:label label="%{getText('last.password.change')}" name="user.timestampLastPasswordChange" /> -</s:if> -<s:token/> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/invalidToken.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/invalidToken.jsp deleted file mode 100644 index 526f26e66..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/invalidToken.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%-- - ~ Copyright 2011 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="invalid.token.page.title"/></title> -</head> - -<body> - -<h4><s:text name="invalid.token.section.title"/></h4> - -<p> - <s:text name="invalid.token.message"/> -</p> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/login.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/login.jsp deleted file mode 100644 index 274ec27f9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/login.jsp +++ /dev/null @@ -1,77 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/redback/taglib-1.0" prefix="redback" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="login.page.title"/></title> -</head> - -<body onload="javascript:document.forms['login'].username.focus();"> - - -<c:choose> - <c:when test="${sessionScope.securitySession.authenticated != true}"> - - <h2><s:text name="login.section.title"/></h2> - - <%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - - - <s:form action="login" namespace="/security" theme="xhtml" - id="loginForm" method="post" name="login" cssClass="security login"> - <s:textfield label="%{getText('username')}" name="username" size="30" /> - <s:password label="%{getText('password')}" name="password" size="20" /> - <s:checkbox label="%{getText('login.remember.me')}" name="rememberMe" value="false" /> - <s:submit value="%{getText('login')}" method="login" id="loginSubmit"/> - <s:submit value="%{getText('cancel')}" method="cancel" id="loginCancel" /> - </s:form> -<%-- TODO: Figure out how to auto-focus to first field --%> - -<ul class="tips"> - <%-- - <li> - Forgot your Username? - <s:url id="forgottenAccount" action="findAccount" /> - <s:a href="%{forgottenAccount}">Email me my account information.</s:a> - </li> - --%> - <redback:isNotReadOnlyUserManager> - <li> - <s:text name="login.need.an.account"/> - <s:url id="registerUrl" action="register" /> - <s:a id="registerLinkLoginPage" href="%{registerUrl}"><s:text name="login.register"/></s:a> - </li> - <li> - <s:text name="login.forgot.your.password"/> - <s:url id="forgottenPassword" action="passwordReset" /> - <s:a id="forgottenPasswordLink" href="%{forgottenPassword}"><s:text name="login.request.password.reset"/></s:a> - </li> - </redback:isNotReadOnlyUserManager> -</ul> -</c:when> -<c:otherwise> - <p/> - <s:text name="login.already.logged.in"/> - <p/> -</c:otherwise> -</c:choose> -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/password.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/password.jsp deleted file mode 100644 index 37b455612..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/password.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="password.page.title"/></title> -</head> - -<body onload="javascript:document.forms['password'].existingPassword.focus();"> - -<h2><s:text name="password.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<s:form action="password" namespace="/security" theme="xhtml" - id="passwordForm" method="post" name="password" cssClass="security password"> - <c:if test="${provideExisting}"> - <s:password label="%{getText('password.existing')}" name="existingPassword" size="20" required="true" /> - </c:if> - <s:password label="%{getText('password.new')}" name="newPassword" size="20" required="true" /> - <s:password label="%{getText('password.new.confirm')}" name="newPasswordConfirm" size="20" required="true" /> - <s:submit value="%{getText('password.change')}" method="submit" /> - <s:submit value="%{getText('cancel')}" method="cancel" /> -</s:form> - -<ul class="tips"> - -</ul> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/passwordResetNotification.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/passwordResetNotification.jsp deleted file mode 100644 index 7c2b3c8db..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/passwordResetNotification.jsp +++ /dev/null @@ -1,39 +0,0 @@ -<%-- - ~ Copyright 2007 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="password.reset.page.title"/></title> -</head> - -<body> - -<p> - <s:text name="password.reset.message"/> -</p> - -<p> -<s:url id="loginUrl" action="login" /> -<s:text name="password.reset.go.to"/><s:a href="%{loginUrl}"><s:text name="login"/></s:a> -</p> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/register.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/register.jsp deleted file mode 100644 index 48b428043..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/register.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="register.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="register.section.title"/></h2> - -<s:form action="register" namespace="/security" theme="xhtml" - id="registerForm" method="post" name="register" cssClass="security register"> - - <s:textfield label="%{getText('username')}" name="user.username" size="30" required="true"/> - <s:textfield label="%{getText('full.name')}" name="user.fullName" size="30" required="true"/> - <s:textfield label="%{getText('email.address')}" name="user.email" size="50" required="true"/> - - <c:if test="${! emailValidationRequired}"> - <s:password label="%{getText('password')}" name="user.password" size="20" required="true"/> - <s:password label="%{getText('confirm.password')}" name="user.confirmPassword" size="20" required="true"/> - </c:if> - - <s:submit value="%{getText('register')}" method="register" /> - <s:submit value="%{getText('cancel')}" method="cancel" /> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requestPasswordReset.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requestPasswordReset.jsp deleted file mode 100644 index 47f5141d5..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requestPasswordReset.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="request.password.reset.page.title"/></title> -</head> - -<body onload="javascript:document.forms['passwordReset'].username.focus();"> - -<h2><s:text name="request.password.reset.section.title"/></h2> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<s:form action="passwordReset" namespace="/security" theme="xhtml" - id="passwordResetForm" method="post" name="passwordReset" cssClass="security passwordReset"> - <s:textfield label="%{getText('username')}" name="username" size="30" required="true" /> - <s:submit value="%{getText('request.password.reset')}" method="reset" /> - <s:submit value="%{getText('cancel')}" method="cancel" /> -</s:form> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requiresAuthentication.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requiresAuthentication.jsp deleted file mode 100644 index f3c9d60d9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/requiresAuthentication.jsp +++ /dev/null @@ -1,54 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> - -<html> - -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="requires.authentication.page.title"/></title> -</head> - -<body> - -<h4><s:text name="requires.authentication.section.title"/></h4> - -<div id="results"> - <%-- This is where the "Account Created Successfully" type message goes. --%> - <div class="success"> - <s:actionmessage /> - </div> - <%-- This is where errors from the action and other non-form field specific errors appear. --%> - <div class="errors"> - <s:actionerror /> - </div> -</div> - -<p> - <s:text name="requires.authentication.message"/> -</p> - -<ol> -<li> - <s:url id="login" action="login" namespace="/security" includeParams="none"/> - <s:text name="requires.authentication.go.ahead"/><s:a href="%{login}"><s:text name="login"/></s:a> -</li> -</ol> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/validationNotification.jsp b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/validationNotification.jsp deleted file mode 100644 index 57e860f69..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/jsp/redback/validationNotification.jsp +++ /dev/null @@ -1,42 +0,0 @@ -<%-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --%> - -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> - -<html> -<s:i18n name="org.apache.archiva.redback.struts2.default"> -<head> - <title><s:text name="validation.notification.page.title"/></title> -</head> - -<body> - -<%@ include file="/WEB-INF/jsp/redback/include/formValidationResults.jsp" %> - -<h2><s:text name="validation.notification.section.title"/></h2> - -<p> - <s:text name="validation.notification.message.1"><s:param>(${user.email}).</s:param></s:text> -</p> - -<p> - <s:text name="validation.notification.message.2"><s:param>${user.email}</s:param></s:text> -</p> - -</body> -</s:i18n> -</html> diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/web.xml b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 90a4ed813..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> - -<!-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - - -<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> - <!-- Nothing Declared In Here. - Just defined to make maven-war-plugin happy. - You should declare web.xml specific content in your application webapp's web.xml - --> -</web-app>
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/css/redback/table.css b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/css/redback/table.css deleted file mode 100644 index 3211f1e05..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/css/redback/table.css +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -.eXtremeTable { - margin: 0px; - padding: 0px; -} - -.eXtremeTable select { - font-family: Verdana; - font-size: 9px; - border: solid 1px #EEE; - width: 75px; -} - -.outerTableRegion { - padding: 0px 0px 0px 2px; - border: 1px solid gray; - width: 100%; -} - -.outerTableRegion table { - margin-left: 0px; - margin-right: 0px; -} - -.outerTableRegion td, .outerTableRegion th { - padding: 2px 2px; -} - -.eXtremeTable .tableRegion { - font-family: Verdana; - font-size: 10px; - width: 100%; -} - -.eXtremeTable .filter { - background-color: #efefef; -} - -.eXtremeTable .filterToolbar { - padding: 0px 0px 10px; -} - -.eXtremeTable .filterInput { - padding: 5px 0px 0px 10px; - white-space: nowrap; -} - -.eXtremeTable .filter .filterInputGroup { - border: 1px solid gray; - background-color: white; - padding-right: 16px; - padding-left: 1px; - background-image: url("../../images/redback/table/filterIcon.gif"); - background-position: center right; - background-repeat: no-repeat; -} - -.eXtremeTable .filter input { - font-family: Verdana; - background: transparent; - border: 0px; - font-size: 10px; - margin: 0px; - margin-right: 16px; - height: 16px; - width: 100%; -} - -.eXtremeTable .filter select { - font-family: Verdana; - font-size: 9px; - border: solid 1px #EEE; - width: 100%; -} - -.eXtremeTable .tableRegion .tableHeader { - background-color: #308dbb; - color: white; - font-weight: bold; - text-align: left; - padding-right: 3px; - padding-left: 3px; - padding-top: 4; - padding-bottom: 4; - margin: 0; - border-right-style: solid; - border-right-width: 1px; - border-color: white; -} - -.eXtremeTable .tableRegion .tableHeaderSort { - background-color: #f8c471; - color: white; - font-weight: bold; - text-align: left; - padding-right: 3px; - padding-left: 3px; - padding-top: 4; - padding-bottom: 4; - border-right-style: solid; - border-right-width: 1px; - border-color: white; -} - -.eXtremeTable .odd a,.even a { - color: Black; - font-size: 9px; -} - -.eXtremeTable .odd td,.eXtremeTable .even td { - padding-top: 2px; - padding-right: 3px; - padding-bottom: 2px; - padding-left: 3px; - vertical-align: middle; - font-size: 9px; -} - -.eXtremeTable .odd { - background-color: #FFFFFF; -} - -.eXtremeTable .even { - background-color: #dfe4e8; -} - -.eXtremeTable .highlight td { - color: black; - font-size: 10px; - padding-top: 2px; - padding-right: 3px; - padding-bottom: 2px; - padding-left: 3px; - vertical-align: middle; - background-color: #fdecae; -} - -.eXtremeTable .highlight a,.highlight a { - color: black; - font-size: 10px; -} - -.eXtremeTable .toolbar { - background-color: #F4F4F4; - font-family: Verdana; - font-size: 9px; - margin-right: 1px; - border-right: 1px solid silver; - border-left: 1px solid silver; - border-top: 1px solid silver; - border-bottom: 1px solid silver; -} - -.eXtremeTable .toolbar td { - color: #444444; - padding: 0px 3px 0px 3px; - text-align: center; -} - -.eXtremeTable .separator { - width: 7px; -} - -.eXtremeTable .statusBar { - font-family: Verdana; - font-size: 10px; -} - -.eXtremeTable .compactToolbar button { - font-size: 10px; -} - -.eXtremeTable .compactToolbar { - font-size: 10px; - width: 100%; - padding-bottom: 0px; -} - -.eXtremeTable .compactToolbar table td { - white-space: nowrap; - padding-right: 4px; -} - -.eXtremeTable .title { - color: #444444; - font-weight: bold; - font-family: Verdana; - font-size: 15px; - vertical-align: middle; -} - -.eXtremeTable .title span { - margin-left: 7px; -} - -.eXtremeTable .roleSelect { - width: auto; -} - -.eXtremeTable .formButtons { - display: block; - margin-top: 10px; - margin-left: 5px; -} - -.eXtremeTable .formButton { - cursor: pointer; - font-family: Verdana; - font-size: 10px; - font-weight: bold; - background-color: #308dbb; - color: white; - margin-top: 5px; - border: outset 1px #333; - vertical-align: middle; -} - -.eXtremeTable .tableTotal { - background-color: #FFFFFF; - border-top: solid 1px Silver; -} - -.eXtremeTable .tableTotalEmpty { - background-color: #FFFFFF; -} - -.eXtremeTable img { - border: 0px; -} - -.eXtremeTable .tasks { - text-align: center; -} - -.eXtremeTable .tasks form { - padding: 0px; - margin: 0px; -} - -table.tools { - border: 1px solid gray; - margin-top: 7px; - padding: 0px 2px 2px 2px; -} - -table.tools img { - border: 0; -} - -table.tools th.toolHeading { - background-color: #308dbb; - color: white; - font-size: 12px; - padding: 3px; - text-align: left; -} - -table.tools form { - margin: 0; - padding: 0; -} - -table.tools p { - font-size: 10px; - margin: 5px; -} - -table.tools .task { - margin-bottom: 2px; -} - -table.tools form input,table.tools form select { - font-size: 10px; -} - -table.tools form .button { - margin-left: 15px; - width: 15em; -} - -table.tools .reports { - -} - -table.tools .reports th { - text-align: left; - font-size: 11px; -} - -table.tools .reports td { - text-align: left; - font-size: 10px; -}
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/delete.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/delete.gif Binary files differdeleted file mode 100644 index b6922ac11..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/delete.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon-user.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon-user.gif Binary files differdeleted file mode 100644 index 6dac098e1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon-user.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortdown.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortdown.gif Binary files differdeleted file mode 100644 index 9561bbe2a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortdown.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortup.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortup.gif Binary files differdeleted file mode 100644 index 61942d6d1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/icon_sortup.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/LICENSE.txt b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/LICENSE.txt deleted file mode 100644 index f47a56f65..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/LICENSE.txt +++ /dev/null @@ -1,6 +0,0 @@ -The images in this directory are from the eXtremecomponents 1.0.1 distribution. -http://www.extremecomponents.org/ - -eXtremecomponents is licensed under the Apache Source License. -http://extremecomp.cvs.sourceforge.net/extremecomp/eXtremeComponents/LICENSE.txt?view=markup - diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/checkbox-false.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/checkbox-false.gif Binary files differdeleted file mode 100644 index 7bc348ded..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/checkbox-false.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/clear.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/clear.gif Binary files differdeleted file mode 100644 index 176c239b6..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/clear.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/csv.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/csv.gif Binary files differdeleted file mode 100644 index 88aed4c44..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/csv.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filter.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filter.gif Binary files differdeleted file mode 100644 index f63762426..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filter.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterArrow.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterArrow.gif Binary files differdeleted file mode 100644 index bacf17cd2..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterArrow.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterIcon.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterIcon.gif Binary files differdeleted file mode 100644 index d597c7d18..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/filterIcon.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPage.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPage.gif Binary files differdeleted file mode 100644 index 285ebb15a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPage.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPageDisabled.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPageDisabled.gif Binary files differdeleted file mode 100644 index d1f5da97d..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/firstPageDisabled.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/icon_success_sml.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/icon_success_sml.gif Binary files differdeleted file mode 100644 index 52e85a430..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/icon_success_sml.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPage.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPage.gif Binary files differdeleted file mode 100644 index 57d2a1858..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPage.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPageDisabled.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPageDisabled.gif Binary files differdeleted file mode 100644 index e35ae2256..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/lastPageDisabled.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPage.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPage.gif Binary files differdeleted file mode 100644 index 7c5b30758..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPage.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPageDisabled.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPageDisabled.gif Binary files differdeleted file mode 100644 index 99c292f62..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/nextPageDisabled.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/pdf.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/pdf.gif Binary files differdeleted file mode 100644 index 858d1d7f7..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/pdf.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPage.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPage.gif Binary files differdeleted file mode 100644 index a051fa1f3..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPage.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPageDisabled.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPageDisabled.gif Binary files differdeleted file mode 100644 index 79c241b37..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/prevPageDisabled.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/separator.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/separator.gif Binary files differdeleted file mode 100644 index f9ac18fc9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/separator.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortAsc.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortAsc.gif Binary files differdeleted file mode 100644 index dbf04d313..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortAsc.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortDesc.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortDesc.gif Binary files differdeleted file mode 100644 index 021dbdf76..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/sortDesc.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/xls.gif b/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/xls.gif Binary files differdeleted file mode 100644 index 82b3895a6..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-content/src/main/webapp/images/redback/table/xls.gif +++ /dev/null diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml b/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml deleted file mode 100644 index f5e97cda3..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml +++ /dev/null @@ -1,342 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-struts2</artifactId> - <version>2.1-SNAPSHOT</version> - </parent> - - <artifactId>redback-struts2-integration</artifactId> - <packaging>bundle</packaging> - <name>Redback :: Integration :: Struts 2 Integration</name> - - <dependencies> - <!-- ================================================================ --> - <!-- Core Plexus Security Dependencies --> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-configuration</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-system</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-policy</artifactId> - </dependency> - <!-- User Management / Authentication --> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-authentication-users</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-authentication-ldap</artifactId> - </dependency> - <!-- Keys Management / Authentication --> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-keys-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-authentication-keys</artifactId> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <!-- RBAC Management / Authorization --> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-authorization-rbac</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-rbac-role-manager</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-rbac-cached</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-users-ldap</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-users-configurable</artifactId> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-data-management</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-common-integrations</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-integrations-security</artifactId> - </dependency> - - <!-- ================================================================ --> - <!-- OTHER Dependencies --> - - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.struts.xwork</groupId> - <artifactId>xwork-core</artifactId> - </dependency> - <dependency> - <groupId>ognl</groupId> - <artifactId>ognl</artifactId> - </dependency> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-spring-plugin</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - </dependency> - - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <scope>provided</scope> - <version>1.4</version> - </dependency> - - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context-support</artifactId> - </dependency> - - <dependency> - <groupId>org.extremecomponents</groupId> - <artifactId>extremecomponents</artifactId> - <version>1.0.1</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils-bean-collections</artifactId> - <version>1.7.0</version> - <!-- Needed by extremecomponents --> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-utils</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>taglibs</groupId> - <artifactId>standard</artifactId> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jstl</artifactId> - </dependency> - <dependency> - <groupId>commons-collections</groupId> - <artifactId>commons-collections</artifactId> - </dependency> - <dependency> - <groupId>commons-lang</groupId> - <artifactId>commons-lang</artifactId> - </dependency> - <dependency> - <groupId>opensymphony</groupId> - <artifactId>sitemesh</artifactId> - <version>2.4.2</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <!-- === Test Dependencies ======================= --> - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-keys-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-authentication-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-rbac-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.archiva.redback</groupId> - <artifactId>redback-users-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.easymock</groupId> - <artifactId>easymock</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.struts</groupId> - <artifactId>struts2-junit-plugin</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j.adapters</groupId> - <artifactId>slf4j-impl</artifactId> - <version>${log4jVersion}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j.adapters</groupId> - <artifactId>log4j-jcl</artifactId> - <version>${log4jVersion}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4jVersion}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.logging.log4j.adapters</groupId> - <artifactId>log4j12-api</artifactId> - <version>${log4jVersion}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <configuration> - <instructions> - <Export-Package> - org.apache.archiva.redback.struts2*;version=${project.version};-split-package:=merge-first - </Export-Package> - <Import-Package> - javax.annotation, - javax.mail.internet, - javax.servlet, - javax.servlet.http, - javax.inject;version="[1,2"), - com.google.common.collect, - com.opensymphony.module.sitemesh.filter;version="[2.4,3)", - com.opensymphony.xwork2*;version="[2.2,3)", - org.apache.archiva.redback.authentication;version=${project.version}, - org.apache.archiva.redback.authorization;version=${project.version}, - org.apache.archiva.redback.components.cache;version=${project.version}, - org.apache.archiva.redback.components.registry;version=${project.version}, - org.apache.archiva.redback.configuration;version=${project.version}, - org.apache.archiva.redback.integration.checks.xwork;version=${project.version}, - org.apache.archiva.redback.integration.interceptor;version=${project.version}, - org.apache.archiva.redback.integration.mail;version=${project.version}, - org.apache.archiva.redback.integration.model;version=${project.version}, - org.apache.archiva.redback.integration.reports;version=${project.version}, - org.apache.archiva.redback.integration.util;version=${project.version}, - org.apache.archiva.redback.keys;version=${project.version}, - org.apache.archiva.redback.management;version=${project.version}, - org.apache.archiva.redback.policy;version=${project.version}, - org.apache.archiva.redback.rbac;version=${project.version}, - org.apache.archiva.redback.role;version=${project.version}, - org.apache.archiva.redback.role.model;version=${project.version}, - org.apache.archiva.redback.system;version=${project.version}, - org.apache.archiva.redback.system.check;version=${project.version}, - org.apache.archiva.redback.users, - org.apache.commons.beanutils, - org.apache.commons.io, - org.apache.commons.lang, - org.apache.struts2, - org.apache.struts2.dispatcher, - org.apache.struts2.interceptor, - org.codehaus.plexus.util, - org.extremecomponents.table.context, - org.extremecomponents.table.limit, - org.springframework.*, - org.slf4j;resolution:=optional - </Import-Package> - </instructions> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <basedir>${basedir}</basedir> - <plexus.home>${basedir}/target</plexus.home> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - -</project> diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractSecurityAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractSecurityAction.java deleted file mode 100644 index 562441da4..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractSecurityAction.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.http.HttpServletRequest; - -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.policy.PasswordRuleViolationException; -import org.apache.archiva.redback.policy.PasswordRuleViolations; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystemConstants; -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 - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -public abstract class AbstractSecurityAction - extends RedbackActionSupport - implements SecureAction -{ - protected static final String REQUIRES_AUTHENTICATION = "requires-authentication"; - - private SecureActionBundle securityBundle; - - public SecureActionBundle getSecureActionBundle() - throws SecureActionException - { - if ( securityBundle == null ) - { - securityBundle = initSecureActionBundle(); - } - - return securityBundle; - } - - public abstract SecureActionBundle initSecureActionBundle() - throws SecureActionException; - - protected void setAuthTokens( SecuritySession securitySession ) - { - session.put( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - this.setSession( session ); - } - - protected SecuritySession getSecuritySession() - { - return (SecuritySession) session.get( SecuritySystemConstants.SECURITY_SESSION_KEY ); - } - - // ------------------------------------------------------------------ - // Internal Support Methods - // ------------------------------------------------------------------ - protected void processPasswordRuleViolations( PasswordRuleViolationException e ) - { - processPasswordRuleViolations( e, "user.password" ); - } - - protected void processPasswordRuleViolations( PasswordRuleViolationException e, String field ) - { - PasswordRuleViolations violations = e.getViolations(); - - if ( violations != null ) - { - for ( String violation : violations.getLocalizedViolations() ) - { - addFieldError( field, violation ); - } - } - } - - protected String getBaseUrl() - { - HttpServletRequest req = ServletActionContext.getRequest(); - return req.getScheme() + "://" + req.getServerName() - + ( req.getServerPort() == 80 ? "" : ":" + req.getServerPort() ) + req.getContextPath(); - } - - protected String getCurrentUser() - { - SecuritySession securitySession = getSecuritySession(); - if ( securitySession != null && securitySession.getUser() != null ) - { - return securitySession.getUser().getPrincipal().toString(); - } - else - { - return null; - } - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractUserCredentialsAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractUserCredentialsAction.java deleted file mode 100644 index a7791efda..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AbstractUserCredentialsAction.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.RBACManager; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.policy.PasswordRuleViolationException; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.system.SecuritySystem; -import org.codehaus.plexus.util.StringUtils; -import org.apache.archiva.redback.integration.model.UserCredentials; -import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants; -import org.apache.archiva.redback.integration.util.RoleSorter; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * AbstractUserCredentialsAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -public abstract class AbstractUserCredentialsAction - extends AbstractSecurityAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager manager; - - /** - * - */ - @Inject - protected SecuritySystem securitySystem; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - protected UserCredentials internalUser; - - protected final String VALID_USERNAME_CHARS = "[a-zA-Z_0-9\\-.@]*"; - - public RBACManager getManager() - { - return manager; - } - - public void setManager( RBACManager manager ) - { - this.manager = manager; - } - - public SecuritySystem getSecuritySystem() - { - return securitySystem; - } - - public void setSecuritySystem( SecuritySystem securitySystem ) - { - this.securitySystem = securitySystem; - } - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public void validateCredentialsLoose() - { - if ( StringUtils.isEmpty( internalUser.getUsername() ) ) - { - addFieldError( "user.username", getText( "username.required" ) ); - } - else - { - if ( !internalUser.getUsername().matches( VALID_USERNAME_CHARS ) ) - { - addFieldError( "user.username", getText( "username.invalid.characters" ) ); - } - } - - if ( StringUtils.isEmpty( internalUser.getFullName() ) ) - { - addFieldError( "user.fullName", getText( "fullName.required" ) ); - } - - if ( StringUtils.isEmpty( internalUser.getEmail() ) ) - { - addFieldError( "user.email", getText( "email.required" ) ); - } - - if ( !StringUtils.equals( internalUser.getPassword(), internalUser.getConfirmPassword() ) ) - { - addFieldError( "user.confirmPassword", getText( "passwords.does.not.match" ) ); - } - - try - { - if ( !StringUtils.isEmpty( internalUser.getEmail() ) ) - { - new InternetAddress( internalUser.getEmail(), true ); - } - } - catch ( AddressException e ) - { - addFieldError( "user.email", getText( "email.invalid" ) ); - } - } - - public void validateCredentialsStrict() - { - validateCredentialsLoose(); - - User tmpuser = internalUser.createUser( securitySystem.getUserManager() ); - - try - { - securitySystem.getPolicy().validatePassword( tmpuser ); - } - catch ( PasswordRuleViolationException e ) - { - processPasswordRuleViolations( e ); - } - - if ( ( StringUtils.isEmpty( internalUser.getPassword() ) ) ) - { - addFieldError( "user.password", getText( "password.required" ) ); - } - } - - /** - * this is a hack. this is a hack around the requirements of putting RBAC constraints into the model. this adds one - * very major restriction to this security system, that a role name must contain the identifiers of the resource - * that is being constrained for adding and granting of roles, this is unacceptable in the long term and we need to - * get the model refactored to include this RBAC concept - * - * @param roleList - * @return - * @throws org.apache.archiva.redback.rbac.RbacManagerException - * - */ - protected List<Role> filterRolesForCurrentUserAccess( List<Role> roleList ) - throws RbacManagerException - { - String currentUser = getCurrentUser(); - - List<Role> filteredRoleList = new ArrayList<Role>(); - - Map<String, List<Permission>> assignedPermissionMap = manager.getAssignedPermissionMap( currentUser ); - List<String> resourceGrants = new ArrayList<String>(); - - if ( assignedPermissionMap.containsKey( RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION ) ) - { - List<Permission> roleGrantPermissions = - assignedPermissionMap.get( RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION ); - - for ( Permission permission : roleGrantPermissions ) - { - if ( permission.getResource().getIdentifier().equals( Resource.GLOBAL ) ) - { - // the current user has the rights to assign any given role - return roleList; - } - else - { - resourceGrants.add( permission.getResource().getIdentifier() ); - } - } - } - else - { - return Collections.emptyList(); - } - - String delimiter = " - "; - - // we should have a list of resourceGrants now, this will provide us with the information necessary to restrict - // the role list - for ( Role role : roleList ) - { - int delimiterIndex = role.getName().indexOf( delimiter ); - for ( String resourceIdentifier : resourceGrants ) - { - - if ( ( role.getName().indexOf( resourceIdentifier ) != -1 ) && ( delimiterIndex != -1 ) ) - { - String resourceName = role.getName().substring( delimiterIndex + delimiter.length() ); - if ( resourceName.equals( resourceIdentifier ) ) - { - filteredRoleList.add( role ); - } - } - } - } - - Collections.sort( filteredRoleList, new RoleSorter() ); - return filteredRoleList; - } - - protected List<Role> getFilteredRolesForCurrentUserAccess() - throws RbacManagerException - { - List<Role> roles = manager.getAllRoles(); - - if ( roles == null ) - { - return Collections.emptyList(); - } - - return filterRolesForCurrentUserAccess( roles ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AccountAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AccountAction.java deleted file mode 100644 index cf30f48ad..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AccountAction.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.UserNotFoundException; -import org.apache.archiva.redback.policy.PasswordEncoder; -import org.apache.archiva.redback.policy.PasswordRuleViolationException; -import org.apache.archiva.redback.system.DefaultSecuritySession; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.UserManager; -import org.codehaus.plexus.util.StringUtils; -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 java.util.Arrays; - -/** - * AccountAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-account" ) -@Scope( "prototype" ) -public class AccountAction - extends AbstractUserCredentialsAction - implements CancellableAction -{ - private static final String ACCOUNT_SUCCESS = "security-account-success"; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private EditUserCredentials user; - - private String oldPassword; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - SecuritySession session = getSecuritySession(); - - if ( !session.isAuthenticated() ) - { - addActionError( getText( "cannot.show.account.login.required" ) ); - return REQUIRES_AUTHENTICATION; - } - - String username = session.getUser().getUsername(); - - if ( username == null ) - { - addActionError( getText( "cannot.edit.user.null.username" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( username ) ) - { - addActionError( getText( "cannot.edit.user.empty.username" ) ); - return ERROR; - } - - UserManager manager = super.securitySystem.getUserManager(); - - if ( !manager.userExists( username ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.does.not.exist", Arrays.asList( (Object) username ) ) ); - return ERROR; - } - - internalUser = user; - - try - { - User u = manager.findUser( username ); - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - user = new EditUserCredentials( u ); - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.get.user", Arrays.asList( (Object) username, e.getMessage() ) ) ); - return ERROR; - } - - return INPUT; - } - - public String submit() - { - SecuritySession session = getSecuritySession(); - - if ( !session.isAuthenticated() ) - { - addActionError( getText( "cannot.show.account.login.required" ) ); - return REQUIRES_AUTHENTICATION; - } - - String username = session.getUser().getUsername(); - - if ( username == null ) - { - addActionError( getText( "cannot.edit.user.null.username" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( username ) ) - { - addActionError( getText( "cannot.edit.user.empty.username" ) ); - return ERROR; - } - - if ( user == null ) - { - addActionError( getText( "cannot.edit.user.null.credentials" ) ); - return ERROR; - } - - if ( !user.getPassword().equals( user.getConfirmPassword() ) ) - { - addFieldError( "user.confirmPassword", getText( "password.confimation.failed" ) ); - return ERROR; - } - - UserManager manager = super.securitySystem.getUserManager(); - - if ( !manager.userExists( username ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.does.not.exist", Arrays.asList( (Object) username ) ) ); - return ERROR; - } - - internalUser = user; - - try - { - User u = manager.findUser( username ); - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - if ( StringUtils.isNotEmpty( user.getPassword() ) ) - { - PasswordEncoder encoder = securitySystem.getPolicy().getPasswordEncoder(); - - if ( !encoder.isPasswordValid( u.getEncodedPassword(), oldPassword ) ) - { - addFieldError( "oldPassword", getText( "password.provided.does.not.match.existing" ) ); - return ERROR; - } - - u.setPassword( user.getPassword() ); - } - - u.setFullName( user.getFullName() ); - u.setEmail( user.getEmail() ); - u.setPassword( user.getPassword() ); - - manager.updateUser( u ); - - //check if current user then update the session - if ( getSecuritySession().getUser().getUsername().equals( u.getUsername() ) ) - { - SecuritySession securitySession = - new DefaultSecuritySession( getSecuritySession().getAuthenticationResult(), u ); - - this.session.put( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - - setSession( this.session ); - } - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.get.user", Arrays.asList( (Object) username, e.getMessage() ) ) ); - return ERROR; - } - catch ( PasswordRuleViolationException e ) - { - processPasswordRuleViolations( e ); - return ERROR; - } - - return ACCOUNT_SUCCESS; - } - - public String cancel() - { - return CANCEL; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public EditUserCredentials getUser() - { - return user; - } - - public void setUser( EditUserCredentials user ) - { - this.user = user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - return bundle; - } - - public void setOldPassword( String oldPassword ) - { - this.oldPassword = oldPassword; - } - - public boolean isSelf() - { - return true; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AuditEvent.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AuditEvent.java deleted file mode 100644 index 6c976c51d..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/AuditEvent.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; - -public class AuditEvent -{ - private Logger logger = LoggerFactory.getLogger( AuditEvent.class.getName() ); - - private final String action; - - private String affectedUser; - - private String role; - - private String currentUser; - - public AuditEvent( String action ) - { - this.action = action; - } - - public void setRole( String role ) - { - this.role = role; - } - - public String getRole() - { - return role; - } - - public void setAffectedUser( String affectedUser ) - { - this.affectedUser = affectedUser; - } - - public String getAffectedUser() - { - return affectedUser; - } - - public void setCurrentUser( String currentUser ) - { - this.currentUser = currentUser; - } - - public String getCurrentUser() - { - return currentUser; - } - - public void log() - { - // TODO: it would be better to push this into the login interceptor so it is always set consistently - // (same for IP address) - if ( currentUser != null ) - { - MDC.put( "redback.currentUser", currentUser ); - } - - if ( affectedUser != null ) - { - if ( role != null ) - { - logger.info( action, affectedUser, role ); - } - else - { - logger.info( action, affectedUser ); - - } - } - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/CancellableAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/CancellableAction.java deleted file mode 100644 index e8c537a9d..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/CancellableAction.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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. - */ - -public interface CancellableAction -{ - public static final String CANCEL = "cancel"; - - /** - * Returns the cancel result. - * - * A basic implementation would simply be to return CANCEL. - * @return - */ - String cancel(); -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LoginAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LoginAction.java deleted file mode 100644 index ea6fade89..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LoginAction.java +++ /dev/null @@ -1,464 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.users.User; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.authentication.AuthenticationConstants; -import org.apache.archiva.redback.authentication.AuthenticationDataSource; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource; -import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource; -import org.apache.archiva.redback.configuration.UserConfiguration; -import org.apache.archiva.redback.keys.KeyManagerException; -import org.apache.archiva.redback.keys.KeyNotFoundException; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import java.util.Arrays; -import java.util.Date; - -/** - * LoginAction - * - * @author Jesse McConnell <jmcconnell@apache.org> - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-login" ) -@Scope( "prototype" ) -public class LoginAction - extends AbstractSecurityAction - implements CancellableAction -{ - private static final String LOGIN_SUCCESS = "security-login-success"; - - private static final String PASSWORD_CHANGE = "security-must-change-password"; - - private static final String ACCOUNT_LOCKED = "security-login-locked"; - - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - protected SecuritySystem securitySystem; - - private String username; - - private String password; - - private String validateMe; - - private String resetPassword; - - private boolean rememberMe; - - /** - * - */ - @Inject - private AutoLoginCookies autologinCookies; - - /** - * - */ - @Inject - private UserConfiguration config; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - return INPUT; - } - - /** - * 1) check if this is a validation authentication action - * 2) check if this is a reset password authentication action - * 3) sets up a password based authentication and passes on to webLogin() - * - * @return - */ - public String login() - { - if ( StringUtils.isNotEmpty( validateMe ) ) - { - // Process a login / validate request. - return validated(); - } - - if ( StringUtils.isNotEmpty( resetPassword ) ) - { - // Process a login / reset password request. - return resetPassword(); - } - - if ( StringUtils.isEmpty( username ) ) - { - addFieldError( "username", getText( "username.required" ) ); - return ERROR; - } - - PasswordBasedAuthenticationDataSource authdatasource = new PasswordBasedAuthenticationDataSource(); - authdatasource.setPrincipal( username ); - authdatasource.setPassword( password ); - - return webLogin( authdatasource, rememberMe ); - } - - /** - * 1) sets up a token based authentication - * 2) forces a password change requirement to the user - * 3) passes on to webLogin() - * - * @return - */ - public String resetPassword() - { - if ( StringUtils.isEmpty( resetPassword ) ) - { - addActionError( getText( "reset.password.missing" ) ); - return ERROR; - } - - try - { - AuthenticationKey authkey = securitySystem.getKeyManager().findKey( resetPassword ); - - User user = securitySystem.getUserManager().findUser( authkey.getForPrincipal() ); - - user.setPasswordChangeRequired( true ); - user.setEncodedPassword( "" ); - - TokenBasedAuthenticationDataSource authsource = new TokenBasedAuthenticationDataSource(); - authsource.setPrincipal( user.getPrincipal().toString() ); - authsource.setToken( authkey.getKey() ); - authsource.setEnforcePasswordChange( false ); - - securitySystem.getUserManager().updateUser( user ); - - AuditEvent event = new AuditEvent( getText( "log.password.change" ) ); - event.setAffectedUser( username ); - event.log(); - - return webLogin( authsource, false ); - } - catch ( KeyNotFoundException e ) - { - log.info( "Invalid key requested: {}", resetPassword ); - addActionError( getText( "cannot.find.key" ) ); - return ERROR; - } - catch ( KeyManagerException e ) - { - addActionError( getText( "cannot.find.key.at.the.moment" ) ); - log.warn( "Key Manager error: ", e ); - return ERROR; - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.find.user" ) ); - return ERROR; - } - } - - /** - * 1) sets up a token based authentication - * 2) forces a password change requirement to the user - * 3) passes on to webLogin() - * - * @return - */ - public String validated() - { - if ( StringUtils.isEmpty( validateMe ) ) - { - addActionError( getText( "validation.failure.key.missing" ) ); - return ERROR; - } - - try - { - AuthenticationKey authkey = securitySystem.getKeyManager().findKey( validateMe ); - - User user = securitySystem.getUserManager().findUser( authkey.getForPrincipal() ); - - user.setValidated( true ); - user.setLocked( false ); - user.setPasswordChangeRequired( true ); - user.setEncodedPassword( "" ); - - TokenBasedAuthenticationDataSource authsource = new TokenBasedAuthenticationDataSource(); - authsource.setPrincipal( user.getPrincipal().toString() ); - authsource.setToken( authkey.getKey() ); - authsource.setEnforcePasswordChange( false ); - - securitySystem.getUserManager().updateUser( user ); - String currentUser = getCurrentUser(); - - AuditEvent event = new AuditEvent( getText( "log.account.validation" ) ); - event.setAffectedUser( username ); - event.setCurrentUser( currentUser ); - event.log(); - - return webLogin( authsource, false ); - } - catch ( KeyNotFoundException e ) - { - log.info( "Invalid key requested: {}", validateMe ); - addActionError( getText( "cannot.find.key" ) ); - return ERROR; - } - catch ( KeyManagerException e ) - { - addActionError( getText( "cannot.find.key.at.the.momment" ) ); - return ERROR; - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.find.user" ) ); - return ERROR; - } - } - - public String cancel() - { - return CANCEL; - } - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } - - public String getPassword() - { - return password; - } - - public void setPassword( String password ) - { - this.password = password; - } - - public String getValidateMe() - { - return validateMe; - } - - public void setValidateMe( String validateMe ) - { - this.validateMe = validateMe; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.OPEN; - } - - public String getResetPassword() - { - return resetPassword; - } - - public void setResetPassword( String resetPassword ) - { - this.resetPassword = resetPassword; - } - - public boolean isRememberMe() - { - return rememberMe; - } - - public void setRememberMe( boolean rememberMe ) - { - this.rememberMe = rememberMe; - } - - - /** - * 1) attempts to authentication based on the passed in data source - * 2) if successful sets cookies and returns LOGIN_SUCCESS - * 3) if failure then check what kinda failure and return error - * - * @param authdatasource - * @param rememberMe - * @return - */ - private String webLogin( AuthenticationDataSource authdatasource, boolean rememberMe ) - { - // An attempt should log out your authentication tokens first! - setAuthTokens( null ); - - clearErrorsAndMessages(); - - // TODO: share this section with AutoLoginInterceptor - try - { - SecuritySession securitySession = securitySystem.authenticate( authdatasource ); - - if ( securitySession.isAuthenticated() ) - { - // Success! Create tokens. - setAuthTokens( securitySession ); - - if ( securitySystem.getPolicy().getUserValidationSettings().isEmailValidationRequired() ) - { - if ( !securitySession.getUser().getUsername().equals( - config.getString( "redback.default.admin" ) ) ) - { - if ( !securitySession.getUser().isValidated() ) - { - setAuthTokens( null ); - // NOTE: this text is the same as incorrect.username.password to avoid exposing actual account existence - addActionError( getText( "account.validation.required" ) ); - return ERROR; - } - } - } - - setCookies( authdatasource, rememberMe ); - - AuditEvent event = new AuditEvent( getText( "log.login.success" ) ); - event.setAffectedUser( username ); - event.log(); - - User user = securitySession.getUser(); - user.setLastLoginDate( new Date() ); - securitySystem.getUserManager().updateUser( user ); - - if ( StringUtils.isNotEmpty( validateMe ) ) - { - try - { - //REDBACK-146: delete key after validating so user won't be able to use it the second time around - securitySystem.getKeyManager().deleteKey( validateMe ); - } - catch ( KeyManagerException e ) - { - addActionError( getText( "cannot.find.key.at.the.momment" ) ); - return ERROR; - } - } - - return LOGIN_SUCCESS; - } - else - { - log.debug( "Login Action failed against principal : {}", - securitySession.getAuthenticationResult().getPrincipal(), - securitySession.getAuthenticationResult().getException() ); - - AuthenticationResult result = securitySession.getAuthenticationResult(); - if ( result.getExceptionsMap() != null && !result.getExceptionsMap().isEmpty() ) - { - if ( result.getExceptionsMap().get( AuthenticationConstants.AUTHN_NO_SUCH_USER ) != null ) - { - addActionError( getText( "incorrect.username.password" ) ); - } - else - { - addActionError( getText( "authentication.failed" ) ); - } - } - else - { - addActionError( getText( "authentication.failed" ) ); - } - - AuditEvent event = new AuditEvent( getText( "log.login.fail" ) ); - event.setAffectedUser( username ); - event.log(); - - return ERROR; - } - } - catch ( AuthenticationException ae ) - { - addActionError( getText( "authentication.exception", Arrays.asList( (Object) ae.getMessage() ) ) ); - return ERROR; - } - catch ( UserNotFoundException ue ) - { - addActionError( - getText( "user.not.found.exception", Arrays.asList( (Object) username, ue.getMessage() ) ) ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail" ) ); - event.setAffectedUser( username ); - event.log(); - return ERROR; - } - catch ( AccountLockedException e ) - { - addActionError( getText( "account.locked" ) ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail.locked" ) ); - event.setAffectedUser( username ); - event.log(); - return ACCOUNT_LOCKED; - } - catch ( MustChangePasswordException e ) - { - // TODO: preferably we would not set the cookies for this "partial" login state - setCookies( authdatasource, rememberMe ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail.locked" ) ); - event.setAffectedUser( username ); - event.log(); - return PASSWORD_CHANGE; - } - } - - private void setCookies( AuthenticationDataSource authdatasource, boolean rememberMe ) - { - if ( rememberMe ) - { - autologinCookies.setRememberMeCookie( authdatasource.getPrincipal(), ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } - autologinCookies.setSignonCookie( authdatasource.getPrincipal(), ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LogoutAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LogoutAction.java deleted file mode 100644 index 7abd00a18..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/LogoutAction.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.components.cache.Cache; -import org.apache.struts2.ServletActionContext; -import org.apache.struts2.dispatcher.SessionMap; -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 javax.inject.Inject; -import javax.inject.Named; - -/** - * LogoutAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-logout" ) -@Scope( "prototype" ) -public class LogoutAction - extends AbstractSecurityAction -{ - // Result Names. - private static final String LOGOUT = "security-logout"; - - /** - * cache used for user assignments - * - * role-hint="userAssignments" - */ - @Inject - @Named( value = "cache#userAssignments" ) - private Cache userAssignmentsCache; - - /** - * cache used for user permissions - * - * role-hint="userPermissions" - */ - @Inject - @Named( value = "cache#userPermissions" ) - private Cache userPermissionsCache; - - /** - * Cache used for users - * - * role-hint="users" - */ - @Inject - @Named( value = "cache#users" ) - private Cache usersCache; - - /** - * - */ - @Inject - private AutoLoginCookies autologinCookies; - - public String logout() - { - if ( getSecuritySession().getUser() == null ) - { - return LOGOUT; - } - - String currentUser = (String) getSecuritySession().getUser().getPrincipal(); - - if ( getSecuritySession() != null ) - { - // [PLXREDBACK-65] this is a bit of a hack around the cached managers since they don't have the ability to - // purge their caches through the API. Instead try and bring them in here and invalidate - // the keys directly. This will not be required once we move to a different model for pre-calculated - // permission sets since that will not have the overhead that required these caches in the first place. - Object principal = (String) getSecuritySession().getUser().getPrincipal(); - if ( userAssignmentsCache != null ) - { - userAssignmentsCache.remove( principal ); - } - if ( userPermissionsCache != null ) - { - userPermissionsCache.remove( principal ); - } - if ( usersCache != null ) - { - usersCache.remove( principal ); - } - } - - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - autologinCookies.removeSignonCookie( ServletActionContext.getResponse(), ServletActionContext.getRequest() ); - - setAuthTokens( null ); - - if ( session != null ) - { - ( (SessionMap) session ).invalidate(); - } - - AuditEvent event = new AuditEvent( getText( "log.logout.success" ) ); - event.setAffectedUser( currentUser ); - event.log(); - - return LOGOUT; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.OPEN; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordAction.java deleted file mode 100644 index 5ac26e713..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordAction.java +++ /dev/null @@ -1,294 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.PasswordEncoder; -import org.apache.archiva.redback.policy.PasswordRuleViolations; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.policy.PasswordRuleViolationException; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import java.util.Arrays; -import java.util.Map; - -/** - * PasswordAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-password" ) -@Scope( "prototype" ) -public class PasswordAction - extends AbstractSecurityAction - implements CancellableAction -{ - // ------------------------------------------------------------------ - // Plexus Component Requirements - // ------------------------------------------------------------------ - - protected static final String CHANGE_PASSWORD_SUCCESS = "security-change-password-success"; - - /** - * - */ - @Inject - protected SecuritySystem securitySystem; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String existingPassword; - - private String newPassword; - - private String newPasswordConfirm; - - private String targetUrl; - - private boolean provideExisting; - - public String show() - { - provideExisting = StringUtils.isNotEmpty( getSecuritySession().getUser().getEncodedPassword() ); - return INPUT; - } - - public String submit() - { - final SecuritySession securitySession = getSecuritySession(); - - provideExisting = StringUtils.isNotEmpty( securitySession.getUser().getEncodedPassword() ); - - if ( StringUtils.isEmpty( newPassword ) ) - { - addFieldError( "newPassword", getText( "newPassword.cannot.be.empty" ) ); - } - - if ( !StringUtils.equals( newPassword, newPasswordConfirm ) ) - { - addFieldError( "newPassword", getText( "password.confimation.failed" ) ); - } - - User user = securitySession.getUser(); - - // Test existing Password. - PasswordEncoder encoder = securitySystem.getPolicy().getPasswordEncoder(); - - if ( provideExisting ) - { - if ( !encoder.isPasswordValid( user.getEncodedPassword(), existingPassword ) ) - { - addFieldError( "existingPassword", getText( "password.provided.does.not.match.existing" ) ); - } - } - - // Validate the Password. - try - { - User tempUser = securitySystem.getUserManager().createUser( "temp", "temp", "temp" ); - tempUser.setPassword( newPassword ); - securitySystem.getPolicy().validatePassword( tempUser ); - } - catch ( PasswordRuleViolationException e ) - { - PasswordRuleViolations violations = e.getViolations(); - - if ( violations != null ) - { - for ( String violation : violations.getLocalizedViolations() ) - { - addFieldError( "newPassword", violation ); - } - } - } - - // Toss error (if any exists) - if ( hasActionErrors() || hasFieldErrors() || hasActionMessages() ) - { - newPassword = ""; - newPasswordConfirm = ""; - existingPassword = ""; - return ERROR; - } - - // We can save the new password. - try - { - String encodedPassword = encoder.encodePassword( newPassword ); - user.setEncodedPassword( encodedPassword ); - user.setPassword( newPassword ); - // TODO: (address this) check once more for password policy, some policies may require additional information - // only available in the actual user object, perhaps the thing to do is add a deep cloning mechanism - // to user so we can validate this with a test user. Its ok to just set and test it here before - // setting the updateUser, but logically its better to maintain a clear separation here - securitySystem.getPolicy().validatePassword( user ); - securitySystem.getUserManager().updateUser( user ); - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.update.user.not.found", Arrays.asList( (Object) user.getUsername() ) ) ); - addActionError( getText( "admin.deleted.account" ) ); - - return ERROR; - } - catch ( PasswordRuleViolationException e ) - { - PasswordRuleViolations violations = e.getViolations(); - - if ( violations != null ) - { - for ( String violation : violations.getLocalizedViolations() ) - { - addFieldError( "newPassword", violation ); - } - } - // [REDBACK-30] when the password is one of the previous 6, it throws exception here, but since the user - // object is in the session we need to clear out the encodedPassword otherwise the flow will change and think - // it needs to have existingPassword which isn't set on some reset password checks - if ( !provideExisting ) - { - user.setEncodedPassword( "" ); - user.setPassword( "" ); - } - - return ERROR; - } - - log.info( "Password Change Request Success." ); - String currentUser = getCurrentUser(); - AuditEvent event = new AuditEvent( getText( "log.password.change" ) ); - event.setAffectedUser( user.getUsername() ); - event.setCurrentUser( currentUser ); - event.log(); - - if ( !securitySession.isAuthenticated() ) - { - log.debug( "User is not authenticated." ); - return REQUIRES_AUTHENTICATION; - } - - /* - * If provide existing is true, then this was a normal password change flow, if it is - * false then it is changing the password from the registration flow in which case direct to - * external link - */ - if ( !provideExisting ) - { - return CHANGE_PASSWORD_SUCCESS; - } - else - { - - if ( super.session != null ) - { - - Map<String, Object> map = (Map<String, Object>) super.session; - String url = ""; - if ( map.containsKey( "targetUrl" ) ) - { - url = map.remove( "targetUrl" ).toString(); - log.info( "targetUrl is retrieved and removed from the session: {}", url ); - } - else - { - log.info( "targetUrl is empty, redirect to change password success page" ); - return CHANGE_PASSWORD_SUCCESS; - } - setTargetUrl( url ); - } - return SUCCESS; - } - } - - public String cancel() - { - return CANCEL; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getExistingPassword() - { - return existingPassword; - } - - public void setExistingPassword( String existingPassword ) - { - this.existingPassword = existingPassword; - } - - public String getNewPassword() - { - return newPassword; - } - - public void setNewPassword( String newPassword ) - { - this.newPassword = newPassword; - } - - public String getNewPasswordConfirm() - { - return newPasswordConfirm; - } - - public void setNewPasswordConfirm( String newPasswordConfirm ) - { - this.newPasswordConfirm = newPasswordConfirm; - } - - public boolean isProvideExisting() - { - return provideExisting; - } - - public void setProvideExisting( boolean provideExisting ) - { - // Do nothing. - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.AUTHONLY; - } - - public String getTargetUrl() - { - return targetUrl; - } - - public void setTargetUrl( String targetUrl ) - { - this.targetUrl = targetUrl; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordResetAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordResetAction.java deleted file mode 100644 index b6cdb4dbf..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/PasswordResetAction.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.KeyManager; -import org.apache.archiva.redback.policy.UserSecurityPolicy; -import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.keys.AuthenticationKey; -import org.apache.archiva.redback.keys.KeyManagerException; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.users.User; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import java.util.Arrays; - -/** - * PasswordResetAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-password-reset" ) -@Scope( "prototype" ) -public class PasswordResetAction - extends AbstractSecurityAction - implements CancellableAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - private Mailer mailer; - - /** - * - */ - @Inject - private SecuritySystem securitySystem; - - private String username; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - return INPUT; - } - - public String reset() - { - if ( StringUtils.isEmpty( username ) ) - { - addFieldError( "username", getText( "username.cannot.be.empty" ) ); - return INPUT; - } - - UserManager userManager = securitySystem.getUserManager(); - KeyManager keyManager = securitySystem.getKeyManager(); - UserSecurityPolicy policy = securitySystem.getPolicy(); - - try - { - User user = userManager.findUser( username ); - - AuthenticationKey authkey = keyManager.createKey( username, "Password Reset Request", - policy.getUserValidationSettings().getEmailValidationTimeout() ); - - mailer.sendPasswordResetEmail( Arrays.asList( user.getEmail() ), authkey, getBaseUrl() ); - - AuditEvent event = new AuditEvent( getText( "log.password.reset.request" ) ); - event.setAffectedUser( username ); - event.log(); - - addActionMessage( getText( "password.reset.success" ) ); - } - catch ( UserNotFoundException e ) - { - // By default, the success and failure messages are the same. - // This is done to prevent a malicious user from attempting to ascertain the - // validity of usernames. - addActionMessage( getText( "password.reset.failure" ) ); - - log.info( "Password Reset on non-existant user [{}].", username ); - } - catch ( KeyManagerException e ) - { - addActionError( getText( "password.reset.email.generation.failure" ) ); - log.info( "Unable to issue password reset.", e ); - } - - return INPUT; - } - - // ------------------------------------------------------------------ - // Security Specification - // ------------------------------------------------------------------ - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.OPEN; - } - - public String cancel() - { - return NONE; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RedbackActionSupport.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RedbackActionSupport.java deleted file mode 100644 index 1c5ee290c..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RedbackActionSupport.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.Map; - -import org.apache.struts2.interceptor.SessionAware; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * - * @author <a href="mailto:james@atlassian.com">James William Dumay</a> - */ -public abstract class RedbackActionSupport - extends ActionSupport - implements SessionAware -{ - protected Logger log = LoggerFactory.getLogger( this.getClass() ); - - protected Map<String,Object> session; - - public void setSession( Map<String, Object > map ) - { - //noinspection AssignmentToCollectionOrArrayFieldFromParameter - this.session = map; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RegisterAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RegisterAction.java deleted file mode 100644 index e35e02a27..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/RegisterAction.java +++ /dev/null @@ -1,266 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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.archiva.redback.policy.UserSecurityPolicy; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.RoleManagerException; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.keys.KeyManagerException; -import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.users.UserNotFoundException; -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 javax.inject.Inject; -import java.util.Arrays; - -/** - * RegisterAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-register" ) -@Scope( "prototype" ) -public class RegisterAction - extends AbstractUserCredentialsAction - implements CancellableAction -{ - protected static final String REGISTER_SUCCESS = "security-register-success"; - - private static final String VALIDATION_NOTE = "validation-note"; - - private static final String RESEND_VALIDATION_EMAIL = "security-resend-validation-email"; - - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - private Mailer mailer; - - /** - * - */ - @Inject - private RoleManager roleManager; - - private CreateUserCredentials user; - - private boolean emailValidationRequired; - - private String username; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - if ( user == null ) - { - user = new CreateUserCredentials(); - } - - emailValidationRequired = securitySystem.getPolicy().getUserValidationSettings().isEmailValidationRequired(); - - return INPUT; - } - - public String register() - { - if ( user == null ) - { - user = new CreateUserCredentials(); - addActionError( getText( "invalid.user.credentials" ) ); - return ERROR; - } - - UserSecurityPolicy securityPolicy = securitySystem.getPolicy(); - - emailValidationRequired = securityPolicy.getUserValidationSettings().isEmailValidationRequired(); - - internalUser = user; - - if ( securityPolicy.getUserValidationSettings().isEmailValidationRequired() ) - { - validateCredentialsLoose(); - } - else - { - validateCredentialsStrict(); - } - - // NOTE: Do not perform Password Rules Validation Here. - UserManager manager = super.securitySystem.getUserManager(); - - if ( manager.userExists( user.getUsername() ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.already.exists", Arrays.asList( (Object) user.getUsername() ) ) ); - } - - if ( hasActionErrors() || hasFieldErrors() ) - { - return ERROR; - } - - User u = manager.createUser( user.getUsername(), user.getFullName(), user.getEmail() ); - u.setPassword( user.getPassword() ); - u.setValidated( false ); - u.setLocked( false ); - - try - { - roleManager.assignRole( RedbackRoleConstants.REGISTERED_USER_ROLE_ID, u.getPrincipal().toString() ); - } - catch ( RoleManagerException rpe ) - { - addActionError( getText( "assign.role.failure" ) ); - log.error( "RoleProfile Error: " + rpe.getMessage(), rpe ); - return ERROR; - } - - if ( securityPolicy.getUserValidationSettings().isEmailValidationRequired() ) - { - u.setLocked( true ); - - try - { - AuthenticationKey authkey = - securitySystem.getKeyManager().createKey( u.getPrincipal().toString(), "New User Email Validation", - securityPolicy.getUserValidationSettings().getEmailValidationTimeout() ); - - mailer.sendAccountValidationEmail( Arrays.asList( u.getEmail() ), authkey, getBaseUrl() ); - - securityPolicy.setEnabled( false ); - manager.addUser( u ); - - return VALIDATION_NOTE; - } - catch ( KeyManagerException e ) - { - addActionError( getText( "cannot.register.user" ) ); - log.error( "Unable to register a new user.", e ); - return ERROR; - } - finally - { - securityPolicy.setEnabled( true ); - } - } - else - { - manager.addUser( u ); - } - - AuditEvent event = new AuditEvent( getText( "log.account.create" ) ); - event.setAffectedUser( username ); - event.log(); - - return REGISTER_SUCCESS; - } - - public String resendRegistrationEmail() - { - UserSecurityPolicy securityPolicy = securitySystem.getPolicy(); - - try - { - User user = super.securitySystem.getUserManager().findUser( username ); - - AuthenticationKey authkey = - securitySystem.getKeyManager().createKey( user.getPrincipal().toString(), "New User Email Validation", - securityPolicy.getUserValidationSettings().getEmailValidationTimeout() ); - - mailer.sendAccountValidationEmail( Arrays.asList( user.getEmail() ), authkey, getBaseUrl() ); - - return RESEND_VALIDATION_EMAIL; - } - catch ( KeyManagerException e ) - { - addActionError( getText( "cannot.register.user" ) ); - log.error( "Unable to register a new user.", e ); - return ERROR; - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.find.user" ) ); - log.error( "Unable to find user.", e ); - return ERROR; - } - } - - public String cancel() - { - return CANCEL; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public CreateUserCredentials getUser() - { - return user; - } - - public void setUser( CreateUserCredentials user ) - { - this.user = user; - } - - public boolean isEmailValidationRequired() - { - return emailValidationRequired; - } - - public void setEmailValidationRequired( boolean emailValidationRequired ) - { - this.emailValidationRequired = emailValidationRequired; - } - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.OPEN; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/SecurityRedirectAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/SecurityRedirectAction.java deleted file mode 100644 index f21e0d2d2..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/SecurityRedirectAction.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.codehaus.plexus.util.StringUtils; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -/** - * SecurityRedirectAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-redirect" ) -@Scope( "prototype" ) -public class SecurityRedirectAction - extends RedbackActionSupport -{ - private String externalResult; - - public String redirect() - { - if ( StringUtils.isNotEmpty( externalResult ) ) - { - return externalResult; - } - - return SUCCESS; - } - - public String getExternalResult() - { - return externalResult; - } - - public void setExternalResult( String name ) - { - this.externalResult = name; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AbstractAdminUserCredentialsAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AbstractAdminUserCredentialsAction.java deleted file mode 100644 index 5903a3e5b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AbstractAdminUserCredentialsAction.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.struts2.action.AbstractUserCredentialsAction; - -/** - * AbstractAdminUserCredentialsAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -public abstract class AbstractAdminUserCredentialsAction - extends AbstractUserCredentialsAction -{ - private String username; - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AddAdminUserAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AddAdminUserAction.java deleted file mode 100644 index 9173a1c16..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AddAdminUserAction.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.configuration.UserConfiguration; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.RoleManagerException; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.users.UserManager; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.authentication.AuthenticationConstants; -import org.apache.archiva.redback.authentication.AuthenticationDataSource; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserNotFoundException; -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 javax.inject.Inject; -import java.util.Arrays; -import java.util.Date; - -/** - * AddAdminUserAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-admin-account" ) -@Scope( "prototype" ) -public class AddAdminUserAction - extends AbstractAdminUserCredentialsAction -{ - private static final String LOGIN_ERROR = "login-error"; - - private static final String LOGIN_SUCCESS = "security-login-success"; - - private static final String PASSWORD_CHANGE = "security-must-change-password"; - - private static final String ACCOUNT_LOCKED = "security-login-locked"; - - @Inject - private RoleManager roleManager; - - - @Inject - private UserConfiguration config; - - private EditUserCredentials user; - - @Inject - private AutoLoginCookies autologinCookies; - - public String show() - { - if ( user == null ) - { - user = new EditUserCredentials( config.getString( "redback.default.admin" ) ); - } - - return INPUT; - } - - /** - * TODO this must done in a service !! - * @return - */ - public String submit() - { - if ( user == null ) - { - user = new EditUserCredentials( config.getString( "redback.default.admin" ) ); - addActionError( getText( "invalid.admin.credentials" ) ); - return ERROR; - } - - log.info( "user = {}", user ); - - internalUser = user; - - validateCredentialsStrict(); - - UserManager userManager = super.securitySystem.getUserManager(); - - if ( userManager.userExists( config.getString( "redback.default.admin" ) ) ) - { - // Means that the role name exist already. - // We need to fail fast and return to the previous page. - addActionError( getText( "admin.user.already.exists" ) ); - return ERROR; - } - - if ( hasActionErrors() || hasFieldErrors() ) - { - return ERROR; - } - - User u = - userManager.createUser( config.getString( "redback.default.admin" ), user.getFullName(), user.getEmail() ); - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - u.setPassword( user.getPassword() ); - u.setLocked( false ); - u.setPasswordChangeRequired( false ); - u.setPermanent( true ); - - userManager.addUser( u ); - - AuditEvent event = new AuditEvent( getText( "log.account.create" ) ); - event.setAffectedUser( u.getUsername() ); - event.log(); - - try - { - roleManager.assignRole( "system-administrator", u.getPrincipal().toString() ); - event = new AuditEvent( getText( "log.assign.role" ) ); - event.setAffectedUser( u.getUsername() ); - event.setRole( "system-administrator" ); - event.log(); - } - catch ( RoleManagerException rpe ) - { - addActionError( getText( "cannot.assign.admin.role" ) ); - return ERROR; - } - - PasswordBasedAuthenticationDataSource authdatasource = new PasswordBasedAuthenticationDataSource(); - authdatasource.setPrincipal( user.getUsername() ); - authdatasource.setPassword( user.getPassword() ); - - return webLogin( authdatasource ); - } - - public EditUserCredentials getUser() - { - return user; - } - - public void setUser( EditUserCredentials user ) - { - this.user = user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - return SecureActionBundle.OPEN; - } - - /** - * 1) attempts to authentication based on the passed in data source - * 2) if successful sets cookies and returns LOGIN_SUCCESS - * 3) if failure then check what kinda failure and return error - * - * @param authdatasource - * @return - */ - private String webLogin( AuthenticationDataSource authdatasource ) - { - // An attempt should log out your authentication tokens first! - setAuthTokens( null ); - - clearErrorsAndMessages(); - - String principal = authdatasource.getPrincipal(); - - try - { - SecuritySession securitySession = securitySystem.authenticate( authdatasource ); - - if ( securitySession.getAuthenticationResult().isAuthenticated() ) - { - // Success! Create tokens. - setAuthTokens( securitySession ); - - setCookies( authdatasource ); - - AuditEvent event = new AuditEvent( getText( "log.login.success" ) ); - event.setAffectedUser( principal ); - event.log(); - - User u = securitySession.getUser(); - u.setLastLoginDate( new Date() ); - securitySystem.getUserManager().updateUser( u ); - - return LOGIN_SUCCESS; - } - else - { - log.debug( "Login Action failed against principal : {}", - securitySession.getAuthenticationResult().getPrincipal(), - securitySession.getAuthenticationResult().getException() ); - - AuthenticationResult result = securitySession.getAuthenticationResult(); - if ( result.getExceptionsMap() != null && !result.getExceptionsMap().isEmpty() ) - { - if ( result.getExceptionsMap().get( AuthenticationConstants.AUTHN_NO_SUCH_USER ) != null ) - { - addActionError( getText( "incorrect.username.password" ) ); - } - else - { - addActionError( getText( "authentication.failed" ) ); - } - } - else - { - addActionError( getText( "authentication.failed" ) ); - } - - AuditEvent event = new AuditEvent( getText( "log.login.fail" ) ); - event.setAffectedUser( principal ); - event.log(); - - return LOGIN_ERROR; - } - } - catch ( AuthenticationException ae ) - { - addActionError( getText( "authentication.exception", Arrays.asList( (Object) ae.getMessage() ) ) ); - return LOGIN_ERROR; - } - catch ( UserNotFoundException ue ) - { - addActionError( - getText( "user.not.found.exception", Arrays.asList( (Object) principal, ue.getMessage() ) ) ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail" ) ); - event.setAffectedUser( principal ); - event.log(); - return LOGIN_ERROR; - } - catch ( AccountLockedException e ) - { - addActionError( getText( "account.locked" ) ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail.locked" ) ); - event.setAffectedUser( principal ); - event.log(); - return ACCOUNT_LOCKED; - } - catch ( MustChangePasswordException e ) - { - // TODO: preferably we would not set the cookies for this "partial" login state - setCookies( authdatasource ); - - AuditEvent event = new AuditEvent( getText( "log.login.fail.locked" ) ); - event.setAffectedUser( principal ); - event.log(); - return PASSWORD_CHANGE; - } - } - - private void setCookies( AuthenticationDataSource authdatasource ) - { - autologinCookies.setSignonCookie( authdatasource.getPrincipal(), ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AdminConsoleAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AdminConsoleAction.java deleted file mode 100644 index f8242a7c3..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AdminConsoleAction.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Resource; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -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; - -/** - * AdminConsoleAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller("redback-admin-console") -@Scope("prototype") -public class AdminConsoleAction - extends AbstractSecurityAction -{ - public String show() - { - return INPUT; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.CONFIGURATION_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsAction.java deleted file mode 100644 index 74b7eff84..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsAction.java +++ /dev/null @@ -1,467 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.rbac.UserAssignment; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.model.ModelApplication; -import org.apache.archiva.redback.struts2.action.AbstractUserCredentialsAction; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.struts2.model.ApplicationRoleDetails; -import org.apache.archiva.redback.struts2.model.ApplicationRoleDetails.RoleTableCell; -import org.apache.archiva.redback.users.UserManager; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * AssignmentsAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller("redback-assignments") -@Scope("prototype") -public class AssignmentsAction - extends AbstractUserCredentialsAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * role-hint="default" - */ - @Inject - private RoleManager rmanager; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String principal; - - private AdminEditUserCredentials user; - - /** - * A List of {@link Role} objects. - */ - private List<Role> assignedRoles; - - /** - * A List of {@link Role} objects. - */ - private List<Role> availableRoles; - - private List<Role> effectivelyAssignedRoles; - - /** - * List of names (received from client) of dynamic roles to set/unset - */ - private List<String> addDSelectedRoles; - - /** - * List of names (received from client) of nondynamic roles to set/unset - */ - private List<String> addNDSelectedRoles; - - private List<Role> nondynamicroles; - - private List<Role> dynamicroles; - - private List<String> NDRoles; - - private List<String> DRoles; - - private List<ApplicationRoleDetails> applicationRoleDetails = new ArrayList<ApplicationRoleDetails>(); - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public List<ApplicationRoleDetails> getApplicationRoleDetails() - { - return applicationRoleDetails; - } - - /** - * Display the edit user panel. <p/> This should consist of the Role details for the specified user. <p/> A table of - * currently assigned roles. This table should have a column to remove the role from the user. This table should - * also have a column of checkboxes that can be selected and then removed from the user. <p/> A table of roles that - * can be assigned. This table should have a set of checkboxes that can be selected and then added to the user. <p/> - * Duplicate role assignment needs to be taken care of. - * - * @throws RbacManagerException - * @throws org.apache.archiva.redback.rbac.RbacObjectNotFoundException - */ - @SuppressWarnings( "unchecked" ) - public String show() - throws RbacManagerException - { - this.addNDSelectedRoles = new ArrayList<String>(); - this.addDSelectedRoles = new ArrayList<String>(); - - if ( StringUtils.isEmpty( principal ) ) - { - addActionError( getText( "rbac.edit.user.empty.principal" ) ); - return ERROR; - } - - UserManager userManager = super.securitySystem.getUserManager(); - - if ( !userManager.userExists( principal ) ) - { - addActionError( getText( "user.does.not.exist", new String[]{principal} ) ); - return ERROR; - } - - try - { - User u = userManager.findUser( principal ); - - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - user = new AdminEditUserCredentials( u ); - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "user.not.found.exception", Arrays.asList( ( Object ) principal, e.getMessage() ) ) ); - return ERROR; - } - - // check first if role assignments for user exist - if ( !getManager().userAssignmentExists( principal ) ) - { - UserAssignment assignment = getManager().createUserAssignment( principal ); - getManager().saveUserAssignment( assignment ); - } - - List<Role> assignableRoles = getFilteredRolesForCurrentUserAccess(); - List<ApplicationRoleDetails> appRoleDetails = lookupAppRoleDetails( principal, assignableRoles ); - applicationRoleDetails.addAll( appRoleDetails ); - - return SUCCESS; - } - - @SuppressWarnings( "unchecked" ) - private List<ApplicationRoleDetails> lookupAppRoleDetails( String principal, List<Role> assignableRoles ) - throws RbacManagerException - { - List<ApplicationRoleDetails> appRoleDetails = new ArrayList<ApplicationRoleDetails>(); - for ( Iterator<ModelApplication> i = rmanager.getModel().getApplications().iterator(); i.hasNext(); ) - { - ModelApplication application = i.next(); - ApplicationRoleDetails details = - new ApplicationRoleDetails( application, getManager().getEffectivelyAssignedRoles( principal ), - getManager().getAssignedRoles( principal ), assignableRoles ); - appRoleDetails.add( details ); - } - return appRoleDetails; - } - - /** - * Applies role additions and removals and then displays the edit user panel. - * - * @return - */ - public String edituser() - { - try - { - Collection<Role> assignedRoles = getManager().getAssignedRoles( principal ); - List<Role> assignableRoles = getFilteredRolesForCurrentUserAccess(); - - // Compute set of roles usable by configured apps, add/del from this set only - List<ApplicationRoleDetails> appRoleDetails = lookupAppRoleDetails( principal, assignableRoles ); - applicationRoleDetails.addAll( appRoleDetails ); - - Set<String> availableAppRoleNames = new HashSet<String>(); - for ( ApplicationRoleDetails appRoleDetail : applicationRoleDetails ) - { - availableAppRoleNames.addAll( appRoleDetail.getAssignedRoles() ); - availableAppRoleNames.addAll( appRoleDetail.getAvailableRoles() ); - - // Add dynamic roles offered on page - for ( List<RoleTableCell> row : appRoleDetail.getTable() ) - { - for ( RoleTableCell col : row ) - { - if ( !col.isLabel() ) - { - availableAppRoleNames.add( col.getName() ); - } - } - } - } - - Set<Role> availableRoles = new HashSet<Role>( assignedRoles ); - availableRoles.addAll( assignableRoles ); - - // Filter the available roles so we only consider configured app roles - Iterator<Role> availableRoleIterator = availableRoles.iterator(); - while ( availableRoleIterator.hasNext() ) - { - Role availableRole = availableRoleIterator.next(); - if ( !availableAppRoleNames.contains( availableRole.getName() ) ) - { - availableRoleIterator.remove(); - } - } - - List<String> selectedRoleNames = new ArrayList<String>(); - addSelectedRoles( availableRoles, selectedRoleNames, addNDSelectedRoles ); - addSelectedRoles( availableRoles, selectedRoleNames, addDSelectedRoles ); - - List<String> newRoles = new ArrayList<String>( selectedRoleNames ); - String currentUser = getCurrentUser(); - for ( Role assignedRole : assignedRoles ) - { - if ( !selectedRoleNames.contains( assignedRole.getName() ) ) - { - // removing a currently assigned role, check if we have permission - if ( !availableRoles.contains( assignedRole ) - || !checkRoleName( assignableRoles, assignedRole.getName() ) ) - { - // it may have not been on the page. Leave it assigned. - selectedRoleNames.add( assignedRole.getName() ); - } - else - { - String role = assignedRole.getName(); - AuditEvent event = new AuditEvent( getText( "log.revoke.role" ) ); - event.setAffectedUser( principal ); - event.setRole( role ); - event.setCurrentUser( currentUser ); - event.log(); - } - } - else - { - newRoles.remove( assignedRole.getName() ); - } - } - for ( String r : newRoles ) - { - AuditEvent event = new AuditEvent( getText( "log.assign.role" ) ); - event.setAffectedUser( principal ); - event.setRole( r ); - event.setCurrentUser( currentUser ); - event.log(); - } - - UserAssignment assignment; - - if ( getManager().userAssignmentExists( principal ) ) - { - assignment = getManager().getUserAssignment( principal ); - } - else - { - assignment = getManager().createUserAssignment( principal ); - } - - assignment.setRoleNames( selectedRoleNames ); - - assignment = getManager().saveUserAssignment( assignment ); - } - catch ( RbacManagerException ne ) - { - addActionError( getText( "error.removing.selected.roles", Arrays.asList( ( Object ) ne.getMessage() ) ) ); - return ERROR; - } - return SUCCESS; - } - - private void addSelectedRoles( Collection<Role> assignableRoles, List<String> roles, List<String> selectedRoles ) - { - if ( selectedRoles != null ) - { - for ( String r : selectedRoles ) - { - if ( checkRoleName( assignableRoles, r ) ) - { - roles.add( r ); - } - } - } - } - - private boolean checkRoleName( Collection<Role> assignableRoles, String r ) - { - for ( Role role : assignableRoles ) - { - if ( role.getName().equals( r ) ) - { - return true; - } - } - return false; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public List<Role> getAssignedRoles() - { - return assignedRoles; - } - - public void setAssignedRoles( List<Role> assignedRoles ) - { - this.assignedRoles = assignedRoles; - } - - public List<Role> getAvailableRoles() - { - return availableRoles; - } - - public void setAvailableRoles( List<Role> availableRoles ) - { - this.availableRoles = availableRoles; - } - - public List<Role> getEffectivelyAssignedRoles() - { - return effectivelyAssignedRoles; - } - - public void setEffectivelyAssignedRoles( List<Role> effectivelyAssignedRoles ) - { - this.effectivelyAssignedRoles = effectivelyAssignedRoles; - } - - public String getPrincipal() - { - return principal; - } - - public void setPrincipal( String principal ) - { - this.principal = principal; - } - - public void setUsername( String username ) - { - this.principal = username; - } - - public AdminEditUserCredentials getUser() - { - return user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION, Resource.GLOBAL ); - - return bundle; - } - - public List<Role> getNondynamicroles() - { - return nondynamicroles; - } - - public void setNondynamicroles( List<Role> nondynamicroles ) - { - this.nondynamicroles = nondynamicroles; - } - - public List<Role> getDynamicroles() - { - return dynamicroles; - } - - public void setDynamicroles( List<Role> dynamicroles ) - { - this.dynamicroles = dynamicroles; - } - - public List<String> getNDRoles() - { - return NDRoles; - } - - public void setNDRoles( List<String> roles ) - { - NDRoles = roles; - } - - public List<String> getDRoles() - { - return DRoles; - } - - public void setDRoles( List<String> roles ) - { - DRoles = roles; - } - - public List<String> getAddDSelectedRoles() - { - return addDSelectedRoles; - } - - public void setAddDSelectedRoles( List<String> addDSelectedRoles ) - { - this.addDSelectedRoles = addDSelectedRoles; - } - - public List<String> getAddNDSelectedRoles() - { - return addNDSelectedRoles; - } - - public void setAddNDSelectedRoles( List<String> addNDSelectedRoles ) - { - this.addNDSelectedRoles = addNDSelectedRoles; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRecord.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRecord.java deleted file mode 100644 index ae473935e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRecord.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.File; -import java.util.Date; - -/** - * A record of a backup directory for displaying the backup/restore page. - */ -public class BackupRecord - implements Comparable<BackupRecord> -{ - private final File directory; - - private final Date date; - - private final boolean userDatabase; - - public BackupRecord( File directory ) - { - this.directory = directory; - - this.date = new Date( directory.lastModified() ); - - this.userDatabase = new File( directory, "users.xml" ).exists(); - } - - public File getDirectory() - { - return directory; - } - - public Date getDate() - { - return date; - } - - public boolean isUserDatabase() - { - return userDatabase; - } - - public boolean isValidBackup() - { - return userDatabase; - } - - public int compareTo( BackupRecord record ) - { - return record.date.compareTo( this.date ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRestoreAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRestoreAction.java deleted file mode 100644 index 99f7ff9f1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/BackupRestoreAction.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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 com.opensymphony.xwork2.Preparable; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -import org.apache.commons.lang.StringUtils; -import org.apache.archiva.redback.keys.KeyManager; -import org.apache.archiva.redback.management.DataManagementTool; -import org.apache.archiva.redback.users.UserManager; -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 javax.inject.Inject; -import javax.inject.Named; -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Locale; - - -/** - * BackupRestoreAction - */ -@Controller( "backup-restore" ) -@Scope( "prototype" ) -public class BackupRestoreAction - extends AbstractSecurityAction - implements SecureAction, Preparable -{ - public final static String CUSTOM_ERROR = "custom_error"; - - /** - * - */ - private File applicationHome = new File( "data" ); - - /** - * role-hint="jdo" - */ - @Inject - private DataManagementTool dataManagementTool; - - /** - * role-hint="jdo" - */ - @Inject - @Named( value = "rBACManager#jdo" ) - private RBACManager rbacManager; - - /** - * role-hint="jdo" - */ - @Inject - @Named( value = "userManager#jdo" ) - private UserManager userManager; - - /** - * role-hint="jdo" - */ - @Inject - @Named( value = "keyManager#jdo" ) - private KeyManager keyManager; - - private File backupDirectory; - - private String restoreDirectory; - - private List<BackupRecord> previousBackups; - - private boolean confirmed; - - public static final String BACKUP_DIRECTORY = "user-backup-directory"; - - public String view() - throws Exception - { - - retrievePreviousBackups(); - - return SUCCESS; - } - - public String backup() - throws Exception - { - - File backupDirectory = getTimestampedBackupDirectory(); - backupDirectory.mkdirs(); - - log.info( "Backing up security database to {}", backupDirectory ); - this.backupDatabase( backupDirectory ); - - log.info( "Done backing up security database" ); - - return SUCCESS; - } - - public String restore() - throws Exception - { - if ( StringUtils.isEmpty( restoreDirectory ) ) - { - addActionError( getText( "backupRestore.backup.empty.error" ) ); - return CUSTOM_ERROR; - } - - File restoreDirectory = new File( this.restoreDirectory ); - - boolean fileExists = restoreDirectory.exists() && restoreDirectory.isDirectory(); - boolean isValidBackup = false; - - if ( fileExists ) - { - BackupRecord record = new BackupRecord( restoreDirectory ); - isValidBackup = record.isValidBackup(); - } - - if ( !fileExists ) - { - log.warn( "Backup: " + this.restoreDirectory + " not found." ); - addActionError( getText( "backupRestore.backup.error" ) ); - retrievePreviousBackups(); - return CUSTOM_ERROR; - } - else if ( !isValidBackup ) - { - log.warn( "Backup: " + this.restoreDirectory + " is not a valid backup directory." ); - addActionError( getText( "backupRestore.backup.error" ) ); - retrievePreviousBackups(); - return CUSTOM_ERROR; - } - - log.info( "Restoring security database from {}", this.restoreDirectory ); - this.eraseDatabase(); - this.restoreDatabase( restoreDirectory ); - log.info( "Done restoring security database" ); - - return SUCCESS; - } - - - private void backupDatabase( File backupDirectory ) - throws Exception - { - - dataManagementTool.backupKeyDatabase( keyManager, backupDirectory ); - dataManagementTool.backupRBACDatabase( rbacManager, backupDirectory ); - dataManagementTool.backupUserDatabase( userManager, backupDirectory ); - } - - private void eraseDatabase() - { - dataManagementTool.eraseKeysDatabase( keyManager ); - dataManagementTool.eraseRBACDatabase( rbacManager ); - dataManagementTool.eraseUsersDatabase( userManager ); - } - - private void restoreDatabase( File backupDirectory ) - throws Exception - { - - dataManagementTool.restoreKeysDatabase( keyManager, backupDirectory ); - dataManagementTool.restoreRBACDatabase( rbacManager, backupDirectory ); - dataManagementTool.restoreUsersDatabase( userManager, backupDirectory ); - } - - public String getRestoreDirectory() - { - return restoreDirectory; - } - - public void setRestoreDirectory( String restoreDirectory ) - { - this.restoreDirectory = restoreDirectory; - } - - private File getTimestampedBackupDirectory() - { - SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyyMMdd.HHmmss", Locale.US ); - return new File( this.backupDirectory, dateFormat.format( new Date() ) ); - } - - public File getBackupDirectory() - { - return backupDirectory; - } - - public List<BackupRecord> getPreviousBackups() - { - return previousBackups; - } - - public void prepare() - { - backupDirectory = this.getFile( BACKUP_DIRECTORY ); - retrievePreviousBackups(); - } - - private void retrievePreviousBackups() - { - previousBackups = new ArrayList<BackupRecord>(); - File[] files = backupDirectory.listFiles(); - if ( files != null ) - { - for ( int i = 0; i < files.length; i++ ) - { - File f = files[i]; - - if ( f.isDirectory() && !f.getName().startsWith( "." ) ) - { - BackupRecord record = new BackupRecord( f ); - - if ( record.isValidBackup() ) - { - previousBackups.add( record ); - } - } - } - } - Collections.sort( previousBackups ); - } - - public boolean isConfirmed() - { - return confirmed; - } - - public void setConfirmed( boolean confirmed ) - { - this.confirmed = confirmed; - } - - @Override - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_MANAGE_DATA, Resource.GLOBAL ); - return bundle; - } - - public File getFile( String filename ) - { - if ( filename == null ) - { - return null; - } - - File f = null; - - if ( filename != null && filename.length() != 0 ) - { - f = new File( filename ); - - if ( !f.isAbsolute() ) - { - f = new File( applicationHome, filename ); - } - } - - try - { - return f.getCanonicalFile(); - } - catch ( IOException e ) - { - return f; - } - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/EditRoleAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/EditRoleAction.java deleted file mode 100644 index 77a6924e3..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/EditRoleAction.java +++ /dev/null @@ -1,544 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.RbacManagerException; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.rbac.UserAssignment; -import org.apache.archiva.redback.users.User; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.archiva.redback.struts2.action.AbstractUserCredentialsAction; -import org.apache.archiva.redback.struts2.action.AuditEvent; -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.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 java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * EditRoleAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-role-edit" ) -@Scope( "prototype" ) -public class EditRoleAction - extends AbstractUserCredentialsAction -{ - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String name; - - private String description; - - private String newDescription; - - private List<String> childRoleNames = new ArrayList<String>(); - - private List<String> parentRoleNames = new ArrayList<String>(); - - private List<Permission> permissions = new ArrayList<Permission>(); - - private List<User> users = new ArrayList<User>(); - - private List<User> parentUsers = new ArrayList<User>(); - - private List<User> allUsers = new ArrayList<User>(); - - private List<String> usersList = new ArrayList<String>(); - - private List<String> availableUsers = new ArrayList<String>(); - - private List<String> currentUsers = new ArrayList<String>(); - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String input() - { - if ( name == null ) - { - addActionError( getText( "cannot.edit.null.role" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( name ) ) - { - addActionError( getText( "cannot.edit.empty.role" ) ); - return ERROR; - } - - name = StringEscapeUtils.escapeXml( name ); - - if ( !getManager().roleExists( name ) ) - { - // Means that the role name doesn't exist. - // We should exit early and not attempt to look up the role information. - return INPUT; - } - - try - { - if ( !isAuthorized() ) - { - log.warn( getCurrentUser() + " isn't authorized to access to the role '" + name + "'" ); - addActionError( getText( "alert.message" ) ); - return ERROR; - } - - Role role = getManager().getRole( name ); - if ( role == null ) - { - addActionError( getText( "cannot.operate.null.role" ) ); - return ERROR; - } - - description = role.getDescription(); - childRoleNames = role.getChildRoleNames(); - Map<String, Role> parentRoles = getManager().getParentRoles( role ); - for ( String roleName : parentRoles.keySet() ) - { - parentRoleNames.add( roleName ); - } - permissions = role.getPermissions(); - - //Get users of the current role - List<String> roles = new ArrayList<String>(); - roles.add( name ); - List<UserAssignment> userAssignments = getManager().getUserAssignmentsForRoles( roles ); - users = new ArrayList<User>(); - if ( userAssignments != null ) - { - for ( UserAssignment userAssignment : userAssignments ) - { - try - { - User user = getUserManager().findUser( userAssignment.getPrincipal() ); - users.add( user ); - } - catch ( UserNotFoundException e ) - { - log.warn( "User '" + userAssignment.getPrincipal() + "' doesn't exist.", e ); - } - } - } - - //Get users of the parent roles - parentUsers = new ArrayList<User>(); - if ( !parentRoles.isEmpty() ) - { - List<UserAssignment> userParentAssignments = - getManager().getUserAssignmentsForRoles( parentRoles.keySet() ); - if ( userParentAssignments != null ) - { - for ( UserAssignment userAssignment : userParentAssignments ) - { - try - { - User user = getUserManager().findUser( userAssignment.getPrincipal() ); - parentUsers.add( user ); - } - catch ( UserNotFoundException e ) - { - log.warn( "User '" + userAssignment.getPrincipal() + "' doesn't exist.", e ); - } - } - } - } - } - catch ( RbacManagerException e ) - { - List<Object> list = new ArrayList<Object>(); - list.add( name ); - list.add( e.getMessage() ); - addActionError( getText( "cannot.get.role", list ) ); - return ERROR; - } - - return INPUT; - } - - private boolean isAuthorized() - throws RbacManagerException - { - List<Role> assignableRoles = getFilteredRolesForCurrentUserAccess(); - boolean updatableRole = false; - for ( Role r : assignableRoles ) - { - if ( r.getName().equalsIgnoreCase( name ) ) - { - updatableRole = true; - } - } - - return updatableRole; - } - - public String edit() - { - String result = input(); - if ( ERROR.equals( result ) ) - { - return result; - } - - newDescription = description; - - //TODO: Remove all users defined in parent roles too - allUsers = getUserManager().getUsers(); - - for ( User user : users ) - { - if ( allUsers.contains( user ) ) - { - allUsers.remove( user ); - } - } - - for ( User user : parentUsers ) - { - if ( allUsers.contains( user ) ) - { - allUsers.remove( user ); - } - } - - return result; - } - - public String save() - { - String result = input(); - if ( ERROR.equals( result ) ) - { - return result; - } - - if ( name == null ) - { - addActionError( getText( "cannot.edit.null.role" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( name ) ) - { - addActionError( getText( "cannot.edit.empty.role" ) ); - return ERROR; - } - - try - { - Role role; - if ( getManager().roleExists( name ) ) - { - role = getManager().getRole( name ); - } - else - { - role = getManager().createRole( name ); - } - - //TODO: allow to modify childRoleNames and permissions - role.setDescription( newDescription ); - //role.setChildRoleNames( childRoleNames ); - //role.setPermissions( permissions ); - - getManager().saveRole( role ); - - List<Object> list = new ArrayList<Object>(); - list.add( name ); - String currentUser = getCurrentUser(); - AuditEvent event = new AuditEvent( getText( "log.role.edit" ) ); - event.setRole( name ); - event.setCurrentUser( currentUser ); - event.log(); - addActionMessage( getText( "save.role.success", list ) ); - } - catch ( RbacManagerException e ) - { - List<Object> list = new ArrayList<Object>(); - list.add( name ); - list.add( e.getMessage() ); - addActionError( getText( "cannot.get.role", list ) ); - return ERROR; - } - - return SUCCESS; - } - - public String addUsers() - { - if ( availableUsers == null || availableUsers.isEmpty() ) - { - return INPUT; - } - - for ( String principal : availableUsers ) - { - if ( !getUserManager().userExists( principal ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - List<Object> list = new ArrayList<Object>(); - list.add( principal ); - addActionError( getText( "user.does.not.exist", list ) ); - return ERROR; - } - - try - { - UserAssignment assignment; - - if ( getManager().userAssignmentExists( principal ) ) - { - assignment = getManager().getUserAssignment( principal ); - } - else - { - assignment = getManager().createUserAssignment( principal ); - } - - assignment.addRoleName( name ); - assignment = getManager().saveUserAssignment( assignment ); - log.info( "{} role assigned to {}", name, principal ); - } - catch ( RbacManagerException e ) - { - List<Object> list = new ArrayList<Object>(); - list.add( principal ); - list.add( e.getMessage() ); - addActionError( getText( "cannot.assign.role", list ) ); - return ERROR; - } - } - - edit(); - return SUCCESS; - } - - public String removeUsers() - { - if ( currentUsers == null || currentUsers.isEmpty() ) - { - return INPUT; - } - - for ( String principal : currentUsers ) - { - if ( !getUserManager().userExists( principal ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - List<Object> list = new ArrayList<Object>(); - list.add( principal ); - addActionError( getText( "user.does.not.exist", list ) ); - return ERROR; - } - - try - { - UserAssignment assignment; - - if ( getManager().userAssignmentExists( principal ) ) - { - assignment = getManager().getUserAssignment( principal ); - } - else - { - assignment = getManager().createUserAssignment( principal ); - } - - assignment.removeRoleName( name ); - assignment = getManager().saveUserAssignment( assignment ); - log.info( "{} role unassigned to {}", name, principal ); - } - catch ( RbacManagerException e ) - { - List<Object> list = new ArrayList<Object>(); - list.add( principal ); - list.add( e.getMessage() ); - addActionError( getText( "cannot.assign.role", list ) ); - return ERROR; - } - } - - edit(); - return SUCCESS; - } - - private UserManager getUserManager() - { - return securitySystem.getUserManager(); - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getName() - { - return name; - } - - public void setName( String roleName ) - { - this.name = roleName; - } - - public List<String> getChildRoleNames() - { - return childRoleNames; - } - - public void setChildRoleNames( List<String> childRoleNames ) - { - this.childRoleNames = childRoleNames; - } - - public String getDescription() - { - return description; - } - - public void setDescription( String description ) - { - this.description = description; - } - - public String getNewDescription() - { - return newDescription; - } - - public void setNewDescription( String newDescription ) - { - this.newDescription = newDescription; - } - - public List<Permission> getPermissions() - { - return permissions; - } - - public void setPermissions( List<Permission> permissions ) - { - this.permissions = permissions; - } - - public List<User> getUsers() - { - return users; - } - - public void setUsers( List<User> users ) - { - this.users = users; - } - - public List<User> getAllUsers() - { - return allUsers; - } - - public void setAllUsers( List<User> allUsers ) - { - this.allUsers = allUsers; - } - - public List<String> getUsersList() - { - return usersList; - } - - public void setUsersList( List<String> usersList ) - { - this.usersList = usersList; - } - - public List<String> getAvailableUsers() - { - return availableUsers; - } - - public void setAvailableUsers( List<String> availableUsers ) - { - this.availableUsers = availableUsers; - } - - public List<String> getCurrentUsers() - { - return currentUsers; - } - - public void setCurrentUsers( List<String> currentUsers ) - { - this.currentUsers = currentUsers; - } - - public List<String> getParentRoleNames() - { - return parentRoleNames; - } - - public void setParentRoleNames( List<String> parentRoleNames ) - { - this.parentRoleNames = parentRoleNames; - } - - public List<User> getParentUsers() - { - return parentUsers; - } - - public void setParentUsers( List<User> parentUsers ) - { - this.parentUsers = parentUsers; - } - - // ------------------------------------------------------------------ - // Internal Support Methods - // ------------------------------------------------------------------ - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RedbackRoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RedbackRoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/OperationsAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/OperationsAction.java deleted file mode 100644 index 2253b5cf9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/OperationsAction.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Operation; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.RedbackActionSupport; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * OperationsAction: - * - * @author Jesse McConnell <jmcconnell@apache.org> - * - */ -@Controller( "redback-operations" ) -@Scope( "prototype" ) -public class OperationsAction - extends RedbackActionSupport -{ - private static final String LIST = "list"; - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager manager; - - private String operationName; - - private String description; - - private List<Operation> allOperations; - - public String list() - { - try - { - allOperations = manager.getAllOperations(); - - if ( allOperations == null ) - { - allOperations = Collections.emptyList(); - } - - Collections.sort( allOperations, new OperationSorter() ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.list.all.operations", Arrays.asList( (Object) e.getMessage() ) ) ); - log.error( "System error:", e ); - allOperations = Collections.emptyList(); - } - - return LIST; - } - - public String save() - { - try - { - Operation temp = manager.createOperation( operationName ); - - temp.setDescription( description ); - - manager.saveOperation( temp ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.save.operation", Arrays.asList( (Object) operationName ) ) ); - log.error( "System error:", e ); - allOperations = Collections.emptyList(); - } - - return LIST; - } - - public String remove() - { - try - { - manager.removeOperation( manager.getOperation( operationName ) ); - } - catch ( RbacManagerException ne ) - { - addActionError( getText( "cannot.remove.operation", Arrays.asList( (Object) operationName ) ) ); - return ERROR; - } - return LIST; - } - - public List<Operation> getAllOperations() - { - return allOperations; - } - - public void setAllOperations( List<Operation> allOperations ) - { - this.allOperations = allOperations; - } - - public String getDescription() - { - return description; - } - - public void setDescription( String description ) - { - this.description = description; - } - - public String getOperationName() - { - return operationName; - } - - public void setOperationName( String operationName ) - { - this.operationName = operationName; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/PermissionsAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/PermissionsAction.java deleted file mode 100644 index 8f5d0d156..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/PermissionsAction.java +++ /dev/null @@ -1,285 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Operation; -import org.apache.archiva.redback.rbac.Permission; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.struts2.action.RedbackActionSupport; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * PermissionsAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-permissions" ) -@Scope( "prototype" ) -public class PermissionsAction - extends RedbackActionSupport -{ - private static final String LIST = "list"; - - // ------------------------------------------------------------------ - // Plexus Component Requirements - // ------------------------------------------------------------------ - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager manager; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String name; - - private String description; - - private String operationName; - - private String operationDescription; - - private String resourceIdentifier; - - private List<Permission> allPermissions; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String list() - { - try - { - allPermissions = manager.getAllPermissions(); - - if ( allPermissions == null ) - { - allPermissions = Collections.emptyList(); - } - - Collections.sort( allPermissions, new PermissionSorter() ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.list.all.permissions", Arrays.asList( (Object) e.getMessage() ) ) ); - log.error( "System error:", e ); - allPermissions = Collections.emptyList(); - } - - return LIST; - } - - public String input() - { - if ( name == null ) - { - addActionError( getText( "cannot.edit.null.permission" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( name ) ) - { - addActionError( getText( "cannot.edit.empty.permission" ) ); - return ERROR; - } - - if ( !manager.permissionExists( name ) ) - { - // Means that the permission name doesn't exist. - // We should exit early and not attempt to look up the permission information. - return LIST; - } - - try - { - Permission permission = manager.getPermission( name ); - if ( permission == null ) - { - addActionError( getText( "cannot.operate.null.permission" ) ); - return ERROR; - } - - description = permission.getDescription(); - Operation operation = permission.getOperation(); - if ( operation != null ) - { - operationName = operation.getName(); - operationDescription = operation.getDescription(); - } - - Resource resource = permission.getResource(); - if ( resource != null ) - { - resourceIdentifier = resource.getIdentifier(); - } - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.get.permission", Arrays.asList( (Object) name, e.getMessage() ) ) ); - return ERROR; - } - - return LIST; - } - - public String submit() - { - if ( name == null ) - { - addActionError( getText( "cannot.edit.null.permission" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( name ) ) - { - addActionError( getText( "cannot.edit.empty.permission" ) ); - return ERROR; - } - - try - { - Permission permission; - if ( manager.permissionExists( name ) ) - { - permission = manager.getPermission( name ); - } - else - { - permission = manager.createPermission( name ); - } - - permission.setDescription( description ); - - Operation operation = manager.createOperation( operationName ); - if ( StringUtils.isNotEmpty( operationDescription ) ) - { - operation.setDescription( operationDescription ); - } - permission.setOperation( manager.saveOperation( operation ) ); - - Resource resource = manager.createResource( resourceIdentifier ); - permission.setResource( manager.saveResource( resource ) ); - - manager.savePermission( permission ); - - addActionMessage( getText( "save.permission.success", Arrays.asList( (Object) name ) ) ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.get.permission", Arrays.asList( (Object) name, e.getMessage() ) ) ); - return ERROR; - } - - return LIST; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - 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 String getOperationDescription() - { - return operationDescription; - } - - public void setOperationDescription( String operationDescription ) - { - this.operationDescription = operationDescription; - } - - 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; - } - - public List<Permission> getAllPermissions() - { - return allPermissions; - } - - public void setAllPermissions( List<Permission> allPermissions ) - { - this.allPermissions = allPermissions; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ReportAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ReportAction.java deleted file mode 100644 index dc86e8e89..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ReportAction.java +++ /dev/null @@ -1,147 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Arrays; - -import javax.inject.Inject; -import javax.servlet.http.HttpServletResponse; - -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -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.springframework.stereotype.Controller; - -/** - * ReportAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller("redback-report") -@Scope("prototype") -public class ReportAction - extends AbstractSecurityAction -{ - /** - * - */ - @Inject - private ReportManager reportManager; - - private String reportId; - - private String reportType; - - public String generate() - { - Report report; - try - { - report = reportManager.findReport( reportId, reportType ); - } - catch ( ReportException e ) - { - addActionError( getText( "cannot.get.report", Arrays.asList( ( Object ) e.getMessage() ) ) ); - return ERROR; - } - - HttpServletResponse response = ServletActionContext.getResponse(); - - // HACK: Unwrap sitemesh response. (effectively disables sitemesh) - if ( response instanceof PageResponseWrapper ) - { - response = (HttpServletResponse) ( (PageResponseWrapper) response ).getResponse(); - } - - try - { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - report.writeReport( os ); - - response.reset(); - response.setContentType( report.getMimeType() ); - response.addHeader( "Content-Disposition", - "attachment; filename=" + report.getId() + "." + report.getType() ); - byte bytes[] = os.toByteArray(); - response.setContentLength( bytes.length ); - response.getOutputStream().write( bytes, 0, bytes.length ); - response.getOutputStream().flush(); - response.getOutputStream().close(); - - // Don't return a result. - return null; - } - catch ( ReportException e ) - { - String emsg = getText( "cannot.generate.report" ); - addActionError( emsg ); - log.error( emsg, e ); - return ERROR; - } - catch ( IOException e ) - { - String emsg = getText( "cannot.generate.report" ); - addActionError( emsg ); - log.error( emsg, e ); - return ERROR; - } - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION, Resource.GLOBAL ); - return bundle; - } - - public String getReportId() - { - return reportId; - } - - public void setReportId( String reportId ) - { - this.reportId = reportId; - } - - public String getReportType() - { - return reportType; - } - - public void setReportType( String reportType ) - { - this.reportType = reportType; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ResourcesAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ResourcesAction.java deleted file mode 100644 index bd3c6832e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/ResourcesAction.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Resource; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * OperationsAction: - * - * @author Jesse McConnell <jmcconnell@apache.org> - * - */ -@Controller( "redback-resources" ) -@Scope( "prototype" ) -public class ResourcesAction - extends AbstractSecurityAction -{ - private static final String LIST = "list"; - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager manager; - - private String resourceIdentifier; - - private boolean isPattern; - - private List<Resource> allResources; - - public String list() - { - try - { - allResources = manager.getAllResources(); - - if ( allResources == null ) - { - allResources = Collections.emptyList(); - } - - Collections.sort( allResources, new ResourceSorter() ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.list.all.resources", Arrays.asList( (Object) e.getMessage() ) ) ); - log.error( "System error:", e ); - allResources = Collections.emptyList(); - } - - return LIST; - } - - public String save() - { - try - { - Resource temp = manager.createResource( resourceIdentifier ); - - temp.setIdentifier( resourceIdentifier ); - temp.setPattern( isPattern ); - - manager.saveResource( temp ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.save.resource", Arrays.asList( (Object) e.getMessage() ) ) ); - log.error( "System error:", e ); - allResources = Collections.emptyList(); - } - - return LIST; - } - - public String remove() - { - try - { - manager.removeResource( manager.getResource( resourceIdentifier ) ); - } - catch ( RbacManagerException ne ) - { - addActionError( getText( "cannot.remove.resource", Arrays.asList( (Object) resourceIdentifier ) ) ); - return ERROR; - } - return LIST; - } - - public List<Resource> getAllResources() - { - return allResources; - } - - public void setAllResources( List<Resource> allResources ) - { - this.allResources = allResources; - } - - public String getResourceIdentifier() - { - return resourceIdentifier; - } - - public void setResourceIdentifier( String resourceIdentifier ) - { - this.resourceIdentifier = resourceIdentifier; - } - - public boolean isPattern() - { - return isPattern; - } - - public void setPattern( boolean isPattern ) - { - this.isPattern = isPattern; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleCreateAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleCreateAction.java deleted file mode 100644 index 07d16aa3a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleCreateAction.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.RbacManagerException; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * RoleCreateAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-role-create" ) -@Scope( "prototype" ) -public class RoleCreateAction - extends AbstractSecurityAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager manager; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String principal; - - private String roleName; - - private String description; - - private List<SimplePermission> permissions; - - private List<String> childRoles; - - private SimplePermission addpermission; - - private String submitMode; - - protected static final String VALID_ROLENAME_CHARS = "[a-zA-Z_0-9\\-\\s.,]*"; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - if ( permissions == null ) - { - permissions = new ArrayList<SimplePermission>(); - } - - if ( childRoles == null ) - { - childRoles = new ArrayList<String>(); - } - - if ( addpermission == null ) - { - addpermission = new SimplePermission(); - } - - return INPUT; - } - - public String addpermission() - { - if ( addpermission == null ) - { - addActionError( getText( "cannot.add.null.permission" ) ); - return ERROR; - } - - if ( permissions == null ) - { - permissions = new ArrayList<SimplePermission>(); - } - - permissions.add( addpermission ); - - addpermission = new SimplePermission(); - - return INPUT; - } - - public String submit() - { - if ( StringUtils.equals( getSubmitMode(), "addPermission" ) ) - { - return addpermission(); - } - - if ( StringUtils.isEmpty( roleName ) ) - { - addActionError( getText( "cannot.add.empty.role" ) ); - return ERROR; - } - if ( !roleName.matches( VALID_ROLENAME_CHARS ) ) - { - addActionError( getText( "roleName.invalid.characters" ) ); - return ERROR; - } - - try - { - Role _role; - if ( manager.roleExists( roleName ) ) - { - _role = manager.getRole( roleName ); - } - else - { - _role = manager.createRole( roleName ); - } - - _role.setDescription( description ); - _role.setChildRoleNames( childRoles ); - - List<Permission> _permissionList = new ArrayList<Permission>(); - for ( SimplePermission perm : permissions ) - { - _permissionList.add( - manager.createPermission( perm.getName(), perm.getOperationName(), perm.getResourceIdentifier() ) ); - } - - _role.setPermissions( _permissionList ); - - manager.saveRole( _role ); - - addActionMessage( getText( "save.role.success", Arrays.asList( (Object) roleName ) ) ); - String currentUser = getCurrentUser(); - AuditEvent event = new AuditEvent( getText( "log.role.create" ) ); - event.setRole( roleName ); - event.setCurrentUser( currentUser ); - event.log(); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.get.role", Arrays.asList( (Object) roleName, e.getMessage() ) ) ); - return ERROR; - } - - return SUCCESS; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getPrincipal() - { - return principal; - } - - public void setPrincipal( String principal ) - { - this.principal = principal; - } - - public SimplePermission getAddpermission() - { - return addpermission; - } - - public void setAddpermission( SimplePermission addpermission ) - { - this.addpermission = addpermission; - } - - public String getSubmitMode() - { - return submitMode; - } - - public void setSubmitMode( String submitMode ) - { - this.submitMode = submitMode; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - return bundle; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleModelAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleModelAction.java deleted file mode 100644 index 938236c1e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RoleModelAction.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Resource; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.model.RedbackRoleModel; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -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 javax.inject.Inject; - -/** - * RolesAction - * - * @author <a href="mailto:jmcconnell@apache.org">Jesse McConnell</a> - * - */ -@Controller( "redback-role-model" ) -@Scope( "prototype" ) -public class RoleModelAction - extends AbstractSecurityAction -{ - /** - * role-hint="default" - */ - @Inject - private RoleManager manager; - - private RedbackRoleModel model; - - public String view() - { - model = manager.getModel(); - - return SUCCESS; - } - - public RedbackRoleModel getModel() - { - return model; - } - - public void setModel( RedbackRoleModel model ) - { - this.model = model; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RolesAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RolesAction.java deleted file mode 100644 index 92272d0e9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/RolesAction.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.struts2.action.AbstractUserCredentialsAction; -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 java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * RolesAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-roles" ) -@Scope( "prototype" ) -public class RolesAction - extends AbstractUserCredentialsAction -{ - private static final String LIST = "list"; - - private List<Role> allRoles; - - public String list() - { - try - { - allRoles = getFilteredRolesForCurrentUserAccess(); - } - catch ( RbacManagerException e ) - { - List<Object> list = new ArrayList<Object>(); - list.add( e.getMessage() ); - addActionError( getText( "cannot.list.all.roles", list ) ); - log.error( "System error:", e ); - allRoles = Collections.emptyList(); - } - - return LIST; - } - - public List<Role> getAllRoles() - { - return allRoles; - } - - public void setAllRoles( List<Role> allRoles ) - { - this.allRoles = allRoles; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoAction.java deleted file mode 100644 index fd70caf4a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoAction.java +++ /dev/null @@ -1,274 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.components.registry.Registry; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -import org.apache.archiva.redback.system.SecuritySystem; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * SystemInfoAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-sysinfo" ) -@Scope( "prototype" ) -public class SystemInfoAction - extends AbstractSecurityAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - private SecuritySystem securitySystem; - - /** - * role-hint="commons-configuration" - */ - @Inject - @Named( value = "commons-configuration" ) - private Registry registry; - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager rbacManager; - - // Class.getClass() and some JPOX classes - private static final List<String> ignoredReaders = Arrays.asList( "class", "copy" ); - - private static final String NULL = "<null>"; - - private static final char LN = Character.LINE_SEPARATOR; - - private static final String INDENT = " "; - - private static final int MAXDEPTH = 10; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private StringBuilder details; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - details = new StringBuilder(); - - details.append( "Configuration: " ); - dumpObject( details, registry, INDENT ); - details.append( registry.dump() ); - details.append( LN ); - - details.append( LN ).append( "<hr/>" ).append( LN ); - details.append( "RBAC Manager: " ); - dumpObject( details, rbacManager, INDENT ); - - details.append( LN ).append( "<hr/>" ).append( LN ); - details.append( "SecuritySystem: " ); - dumpObject( details, securitySystem, INDENT ); - - return SUCCESS; - } - - private void dumpObject( StringBuilder sb, Object obj, String indent ) - { - dumpObjectSwitchboard( new ArrayList<Object>(), sb, obj, indent, 0 ); - } - - /** - * The recursive object dumping switchboard. - * - * @param seenObjects objects already seen (to prevent cycles) - * @param sb the StringBuilder to populate - * @param obj the object to dump - * @param indent the current indent string. - * @param depth the depth in the tree. - */ - private void dumpObjectSwitchboard( List<Object> seenObjects, StringBuilder sb, Object obj, String indent, - int depth ) - { - if ( obj == null ) - { - sb.append( NULL ).append( LN ); - return; - } - - if ( depth > MAXDEPTH ) - { - sb.append( StringEscapeUtils.escapeHtml( "<MAX DEPTH>" ) ); - sb.append( LN ); - return; - } - - depth++; - - String className = obj.getClass().getName(); - - sb.append( '(' ).append( className ).append( ") " ); - - if ( obj instanceof List ) - { - dumpIterator( seenObjects, sb, ( (List<?>) obj ).iterator(), indent, depth ); - } - else if ( obj instanceof Set ) - { - dumpIterator( seenObjects, sb, ( (Set<?>) obj ).iterator(), indent, depth ); - } - else if ( obj instanceof Map ) - { - dumpIterator( seenObjects, sb, ( (Map<?, ?>) obj ).entrySet().iterator(), indent, depth ); - } - else if ( obj instanceof Iterator ) - { - dumpIterator( seenObjects, sb, (Iterator<?>) obj, indent, depth ); - } - else - { - // Filter classes that start with java or javax - if ( className.startsWith( "java." ) || className.startsWith( "javax." ) ) - { - sb.append( StringEscapeUtils.escapeHtml( obj.toString() ) ).append( LN ); - return; - } - - // prevent cycles - if ( seenObjects.contains( obj ) ) - { - // No need to dump. - sb.append( StringEscapeUtils.escapeHtml( "<seen already preventing cycle in dump> " ) ); - sb.append( LN ); - return; - } - - // Adding object to seen list (to prevent cycles) - seenObjects.add( obj ); - - dumpObjectReaders( seenObjects, sb, obj, indent, depth ); - } - depth--; - } - - @SuppressWarnings( "unchecked" ) - private void dumpObjectReaders( List<Object> seenObjects, StringBuilder sb, Object obj, String indent, int depth ) - { - sb.append( obj.toString() ).append( LN ); - String name = null; - - try - { - Map<String, Object> readers = PropertyUtils.describe( obj ); - for ( Map.Entry<String, Object> readerEntry : readers.entrySet() ) - { - name = (String) readerEntry.getKey(); - - if ( ignoredReaders.contains( name ) ) - { - // skip this reader. - continue; - } - - sb.append( indent ); - sb.append( name ).append( ':' ); - - Object value = readerEntry.getValue(); - if ( value == null ) - { - sb.append( NULL ).append( LN ); - } - else - { - dumpObjectSwitchboard( seenObjects, sb, value, INDENT + indent, depth ); - } - } - } - catch ( Throwable e ) - { - sb.append( LN ).append( indent ); - sb.append( "Unable to read bean [" ).append( obj.getClass().getName() ); - if ( StringUtils.isNotBlank( name ) ) - { - sb.append( ".get" ).append( StringUtils.capitalize( name ) ).append( "()" ); - } - sb.append( "]: " ).append( '(' ).append( e.getClass().getName() ).append( ") " ); - sb.append( e.getMessage() ).append( LN ); - } - } - - private void dumpIterator( List<Object> seenObjects, StringBuilder sb, Iterator<?> iterator, String indent, - int depth ) - { - sb.append( LN ); - while ( iterator.hasNext() ) - { - Object entry = iterator.next(); - sb.append( indent ); - dumpObjectSwitchboard( seenObjects, sb, entry, indent + " | ", depth ); - } - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getDetails() - { - return details.toString(); - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.CONFIGURATION_EDIT_OPERATION, Resource.GLOBAL ); - return bundle; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserCreateAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserCreateAction.java deleted file mode 100644 index 158b5f963..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserCreateAction.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.Arrays; - -import org.apache.archiva.redback.policy.UserSecurityPolicy; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.AbstractUserCredentialsAction; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserManager; -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; - -/** - * UserCreateAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller("redback-admin-user-create") -@Scope("prototype") -public class UserCreateAction - extends AbstractUserCredentialsAction -{ - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private CreateUserCredentials user; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - if ( user == null ) - { - user = new CreateUserCredentials(); - } - - return INPUT; - } - - public String submit() - { - if ( user == null ) - { - user = new CreateUserCredentials(); - addActionError( getText( "invalid.user.credentials" ) ); - return ERROR; - } - - internalUser = user; - - validateCredentialsLoose(); - - // NOTE: Do not perform Password Rules Validation Here. - - UserManager manager = super.securitySystem.getUserManager(); - - if ( manager.userExists( user.getUsername() ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.already.exists", Arrays.asList( ( Object ) user.getUsername() ) ) ); - } - - if ( hasActionErrors() || hasFieldErrors() ) - { - return ERROR; - } - - User u = manager.createUser( user.getUsername(), user.getFullName(), user.getEmail() ); - u.setPassword( user.getPassword() ); - - // force the user to change their password when they log in next - u.setPasswordChangeRequired( true ); - - // Disable Password Rules for this creation. - UserSecurityPolicy securityPolicy = securitySystem.getPolicy(); - try - { - // REDBACK-156 - securityPolicy.setEnabled( false ); - u.setValidated( true ); - manager.addUser( u ); - String currentUser = getCurrentUser(); - AuditEvent event = new AuditEvent( getText( "log.account.create" ) ); - event.setAffectedUser( u.getUsername() ); - event.setCurrentUser( currentUser ); - event.log(); - } - finally - { - securityPolicy.setEnabled( true ); - } - - return SUCCESS; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public CreateUserCredentials getUser() - { - return user; - } - - public void setUser( CreateUserCredentials user ) - { - this.user = user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION, Resource.GLOBAL ); - return bundle; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserDeleteAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserDeleteAction.java deleted file mode 100644 index 13a867d0e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserDeleteAction.java +++ /dev/null @@ -1,202 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.RbacObjectInvalidException; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.rbac.RbacObjectNotFoundException; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.struts2.action.CancellableAction; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.Arrays; - -/** - * UserDeleteAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-admin-user-delete" ) -@Scope( "prototype" ) -public class UserDeleteAction - extends AbstractSecurityAction - implements CancellableAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * role-hint="configurable" - */ - @Inject - @Named( value = "userManager#configurable" ) - private UserManager userManager; - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager rbacManager; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private String username; - - private User user; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String confirm() - { - if ( username == null ) - { - addActionError( getText( "cannot.remove.user.null.username" ) ); - return SUCCESS; - } - - try - { - user = userManager.findUser( username ); - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.remove.user.not.found", Arrays.asList( (Object) username ) ) ); - return SUCCESS; - } - - return INPUT; - } - - public String submit() - { - if ( username == null ) - { - addActionError( getText( "invalid.user.credentials" ) ); - return SUCCESS; - } - - if ( StringUtils.isEmpty( username ) ) - { - addActionError( getText( "cannot.remove.user.empty.username" ) ); - return SUCCESS; - } - - try - { - rbacManager.removeUserAssignment( username ); - } - catch ( RbacObjectNotFoundException e ) - { - // ignore, this is possible since the user may never have had roles assigned - } - catch ( RbacObjectInvalidException e ) - { - addActionError( getText( "cannot.remove.user.role", Arrays.asList( (Object) username, e.getMessage() ) ) ); - } - catch ( RbacManagerException e ) - { - addActionError( getText( "cannot.remove.user.role", Arrays.asList( (Object) username, e.getMessage() ) ) ); - } - - if ( getActionErrors().isEmpty() ) - { - try - { - userManager.deleteUser( username ); - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.remove.user.non.existent", Arrays.asList( (Object) username ) ) ); - } - } - String currentUser = getCurrentUser(); - - AuditEvent event = new AuditEvent( getText( "log.account.delete" ) ); - event.setAffectedUser( username ); - event.setCurrentUser( currentUser ); - event.log(); - - return SUCCESS; - } - - /** - * Returns the cancel result. <p/> A basic implementation would simply be to return CANCEL. - * - * @return - */ - public String cancel() - { - return CANCEL; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public String getUsername() - { - return username; - } - - public void setUsername( String username ) - { - this.username = username; - } - - public User getUser() - { - return user; - } - - public void setUser( User user ) - { - this.user = user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION, Resource.GLOBAL ); - return bundle; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserEditAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserEditAction.java deleted file mode 100644 index b9728c9f5..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserEditAction.java +++ /dev/null @@ -1,411 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.PasswordEncoder; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.struts2.action.AuditEvent; -import org.apache.archiva.redback.struts2.action.CancellableAction; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.archiva.redback.policy.PasswordRuleViolationException; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.system.DefaultSecuritySession; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.UserManager; -import org.codehaus.plexus.util.StringUtils; -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 javax.inject.Inject; -import javax.inject.Named; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * UserEditAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-admin-user-edit" ) -@Scope( "prototype" ) -public class UserEditAction - extends AbstractAdminUserCredentialsAction - implements CancellableAction -{ - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager rbacManager; - - /** - * A List of {@link org.apache.archiva.redback.rbac.Role} objects. - */ - private List<Role> effectivelyAssignedRoles; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private AdminEditUserCredentials user; - - private String updateButton; - - private boolean emailValidationRequired; - - private boolean hasHiddenRoles; - - private String oldPassword; - - private String userAdminPassword; - - private boolean self; - - public static String CONFIRM = "confirm"; - - public static String CONFIRM_ERROR = "confirmError"; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String edit() - { - oldPassword = ""; - - emailValidationRequired = securitySystem.getPolicy().getUserValidationSettings().isEmailValidationRequired(); - - if ( getUsername() == null ) - { - addActionError( getText( "cannot.edit.user.null.username" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( getUsername() ) ) - { - addActionError( getText( "cannot.edit.user.empty.username" ) ); - return ERROR; - } - - UserManager manager = super.securitySystem.getUserManager(); - - String escapedUsername = StringEscapeUtils.escapeXml( getUsername() ); - - if ( !manager.userExists( escapedUsername ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.does.not.exist", Collections.singletonList( (Object) escapedUsername ) ) ); - return ERROR; - } - - try - { - User u = manager.findUser( escapedUsername ); - - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - user = new AdminEditUserCredentials( u ); - - // require user admin to provide his/her password if editing account of others - if ( getUsername().equals( getCurrentUser() ) ) - { - self = true; - } - - try - { - String principal = u.getPrincipal().toString(); - List<Role> roles = filterAssignableRoles( rbacManager.getEffectivelyAssignedRoles( principal ) ); - effectivelyAssignedRoles = filterRolesForCurrentUserAccess( roles ); - hasHiddenRoles = ( roles.size() > effectivelyAssignedRoles.size() ); - } - catch ( RbacManagerException rme ) - { - // ignore, this can happen when the user has no roles assigned - } - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.get.user", Arrays.asList( (Object) getUsername(), e.getMessage() ) ) ); - return ERROR; - } - - return INPUT; - } - - private List<Role> filterAssignableRoles( Collection<Role> roles ) - { - List<Role> assignableRoles = new ArrayList<Role>( roles.size() ); - for ( Role r : roles ) - { - if ( r.isAssignable() ) - { - assignableRoles.add( r ); - } - } - return assignableRoles; - } - - public String submit() - { - if ( getUsername() == null ) - { - addActionError( getText( "cannot.edit.user.null.username" ) ); - return ERROR; - } - - if ( StringUtils.isEmpty( getUsername() ) ) - { - addActionError( getText( "cannot.edit.user.empty.username" ) ); - return ERROR; - } - - if ( user == null ) - { - addActionError( getText( "cannot.edit.user.null.credentials" ) ); - return ERROR; - } - - internalUser = user; - - validateCredentialsLoose(); - - // if form errors, return with them before continuing - if ( hasActionErrors() || hasFieldErrors() ) - { - return ERROR; - } - - if ( !getUsername().equals( getCurrentUser() ) ) - { - return CONFIRM; - } - else - { - return save( true ); - } - } - - // confirm user admin's password before allowing to proceed with the operation - public String confirmAdminPassword() - { - UserManager manager = super.securitySystem.getUserManager(); - - if ( StringUtils.isEmpty( userAdminPassword ) ) - { - addActionError( getText( "user.admin.password.required" ) ); - return CONFIRM_ERROR; - } - - try - { - User currentUser = manager.findUser( getCurrentUser() ); - - // check if user admin provided correct password! - PasswordEncoder encoder = securitySystem.getPolicy().getPasswordEncoder(); - if ( !encoder.isPasswordValid( currentUser.getEncodedPassword(), userAdminPassword ) ) - { - addActionError( getText( "user.admin.password.does.not.match.existing" ) ); - return CONFIRM_ERROR; - } - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.find.user", Arrays.asList( (Object) getCurrentUser(), e.getMessage() ) ) ); - return CONFIRM_ERROR; - } - - return save( false ); - } - - public String cancel() - { - return CANCEL; - } - - private String save( boolean validateOldPassword ) - { - UserManager manager = super.securitySystem.getUserManager(); - - if ( !manager.userExists( getUsername() ) ) - { - // Means that the role name doesn't exist. - // We need to fail fast and return to the previous page. - addActionError( getText( "user.does.not.exist", Collections.singletonList( (Object) getUsername() ) ) ); - return ERROR; - } - - try - { - User u = manager.findUser( getUsername() ); - if ( u == null ) - { - addActionError( getText( "cannot.operate.on.null.user" ) ); - return ERROR; - } - - if ( validateOldPassword ) - { - PasswordEncoder encoder = securitySystem.getPolicy().getPasswordEncoder(); - - if ( StringUtils.isEmpty( oldPassword ) ) - { - self = true; - addFieldError( "oldPassword", getText( "old.password.required" ) ); - return ERROR; - } - - if ( !encoder.isPasswordValid( u.getEncodedPassword(), oldPassword ) ) - { - self = true; - addFieldError( "oldPassword", getText( "password.provided.does.not.match.existing" ) ); - return ERROR; - } - } - - u.setFullName( user.getFullName() ); - u.setEmail( user.getEmail() ); - u.setPassword( user.getPassword() ); - u.setLocked( user.isLocked() ); - u.setPasswordChangeRequired( user.isPasswordChangeRequired() ); - - manager.updateUser( u, user.isPasswordChangeRequired() ); - - //check if current user then update the session - if ( getSecuritySession().getUser().getUsername().equals( u.getUsername() ) ) - { - SecuritySession securitySession = - new DefaultSecuritySession( getSecuritySession().getAuthenticationResult(), u ); - - session.put( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - - setSession( session ); - } - } - catch ( UserNotFoundException e ) - { - addActionError( getText( "cannot.find.user", Arrays.asList( (Object) getUsername(), e.getMessage() ) ) ); - return ERROR; - } - catch ( PasswordRuleViolationException pe ) - { - processPasswordRuleViolations( pe ); - return ERROR; - } - String currentUser = getCurrentUser(); - - AuditEvent event = new AuditEvent( getText( "log.account.edit" ) ); - event.setAffectedUser( getUsername() ); - event.setCurrentUser( currentUser ); - event.log(); - - return SUCCESS; - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - - public String getUpdateButton() - { - return updateButton; - } - - public void setUpdateButton( String updateButton ) - { - this.updateButton = updateButton; - } - - public AdminEditUserCredentials getUser() - { - return user; - } - - public void setUser( AdminEditUserCredentials user ) - { - this.user = user; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION, getUsername() ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION, Resource.GLOBAL ); - return bundle; - } - - public List<Role> getEffectivelyAssignedRoles() - { - return effectivelyAssignedRoles; - } - - public boolean isEmailValidationRequired() - { - return emailValidationRequired; - } - - public boolean isHasHiddenRoles() - { - return hasHiddenRoles; - } - - public void setHasHiddenRoles( boolean hasHiddenRoles ) - { - this.hasHiddenRoles = hasHiddenRoles; - } - - public void setOldPassword( String oldPassword ) - { - this.oldPassword = oldPassword; - } - - public void setUserAdminPassword( String userAdminPassword ) - { - this.userAdminPassword = userAdminPassword; - } - - public boolean isSelf() - { - return self; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserListAction.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserListAction.java deleted file mode 100644 index b50a97ab9..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/action/admin/UserListAction.java +++ /dev/null @@ -1,277 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.rbac.RbacObjectNotFoundException; -import org.apache.archiva.redback.rbac.Resource; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.rbac.UserAssignment; -import org.apache.archiva.redback.struts2.action.AbstractSecurityAction; -import org.apache.archiva.redback.users.User; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.users.UserQuery; -import org.codehaus.plexus.util.StringUtils; -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 org.extremecomponents.table.limit.Limit; -import org.extremecomponents.table.limit.LimitFactory; -import org.extremecomponents.table.limit.TableLimit; -import org.extremecomponents.table.limit.TableLimitFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -import javax.inject.Inject; -import javax.inject.Named; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * UserListAction - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redback-admin-user-list" ) -@Scope( "prototype" ) -public class UserListAction - extends AbstractSecurityAction -{ - // ------------------------------------------------------------------ - // Component Requirements - // ------------------------------------------------------------------ - - /** - * - */ - @Inject - private SecuritySystem securitySystem; - - /** - * role-hint="cached" - */ - @Inject - @Named( value = "rBACManager#cached" ) - private RBACManager rbac; - - /** - * - */ - @Inject - private ReportManager reportManager; - - // ------------------------------------------------------------------ - // Action Parameters - // ------------------------------------------------------------------ - - private List<User> users; - - private List<Role> roles; - - private String roleName; - - // ------------------------------------------------------------------ - // Action Entry Points - (aka Names) - // ------------------------------------------------------------------ - - public String show() - { - try - { - roles = rbac.getAllRoles(); - } - catch ( RbacManagerException e ) - { - roles = Collections.emptyList(); - } - - if ( StringUtils.isEmpty( roleName ) ) - { - users = findUsersWithFilter(); - } - else - { - roleName = StringEscapeUtils.escapeXml( roleName ); - - try - { - Role target = rbac.getRole( roleName ); - Set<String> targetRoleNames = new HashSet<String>(); - - for ( int i = 0; i < roles.size(); i++ ) - { - Role r = roles.get( i ); - if ( rbac.getEffectiveRoles( r ).contains( target ) ) - { - targetRoleNames.add( r.getName() ); - } - } - - users = findUsers( targetRoleNames ); - } - catch ( RbacObjectNotFoundException e ) - { - users = Collections.emptyList(); - } - catch ( RbacManagerException e ) - { - users = Collections.emptyList(); - } - } - - if ( users == null ) - { - users = Collections.emptyList(); - } - - return INPUT; - } - - public SecureActionBundle initSecureActionBundle() - throws SecureActionException - { - SecureActionBundle bundle = new SecureActionBundle(); - bundle.setRequiresAuthentication( true ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION, Resource.GLOBAL ); - bundle.addRequiredAuthorization( RoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION, Resource.GLOBAL ); - return bundle; - } - - private List<User> findUsers( Collection<String> roleNames ) - { - List<String> usernames = getUsernamesForRoles( roleNames ); - List<User> filteredUsers = new ArrayList<User>(); - - for ( User user : findUsersWithFilter() ) - { - if ( usernames.contains( user.getUsername() ) ) - { - filteredUsers.add( user ); - } - } - - return filteredUsers; - } - - private List<User> findUsersWithFilter() - { - Context context = new HttpServletRequestContext( ServletActionContext.getRequest() ); - LimitFactory limitFactory = new TableLimitFactory( context ); - Limit limit = new TableLimit( limitFactory ); - FilterSet filterSet = limit.getFilterSet(); - - UserQuery query = getUserManager().createUserQuery(); - if ( filterSet.getFilter( "username" ) != null ) - { - query.setUsername( filterSet.getFilter( "username" ).getValue() ); - } - if ( filterSet.getFilter( "fullName" ) != null ) - { - query.setFullName( filterSet.getFilter( "fullName" ).getValue() ); - } - if ( filterSet.getFilter( "email" ) != null ) - { - query.setEmail( filterSet.getFilter( "email" ).getValue() ); - } - return getUserManager().findUsersByQuery( query ); - } - - private List<String> getUsernamesForRoles( Collection<String> roleNames ) - { - Set<String> usernames = new HashSet<String>(); - - try - { - List<UserAssignment> userAssignments = rbac.getUserAssignmentsForRoles( roleNames ); - - if ( userAssignments != null ) - { - for ( UserAssignment a : userAssignments ) - { - usernames.add( a.getPrincipal() ); - } - } - } - catch ( RbacManagerException e ) - { - log.warn( "Unable to get user assignments for roles " + roleNames, e ); - } - - return new ArrayList<String>( usernames ); - } - - private UserManager getUserManager() - { - return securitySystem.getUserManager(); - } - - // ------------------------------------------------------------------ - // Parameter Accessor Methods - // ------------------------------------------------------------------ - - public List<User> getUsers() - { - return users; - } - - public void setUsers( List<User> users ) - { - this.users = users; - } - - public String getRoleName() - { - if ( StringUtils.isEmpty( roleName ) ) - { - return "Any"; - } - return roleName; - } - - public void setRoleName( String roleName ) - { - this.roleName = roleName; - } - - public List<Role> getRoles() - { - return roles; - } - - public Map<String, Map<String, Report>> getReportMap() - { - return reportManager.getReportMap(); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/AbstractXworkConfigurationCheck.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/AbstractXworkConfigurationCheck.java deleted file mode 100644 index 21ef7ea07..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/AbstractXworkConfigurationCheck.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.apache.archiva.redback.struts2.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 java.util.Map; - -import org.codehaus.plexus.util.StringUtils; -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 com.opensymphony.xwork2.config.entities.PackageConfig; - -/** - * AbstractXworkConfigurationCheck - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -public class AbstractXworkConfigurationCheck -{ - - protected void checkAction( List<String> violations, XworkPackageConfig expectedPackage, XworkActionConfig expectedAction, - Map<?, ?> xwActionMap ) - { - ActionConfig xwActionConfig = (ActionConfig) xwActionMap.get( expectedAction.name ); - if ( xwActionConfig != null ) - { - if ( StringUtils.isNotEmpty( expectedAction.clazz ) ) - { - if ( !StringUtils.equals( expectedAction.clazz, xwActionConfig.getClassName() ) ) - { - violations.add( "xwork.xml - Expected class attribute value of " + quote( expectedAction.clazz ) + - " but got " + quote( xwActionConfig.getClassName() ) + " instead, on action " + - quote( expectedAction.name ) + " in package " + quote( expectedPackage.name ) + "." ); - } - } - - if ( StringUtils.isNotEmpty( expectedAction.method ) ) - { - if ( !StringUtils.equals( expectedAction.method, xwActionConfig.getMethodName() ) ) - { - violations.add( "xwork.xml - Expected method attribute value of " + quote( expectedAction.method ) + - " but got " + quote( xwActionConfig.getMethodName() ) + " instead, on action " + - quote( expectedAction.name ) + " in package " + quote( expectedPackage.name ) + "." ); - } - } - - Map<?, ?> xwResultMap = xwActionConfig.getResults(); - - if ( expectedAction.results.isEmpty() ) - { - // Check for single default result. - if ( xwResultMap.size() < 1 ) - { - violations.add( "xwork.xml - Missing default result on action name " + - quote( expectedAction.name ) + " in package " + quote( expectedPackage.name ) + "." ); - } - } - else - { - // Check for named result names. - for ( String resultName : expectedAction.results ) - { - if ( xwResultMap.get( resultName ) == null ) - { - violations.add( "xwork.xml - Missing named result " + quote( resultName ) + " in action " + - quote( expectedAction.name ) + " in package " + quote( expectedPackage.name ) + "." ); - } - } - } - } - else - { - violations.add( "xwork.xml - Missing action named " + quote( expectedAction.name ) + " in package " + - quote( expectedPackage.name ) + "." ); - } - } - - protected void checkPackage( List<String> violations, XworkPackageConfig expectedPackage, Configuration xwConfig ) - { - PackageConfig xwPackageConfig = findPackageNamespace( xwConfig, expectedPackage.name ); - - if ( xwPackageConfig != null ) - { - Map<?, ?> xwActionMap = xwPackageConfig.getActionConfigs(); - - for ( XworkActionConfig expectedAction : expectedPackage.actions ) - { - checkAction( violations, expectedPackage, expectedAction, xwActionMap ); - } - } - else - { - violations.add( "Missing " + quote( expectedPackage.name ) + " package namespace in xwork.xml" ); - } - } - - @SuppressWarnings("unchecked") - protected PackageConfig findPackageNamespace( Configuration xwConfig, String name ) - { - Map<?,PackageConfig> xwPackageConfigMap = xwConfig.getPackageConfigs(); - - for ( PackageConfig xwPackageConfig : xwPackageConfigMap.values() ) - { - if ( StringUtils.equals( name, xwPackageConfig.getNamespace() ) ) - { - return xwPackageConfig; - } - } - - return null; - } - - protected String quote( Object o ) - { - if ( o == null ) - { - return "<null>"; - } - return "\"" + o.toString() + "\""; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkActions.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkActions.java deleted file mode 100644 index 25435f352..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkActions.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.apache.archiva.redback.struts2.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; - -/** - * ExpectedXworkActions - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - */ -public class ExpectedXworkActions - implements EnvironmentCheck -{ - public void validateEnvironment( List<String> violations ) - { - String classNames[] = new String[]{"org.apache.archiva.redback.struts2.action.admin.UserCreateAction", - "org.apache.archiva.redback.struts2.action.admin.UserDeleteAction", - "org.apache.archiva.redback.struts2.action.admin.UserEditAction", - "org.apache.archiva.redback.struts2.action.admin.UserListAction", - "org.apache.archiva.redback.struts2.action.AccountAction", - "org.apache.archiva.redback.struts2.action.LoginAction", - "org.apache.archiva.redback.struts2.action.LogoutAction", - "org.apache.archiva.redback.struts2.action.PasswordAction", - "org.apache.archiva.redback.struts2.action.RegisterAction", - "org.apache.archiva.redback.struts2.action.admin.AdminConsoleAction", - "org.apache.archiva.redback.struts2.action.admin.SystemInfoAction"}; - - int count = 0; - - for ( int i = 0; i >= classNames.length; i++ ) - { - if ( !classExists( violations, classNames[i] ) ) - { - count++; - } - } - - if ( count > 0 ) - { - violations.add( "Missing [" + count + "] xwork Actions." ); - } - } - - private boolean classExists( List<String> violations, String className ) - { - try - { - Class.forName( className ); - - // TODO: check that class is an instance of Action? - } - catch ( ClassNotFoundException e ) - { - violations.add( "Missing xwork Action class " + quote( className ) + "." ); - return false; - } - return true; - } - - private String quote( Object o ) - { - if ( o == null ) - { - return "<null>"; - } - return "\"" + o.toString() + "\""; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkConfiguration.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkConfiguration.java deleted file mode 100644 index 21472a33f..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/checks/ExpectedXworkConfiguration.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.apache.archiva.redback.struts2.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.ArrayList; -import java.util.List; - -import org.apache.archiva.redback.system.check.EnvironmentCheck; -import org.apache.archiva.redback.integration.checks.xwork.XworkPackageConfig; - -import com.opensymphony.xwork2.config.Configuration; -import com.opensymphony.xwork2.config.ConfigurationManager; - -/** - * <p/> - * ExpectedXworkConfiguration reason for existence is to validate that the executing - * environment has everything needed for a proper execution of - * Plexus Security :: UI Web components and javascript and jsps. - * </p> - * <p/> - * <p/> - * It is quite possible for the environment overlay to have not been done. - * Such as when using <code>"mvn jetty:run"</code>, but forgetting to run - * <code>"mvn war:inplace"</code> first. - * </p> - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - * - * TODO: Address comment below and add back in the component declaration - * - */ -public class ExpectedXworkConfiguration - extends AbstractXworkConfigurationCheck - implements EnvironmentCheck -{ - public void validateEnvironment( List<String> violations ) - { - // Get the configuration. - - Configuration xworkConfig = new ConfigurationManager().getConfiguration(); - - if ( xworkConfig != null ) - { - List<String> internalViolations = new ArrayList<String>(); - - /* PLXREDBACK-67 - * TODO: this currently throws a violation since the standard practice is - * to include the xwork-security namespace in from the war overlay. Otherwise - * all actions in the security namespace are also addressable from the - * root default action lookup since by extending the security package thats how - * webwork/xwork deals with the actions - */ - XworkPackageConfig expectedPackage = new XworkPackageConfig( "/security" ); - - expectedPackage.addAction( "account", "redback-account", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "login", "redback-login", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "logout", "redback-logout", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "register", "redback-register", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "password", "redback-password", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - // ----------------------------------------------------------------- - // Security Admin Tests - - expectedPackage.addAction( "systeminfo", "redback-sysinfo", "show" ); - expectedPackage.addAction( "adminConsole", "redback-admin-console", "show" ); - - expectedPackage.addAction( "userlist", "redback-admin-user-list", "show" ).addResult( "input" ).addResult( - "success" ); - - expectedPackage.addAction( "useredit", "redback-admin-user-edit", "edit" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "usercreate", "redback-admin-user-create", "edit" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "userdelete", "redback-admin-user-delete", "confirm" ).addResult( - "input" ).addResult( "error" ).addResult( "success" ); - - expectedPackage.addAction( "assignments", "redback-assignments", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "roles", "redback-roles", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - expectedPackage.addAction( "permissions", "redback-permissions", "show" ).addResult( "input" ).addResult( - "error" ).addResult( "success" ); - - checkPackage( internalViolations, expectedPackage, xworkConfig ); - - if ( internalViolations.size() > 0 ) - { - violations.addAll( internalViolations ); - violations.add( "Missing [" + internalViolations.size() + "] xwork.xml configuration elements." ); - } - } - else - { - violations.add( "Missing xwork.xml configuration." ); - } - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AbstractHttpRequestTrackerInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AbstractHttpRequestTrackerInterceptor.java deleted file mode 100644 index 16731d5cc..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AbstractHttpRequestTrackerInterceptor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import org.apache.struts2.StrutsException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.WebApplicationContext; - -import java.util.Map; - -public abstract class AbstractHttpRequestTrackerInterceptor - extends AbstractInterceptor -{ - public static final String TRACKER_NAME = ActionInvocationTracker.class.getName( )+ ":name"; - - protected Logger logger = LoggerFactory.getLogger( getClass() ); - - protected abstract String getTrackerName(); - - @Override - public void init() - { - super.init(); - logger.info( "{} initialized!", this.getClass().getName() ); - } - - @SuppressWarnings( "unchecked" ) - protected synchronized ActionInvocationTracker addActionInvocation( ActionInvocation invocation ) - { - Map<String, Object> sessionMap = invocation.getInvocationContext().getSession(); - - ApplicationContext applicationContext = (ApplicationContext) ActionContext.getContext().getApplication().get( - WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE ); - if ( applicationContext == null ) - { - throw new StrutsException( "Could not locate ApplicationContext" ); - } - - ActionInvocationTracker tracker = (ActionInvocationTracker) sessionMap.get( ActionInvocationTracker.class.getName() ); - - if ( tracker == null ) - { - //noinspection deprecation - tracker = applicationContext.getBean( getTrackerName(), ActionInvocationTracker.class ); - sessionMap.put( ActionInvocationTracker.class.getName(), tracker ); - } - - tracker.addActionInvocation( invocation ); - - return tracker; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ActionInvocationTracker.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ActionInvocationTracker.java deleted file mode 100644 index c205e4d2f..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ActionInvocationTracker.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; - -public interface ActionInvocationTracker -{ - - static final String SESSION_KEY = ActionInvocationTracker.class.getName(); - - void setHistorySize( int size ); - - int getHistorySize(); - - int getHistoryCount(); - - SavedActionInvocation getPrevious(); - - SavedActionInvocation getCurrent(); - - SavedActionInvocation getActionInvocationAt( int index ); - - void addActionInvocation( ActionInvocation invocation ); - - void setBackTrack(); - - void unsetBackTrack(); - - boolean isBackTracked(); -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AutoLoginInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AutoLoginInterceptor.java deleted file mode 100644 index c00a4e35a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/AutoLoginInterceptor.java +++ /dev/null @@ -1,297 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import org.apache.archiva.redback.keys.AuthenticationKey; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSource; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.integration.util.AutoLoginCookies; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -import javax.inject.Inject; -import javax.servlet.http.HttpSession; - -/** - * AutoLoginInterceptor - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - */ -@Controller( "redbackAutoLoginInterceptor" ) -@Scope( "prototype" ) -public class AutoLoginInterceptor - implements Interceptor -{ - private Logger log = LoggerFactory.getLogger( AutoLoginInterceptor.class ); - - static final String PASSWORD_CHANGE = "security-must-change-password"; - - static final String ACCOUNT_LOCKED = "security-login-locked"; - - /** - * - */ - @Inject - private SecuritySystem securitySystem; - - /** - * - */ - @Inject - private AutoLoginCookies autologinCookies; - - public void destroy() - { - // Ignore - } - - public void init() - { - // Ignore - } - - /** - * @noinspection ProhibitedExceptionDeclared - */ - public String intercept( ActionInvocation invocation ) - throws Exception - { - SecuritySession securitySession = getSecuritySession(); - - if ( securitySession != null && securitySession.isAuthenticated() ) - { - // User already authenticated. - log.debug( "User already authenticated." ); - - if ( !checkCookieConsistency( securitySession ) ) - { - // update single sign on cookie - autologinCookies.setSignonCookie( securitySession.getUser().getUsername(), - ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } - } - else - { - AuthenticationKey authkey = - autologinCookies.getSignonKey( ServletActionContext.getResponse(), ServletActionContext.getRequest() ); - - if ( authkey != null ) - { - try - { - securitySession = checkAuthentication( authkey, invocation.getInvocationContext().getName().equals( - PASSWORD_CHANGE ) ); - - if ( securitySession != null && securitySession.isAuthenticated() ) - { - ActionContext.getContext().getSession().put( SecuritySystemConstants.SECURITY_SESSION_KEY, - securitySession ); - checkCookieConsistency( securitySession ); - } - else - { - autologinCookies.removeSignonCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } - } - catch ( AccountLockedException e ) - { - log.info( "Account Locked : Username [{}]", e.getUser().getUsername(), e ); - autologinCookies.removeSignonCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - return ACCOUNT_LOCKED; - } - catch ( MustChangePasswordException e ) - { - return PASSWORD_CHANGE; - } - } - else if ( autologinCookies.isRememberMeEnabled() ) - { - authkey = autologinCookies.getRememberMeKey( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - - if ( authkey != null ) - { - try - { - securitySession = checkAuthentication( authkey, false ); - - if ( securitySession == null || !securitySession.isAuthenticated() ) - { - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } - } - catch ( AccountLockedException e ) - { - log.info( "Account Locked : Username [{}]", e.getUser().getUsername(), e ); - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - return ACCOUNT_LOCKED; - } - catch ( MustChangePasswordException e ) - { - return PASSWORD_CHANGE; - } - } - } - } - - return invocation.invoke(); - } - - private boolean checkCookieConsistency( SecuritySession securitySession ) - { - String username = securitySession.getUser().getUsername(); - - boolean failed = false; - - AuthenticationKey key = - autologinCookies.getRememberMeKey( ServletActionContext.getResponse(), ServletActionContext.getRequest() ); - if ( key != null ) - { - if ( !key.getForPrincipal().equals( username ) ) - { - log.debug( "Login invalidated: remember me cookie was for{}; but session was for {}", - key.getForPrincipal(), username ); - failed = true; - } - } - - if ( !failed ) - { - key = - autologinCookies.getSignonKey( ServletActionContext.getResponse(), ServletActionContext.getRequest() ); - if ( key != null ) - { - if ( !key.getForPrincipal().equals( username ) ) - { - log.debug( "Login invalidated: signon cookie was for {}; but session was for {}", - key.getForPrincipal(), username ); - failed = true; - } - } - else - { - log.debug( "Login invalidated: signon cookie was removed" ); - failed = true; - } - } - - if ( failed ) - { - removeCookiesAndSession(); - } - - return failed; - } - - private SecuritySession checkAuthentication( AuthenticationKey authkey, boolean enforcePasswordChange ) - throws AccountLockedException, MustChangePasswordException - { - SecuritySession securitySession = null; - log.debug( "Logging in with an authentication key: {}", authkey.getForPrincipal() ); - TokenBasedAuthenticationDataSource authsource = new TokenBasedAuthenticationDataSource(); - authsource.setPrincipal( authkey.getForPrincipal() ); - authsource.setToken( authkey.getKey() ); - authsource.setEnforcePasswordChange( enforcePasswordChange ); - - try - { - securitySession = securitySystem.authenticate( authsource ); - - if ( securitySession.isAuthenticated() ) - { - // TODO: this should not happen if there is a password change required - but the password change action needs to log the user in on success to swap them - log.debug( "Login success." ); - - HttpSession session = ServletActionContext.getRequest().getSession( true ); - session.setAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - log.debug( "Setting session:{} to {}", SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - - autologinCookies.setSignonCookie( authkey.getForPrincipal(), ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - } - else - { - AuthenticationResult result = securitySession.getAuthenticationResult(); - log.info( "Login interceptor failed against principal : {}", result.getPrincipal(), - result.getException() ); - } - - } - catch ( AuthenticationException e ) - { - log.info( "Authentication Exception.", e ); - } - catch ( UserNotFoundException e ) - { - log.info( "User Not Found: {}", authkey.getForPrincipal(), e ); - } - return securitySession; - } - - private void removeCookiesAndSession() - { - autologinCookies.removeRememberMeCookie( ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - autologinCookies.removeSignonCookie( ServletActionContext.getResponse(), ServletActionContext.getRequest() ); - - HttpSession session = ServletActionContext.getRequest().getSession(); - if ( session != null ) - { - session.removeAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); - } - } - - private SecuritySession getSecuritySession() - { - HttpSession session = ServletActionContext.getRequest().getSession(); - if ( session == null ) - { - log.debug( "No HTTP Session exists." ); - return null; - } - - SecuritySession secSession = - (SecuritySession) session.getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); - log.debug( "Returning Security Session: {}", secSession ); - return secSession; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/EnvironmentCheckInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/EnvironmentCheckInterceptor.java deleted file mode 100644 index 24f13a302..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/EnvironmentCheckInterceptor.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import org.apache.archiva.redback.system.check.EnvironmentCheck; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -import javax.annotation.PostConstruct; -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.List; - -/** - * EnvironmentCheckInterceptor - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@Controller( "redbackEnvironmentCheckInterceptor" ) -@Scope( "prototype" ) -public class EnvironmentCheckInterceptor - implements Interceptor -{ - private static boolean checked = false; - - private Logger log = LoggerFactory.getLogger( EnvironmentCheckInterceptor.class ); - - - /** - * - */ - @Inject - private List<EnvironmentCheck> checkers; - - public void destroy() - { - // no-op - } - - @PostConstruct - public void init() - { - - if ( EnvironmentCheckInterceptor.checked ) - { - // No need to check twice. - return; - } - - if ( checkers != null ) - { - List<String> violations = new ArrayList<String>(); - - for ( EnvironmentCheck check : checkers ) - { - check.validateEnvironment( violations ); - } - - if ( !violations.isEmpty() ) - { - StringBuilder msg = new StringBuilder(); - msg.append( "EnvironmentCheck Failure.\n" ); - msg.append( "======================================================================\n" ); - msg.append( " ENVIRONMENT FAILURE !! \n" ); - msg.append( "\n" ); - - for ( String v : violations ) - { - msg.append( v ).append( "\n" ); - } - - msg.append( "\n" ); - msg.append( "======================================================================" ); - log.error( msg.toString() ); - } - } - - EnvironmentCheckInterceptor.checked = true; - } - - public String intercept( ActionInvocation invocation ) - throws Exception - { - // A no-op here. Work for this intereceptor is done in init(). - return invocation.invoke(); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ForceAdminUserInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ForceAdminUserInterceptor.java deleted file mode 100644 index 1dbd77b75..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/ForceAdminUserInterceptor.java +++ /dev/null @@ -1,254 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource; -import org.apache.archiva.redback.configuration.UserConfiguration; -import org.apache.archiva.redback.integration.checks.security.AdminAutoCreateCheck; -import org.apache.archiva.redback.integration.util.AutoLoginCookies; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.role.RoleManagerException; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserManager; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.struts2.ServletActionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -import javax.inject.Inject; -import javax.inject.Named; -import java.io.File; -import java.io.FileInputStream; -import java.util.Date; -import java.util.Map; -import java.util.Properties; - -/** - * EnvironmentCheckInterceptor - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - */ -@Controller( "redbackForceAdminUserInterceptor" ) -@Scope( "prototype" ) -public class ForceAdminUserInterceptor - implements Interceptor -{ - private Logger log = LoggerFactory.getLogger( getClass() ); - - private static final String SECURITY_ADMIN_USER_NEEDED = "security-admin-user-needed"; - - private static boolean checked = false; - - /** - * role-hint="configurable" - */ - @Inject - @Named( value = "userManager#configurable" ) - private UserManager userManager; - - /** - * role-hint="default" - */ - @Inject - private RoleManager roleManager; - - /** - * role-hint="default" - */ - @Inject - private UserConfiguration config; - - @Inject - protected SecuritySystem securitySystem; - - @Inject - private AutoLoginCookies autologinCookies; - - protected Map<String, Object> session; - - public void destroy() - { - // no-op - } - - public void init() - { - - } - - public String intercept( ActionInvocation invocation ) - throws Exception - { - if ( checked ) - { - return invocation.invoke(); - } - - try - { - User user = userManager.findUser( getAdminUid() ); - if ( user == null ) - { - user = useForceAdminFile(); - if ( user == null ) - { - log.info( "No admin user configured - forwarding to admin user creation page." ); - return SECURITY_ADMIN_USER_NEEDED; - } - } - - assignAdminRole( user ); - - checked = true; - log.info( "Admin user found. No need to configure admin user." ); - - } - catch ( UserNotFoundException e ) - { - User user = useForceAdminFile(); - if ( user != null ) - { - assignAdminRole( user ); - - checked = true; - } - else - { - log.info( "No admin user found - forwarding to admin user creation page." ); - return SECURITY_ADMIN_USER_NEEDED; - } - } - - return invocation.invoke(); - } - - private User useForceAdminFile() - { - try - { - String forceAdminFilePath = System.getProperty( AdminAutoCreateCheck.FORCE_ADMIN_FILE_PATH ); - if ( StringUtils.isBlank( forceAdminFilePath ) ) - { - log.info( AdminAutoCreateCheck.FORCE_ADMIN_FILE_PATH - + " system props is empty don't use an auto creation admin " ); - return null; - } - File file = new File( forceAdminFilePath ); - if ( !file.exists() ) - { - log.warn( "file set in sysprops " + AdminAutoCreateCheck.FORCE_ADMIN_FILE_PATH - + " not exists skip admin auto creation" ); - return null; - } - 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 null; - } - finally - { - IOUtils.closeQuietly( fis ); - } - - // ensure we have all properties - String password = properties.getProperty( AdminAutoCreateCheck.ADMIN_PASSWORD_KEY ); - String email = properties.getProperty( AdminAutoCreateCheck.ADMIN_EMAIL_KEY ); - String fullName = properties.getProperty( AdminAutoCreateCheck.ADMIN_FULL_NAME_KEY ); - - if ( StringUtils.isBlank( password ) ) - { - log.warn( "property " + AdminAutoCreateCheck.ADMIN_PASSWORD_KEY + " not set skip auto admin creation" ); - return null; - } - - if ( StringUtils.isBlank( email ) ) - { - log.warn( "property " + AdminAutoCreateCheck.ADMIN_EMAIL_KEY + " not set skip auto admin creation" ); - return null; - } - - if ( StringUtils.isBlank( fullName ) ) - { - log.warn( - "property " + AdminAutoCreateCheck.ADMIN_FULL_NAME_KEY + " not set skip auto admin creation" ); - return null; - } - - User u = userManager.createUser( getAdminUid(), fullName, email ); - - u.setPassword( password ); - u.setLocked( false ); - u.setPasswordChangeRequired( false ); - u.setPermanent( 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. - ServletActionContext.getRequest().getSession( true ).setAttribute( - SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - autologinCookies.setSignonCookie( authdatasource.getPrincipal(), ServletActionContext.getResponse(), - ServletActionContext.getRequest() ); - u = securitySession.getUser(); - u.setLastLoginDate( new Date() ); - securitySystem.getUserManager().updateUser( u ); - } - - return u; - } - catch ( Exception e ) - { - log.warn( "failed to automatically create an admin account " + e.getMessage(), e ); - } - return null; - } - - private String getAdminUid() - { - return config.getString( "redback.default.admin" ); - } - - private void assignAdminRole( User user ) - throws RoleManagerException - { - roleManager.assignRole( "system-administrator", user.getPrincipal().toString() ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/PolicyEnforcementInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/PolicyEnforcementInterceptor.java deleted file mode 100644 index 7b74b2c55..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/PolicyEnforcementInterceptor.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.apache.archiva.redback.struts2.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.Calendar; -import java.util.Map; - -import javax.inject.Inject; -import javax.servlet.http.HttpServletRequest; - -import org.apache.archiva.redback.configuration.UserConfiguration; -import org.apache.archiva.redback.users.UserManager; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.policy.UserSecurityPolicy; -import org.apache.archiva.redback.system.DefaultSecuritySession; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.User; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -/** - * Interceptor to force the user to perform actions, when required. - * - * @author Edwin Punzalan - */ -@Controller( "redbackPolicyEnforcementInterceptor" ) -@Scope( "prototype" ) -public class PolicyEnforcementInterceptor - implements Interceptor -{ - private Logger log = LoggerFactory.getLogger( PolicyEnforcementInterceptor.class ); - - private static final String SECURITY_USER_MUST_CHANGE_PASSWORD = "security-must-change-password"; - - /** - * - */ - @Inject - private UserConfiguration config; - - /** - * - */ - @Inject - protected SecuritySystem securitySystem; - - public void destroy() - { - //ignore - } - - public void init() - { - //ignore - } - - /** - * 1) validate that the user doesn't have to change their password, if they do then re-route accordingly - * - * @param actionInvocation - * @return - * @throws Exception - */ - @SuppressWarnings("unchecked") - public String intercept( ActionInvocation actionInvocation ) - throws Exception - { - - if ( config.getBoolean( "security.policy.strict.enforcement.enabled" ) ) - { - log.debug( "Enforcement: enforcing per click security policies." ); - - - ActionContext context = ActionContext.getContext(); - - SecuritySession securitySession = null; - - try - { - securitySession = (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY ); - } - catch (IllegalStateException e) - { - log.debug("Could not get security session as the session was invalid", e); - } - - UserSecurityPolicy policy = securitySystem.getPolicy(); - - if ( securitySession != null ) - { - UserManager userManager = securitySystem.getUserManager(); - User user = userManager.findUser( securitySession.getUser().getPrincipal() ); - securitySession = new DefaultSecuritySession( securitySession.getAuthenticationResult(), user ); - context.getSession().put( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - } - else - { - log.debug( "Enforcement: no user security session detected, skipping enforcement" ); - return actionInvocation.invoke(); - } - - if ( checkForcePasswordChange( securitySession, actionInvocation ) ) - { - Map<String, Object> session = ServletActionContext.getContext().getSession(); - HttpServletRequest request = ServletActionContext.getRequest(); - - String queryString = request.getQueryString(); - String targetUrl = request.getRequestURL() + ( queryString==null ? "" : "?" + queryString ); - - session.put( "targetUrl", targetUrl ); - - log.info( "storing targetUrl : {}", targetUrl ); - - return SECURITY_USER_MUST_CHANGE_PASSWORD; - } - - if ( config.getBoolean( "security.policy.password.expiration.enabled" ) ) - { - log.debug( "checking password expiration notification" ); - - UserManager userManager = securitySystem.getUserManager(); - User user = userManager.findUser( securitySession.getUser().getPrincipal() ); - - Calendar expirationNotifyDate = Calendar.getInstance(); - expirationNotifyDate.setTime( user.getLastPasswordChange() ); - // add on the total days to expire minus the notification days - expirationNotifyDate.add( Calendar.DAY_OF_MONTH, policy.getPasswordExpirationDays() - config.getInt( "security.policy.password.expiration.notify.days" ) ); - - Calendar now = Calendar.getInstance(); - - if ( now.after( expirationNotifyDate ) ) - { - log.debug( "setting password expiration notification" ); - - Calendar expirationDate = Calendar.getInstance(); - expirationDate.setTime( user.getLastPasswordChange() ); - expirationDate.add( Calendar.DAY_OF_MONTH, policy.getPasswordExpirationDays() ); - Map<String, Object> session = ServletActionContext.getContext().getSession(); - session.put( "passwordExpirationNotification", expirationDate.getTime().toString() ); - } - } - - return actionInvocation.invoke(); - } - else - { - log.debug( "Enforcement: not processing per click security policies." ); - return actionInvocation.invoke(); - } - } - - private boolean checkForcePasswordChange( SecuritySession securitySession, ActionInvocation actionInvocation ) - { - /* - * FIXME: something less 'hackish' - * - * these two classes should not be subject to this enforcement policy and this - * ideally should be governed by the interceptor stacks but that just didn't work - * when I was trying to solve the problem that way, psquad32 recommended I just - * find a way to get around this interceptor in the particular case I needed to and use - * "One stack to rule them all - */ - if ( "org.apache.archiva.redback.struts2.action.PasswordAction".equals( actionInvocation.getAction().getClass().getName() ) ) - { - log.debug( "Enforcement: skipping force password check on password action" ); - return false; - } - - if ( "org.apache.archiva.redback.struts2.action.LoginAction".equals( actionInvocation.getAction().getClass().getName() ) ) - { - log.debug( "Enforcement: skipping force password check on login action" ); - return false; - } - - if ( "org.apache.archiva.redback.struts2.action.LogoutAction".equals( actionInvocation.getAction().getClass().getName() ) ) - { - log.debug( "Enforcement: skipping force password check on logout action" ); - return false; - } - - if ( config.getBoolean( "security.policy.strict.force.password.change.enabled" ) ) - { - log.debug( "Enforcement: checking active user password change enabled" ); - - if ( securitySession.getUser().isPasswordChangeRequired() ) - { - log.info( "Enforcement: User must change password - forwarding to change password page." ); - - return true; - } - else - { - log.debug( "Enforcement: User doesn't need to change password." ); - } - } - return false; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SavedActionInvocation.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SavedActionInvocation.java deleted file mode 100644 index 3aae283e1..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SavedActionInvocation.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; - -import java.util.HashMap; -import java.util.Map; - -public class SavedActionInvocation -{ - private String namespace; - - private String actionName; - - private Map<String, Object> parameterMap; - - private String methodName; - - @SuppressWarnings("unchecked") - public SavedActionInvocation( ActionInvocation invocation ) - { - namespace = invocation.getProxy().getNamespace(); - actionName = invocation.getProxy().getActionName(); - methodName = invocation.getProxy().getMethod(); - - parameterMap = new HashMap<String, Object>(); - - parameterMap.putAll( invocation.getInvocationContext().getParameters() ); - } - - public String getNamespace() - { - return namespace; - } - - public String getActionName() - { - return actionName; - } - - public Map<String,Object> getParametersMap() - { - return parameterMap; - } - - public String getMethodName() - { - return methodName; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SecureActionInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SecureActionInterceptor.java deleted file mode 100644 index 9454c963b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SecureActionInterceptor.java +++ /dev/null @@ -1,300 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.google.common.collect.Lists; -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionInvocation; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.SystemUtils; -import org.apache.struts2.ServletActionContext; -import org.apache.archiva.redback.authorization.AuthorizationResult; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.system.SecuritySystemConstants; -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 javax.inject.Inject; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSession; -import java.util.List; - -/** - * SecureActionInterceptor: Interceptor that will detect webwork actions that implement the SecureAction - * interface and providing they do verify that the current user is authorized to execute the action - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * @author Jesse McConnell <jesse@codehaus.org> - * - */ -@Controller( "redbackSecureActionInterceptor" ) -@Scope( "prototype" ) -public class SecureActionInterceptor - extends AbstractHttpRequestTrackerInterceptor -{ - private static final String REQUIRES_AUTHORIZATION = "requires-authorization"; - - private static final String REQUIRES_AUTHENTICATION = "requires-authentication"; - - private static final String HTTP_HEADER_REFERER = "Referer"; - - /** - * - */ - @Inject - private SecuritySystem securitySystem; - - /** - * - */ - private String trackerName = "simple"; - - private String enableReferrerCheck; - - @Override - public void destroy() - { - // noop - } - - - /** - * process the action to determine if it implements SecureAction and then act - * accordingly - * - * @param invocation - * @return - * @throws Exception - */ - @Override - public String intercept( ActionInvocation invocation ) - throws Exception - { - ActionContext context = ActionContext.getContext(); - - Action action = (Action) context.getActionInvocation().getAction(); - - logger.debug( "SecureActionInterceptor: processing {}", action.getClass().getName() ); - - if ( Boolean.valueOf( enableReferrerCheck ) ) - { - logger.debug( "Referrer security check enabled." ); - executeReferrerSecurityCheck(); - } - - try - { - if ( action instanceof SecureAction ) - { - SecureAction secureAction = (SecureAction) action; - SecureActionBundle bundle = secureAction.getSecureActionBundle(); - - if ( bundle == null ) - { - logger.error( "Null bundle detected." ); - - // TODO: send them somewhere else? - return invocation.invoke(); - } - - if ( bundle == SecureActionBundle.OPEN ) - { - logger.debug( "Bundle.OPEN detected." ); - - return invocation.invoke(); - } - - SecuritySession session = - (SecuritySession) context.getSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY ); - - // check the authentication requirements - if ( bundle.requiresAuthentication() ) - { - if ( session == null || !session.isAuthenticated() ) - { - logger.debug( "not authenticated, need to authenticate for this action" ); - return processRequiresAuthentication( invocation ); - } - } - - List<SecureActionBundle.AuthorizationTuple> authzTuples = bundle.getAuthorizationTuples(); - - // if operations are returned we need to perform authorization checks - if ( authzTuples != null && authzTuples.size() > 0 ) - { - // authn adds a session, if there is no session they are not authorized and authn is required for - // authz, even if it is just a guest user - if ( session == null ) - { - logger.debug( "session required for authorization to run" ); - return processRequiresAuthentication( invocation ); - } - - for ( SecureActionBundle.AuthorizationTuple tuple : authzTuples ) - { - logger.debug( "checking authz for {}", tuple.toString() ); - - AuthorizationResult authzResult = - securitySystem.authorize( session, tuple.getOperation(), tuple.getResource() ); - - logger.debug( "checking the interceptor authz {} for {}", authzResult.isAuthorized(), - tuple.toString() ); - - if ( authzResult.isAuthorized() ) - { - if ( logger.isDebugEnabled() ) - { - logger.debug( "{} is authorized for action {} by {}", - Lists.<Object>newArrayList( session.getUser().getPrincipal(), - secureAction.getClass().getName(), - tuple.toString() ) ); - } - return invocation.invoke(); - } - } - - return processRequiresAuthorization( invocation ); - } - } - else - { - logger.debug( "SecureActionInterceptor: {} not a secure action", action.getClass().getName() ); - } - } - catch ( SecureActionException se ) - { - logger.error( "can't generate the SecureActionBundle, deny access: " + se.getMessage() ); - return processRequiresAuthentication( invocation ); - } - - logger.debug( "not a secure action {}", action.getClass().getName() ); - String result = invocation.invoke(); - logger.debug( "Passing invocation up, result is [{}] on call {}", result, - invocation.getAction().getClass().getName() ); - return result; - } - - private void executeReferrerSecurityCheck() - { - String referrer = ServletActionContext.getRequest().getHeader( HTTP_HEADER_REFERER ); - - logger.debug( "HTTP Referer header: {}", referrer ); - - String[] tokens = StringUtils.splitPreserveAllTokens( referrer, "/", 3 ); - - if ( tokens != null ) - { - String path; - if ( tokens.length < 3 ) - { - path = referrer; - } - else - { - path = tokens[tokens.length - 1]; - } - - logger.debug( "Calculated virtual path: {}", path ); - - ServletContext servletContext = ServletActionContext.getServletContext(); - - String realPath = servletContext.getRealPath( path ); - - if ( StringUtils.isNotEmpty( realPath ) ) - { - // on windows realPath can return full path c:\\bla\\bla\.... - // so transforming \\ to / - if ( SystemUtils.IS_OS_WINDOWS ) - { - realPath = StringUtils.replace( realPath, "\\", "/" ); - } - if ( !realPath.endsWith( path ) ) - { - String errorMsg = "Failed referrer security check: Request did not come from the same server. " - + "Detected HTTP Referer header is '" + referrer + "'."; - logger.error( errorMsg ); - throw new RuntimeException( errorMsg ); - } - else - { - logger.debug( "HTTP Referer header path found in server." ); - } - } - } - else - { - logger.warn( "HTTP Referer header is null." ); - } - } - - protected String processRequiresAuthorization( ActionInvocation invocation ) - { - addActionInvocation( invocation ).setBackTrack(); - return REQUIRES_AUTHORIZATION; - } - - protected String processRequiresAuthentication( ActionInvocation invocation ) - { - HttpSession session = ServletActionContext.getRequest().getSession(); - - if ( session != null ) - { - session.removeAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY ); - } - - addActionInvocation( invocation ).setBackTrack(); - return REQUIRES_AUTHENTICATION; - } - - public SecuritySystem getSecuritySystem() - { - return securitySystem; - } - - public void setSecuritySystem( SecuritySystem securitySystem ) - { - this.securitySystem = securitySystem; - } - - protected String getTrackerName() - { - return trackerName; - } - - public String getEnableReferrerCheck() - { - return enableReferrerCheck; - } - - public void setEnableReferrerCheck( String enableReferrerCheck ) - { - this.enableReferrerCheck = enableReferrerCheck; - } - - public void setTrackerName( String trackerName ) - { - this.trackerName = trackerName; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTracker.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTracker.java deleted file mode 100644 index fabebf44b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTracker.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - -import java.util.Stack; - -/** - * - */ -@Controller( "simple" ) -@Scope( "prototype" ) -public class SimpleActionInvocationTracker - implements ActionInvocationTracker -{ - /** - * - */ - private int historySize = 5; - - private boolean backTrack; - - private Stack<SavedActionInvocation> actionInvocationStack = new Stack<SavedActionInvocation>(); - - public void setHistorySize( int size ) - { - this.historySize = size; - } - - public int getHistorySize() - { - return this.historySize; - } - - public int getHistoryCount() - { - return actionInvocationStack.size(); - } - - /** - * returns the previous actioninvocation and dropping the current one - */ - public SavedActionInvocation getPrevious() - { - if ( actionInvocationStack.size() > 1 ) - { - // drop the current SavedActionInvocation - actionInvocationStack.pop(); - return (SavedActionInvocation) actionInvocationStack.pop(); - } - - return null; - } - - /** - * return the current action invocation - */ - public SavedActionInvocation getCurrent() - { - if ( actionInvocationStack.size() > 0 ) - { - return (SavedActionInvocation) actionInvocationStack.pop(); - } - - return null; - } - - /** - * returns the actioninvocation at the specified index, preserving - * the actioninvocation list - */ - public SavedActionInvocation getActionInvocationAt( int index ) - { - if ( actionInvocationStack.size() >= index ) - { - return (SavedActionInvocation) actionInvocationStack.get( index ); - } - - return null; - } - - public void addActionInvocation( ActionInvocation invocation ) - { - actionInvocationStack.push( new SavedActionInvocation( invocation ) ); - - // remove oldest action invocation - if ( actionInvocationStack.size() > historySize ) - { - actionInvocationStack.remove( 0 ); - } - } - - public void setBackTrack() - { - backTrack = true; - } - - public void unsetBackTrack() - { - backTrack = false; - } - - public boolean isBackTracked() - { - return backTrack; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/model/ApplicationRoleDetails.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/model/ApplicationRoleDetails.java deleted file mode 100644 index 34e948258..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/model/ApplicationRoleDetails.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.apache.archiva.redback.struts2.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.Role; -import org.apache.archiva.redback.role.model.ModelApplication; -import org.apache.archiva.redback.role.model.ModelRole; -import org.apache.archiva.redback.role.model.ModelTemplate; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -/** - * @todo incredibly ugly population of the table, needs to be more concise - */ -public class ApplicationRoleDetails -{ - private String name; - - private String description; - - private List<String> assignedRoles; - - private List<String> availableRoles; - - private List<ModelTemplate> tableHeader; - - private List<List<RoleTableCell>> table; - - @SuppressWarnings( "unchecked" ) - public ApplicationRoleDetails( ModelApplication application, Collection<Role> effectivelyAssignedRoles, - Collection<Role> allAssignedRoles, List<Role> assignableRoles ) - { - name = application.getId(); - description = application.getDescription(); - - List<ModelTemplate> templates = application.getTemplates(); - List<ModelRole> roles = application.getRoles(); - - tableHeader = new LinkedList<ModelTemplate>( templates ); - - computeRoles( roles, assignableRoles, effectivelyAssignedRoles, allAssignedRoles ); - - computeTable( gatherResources( templates, assignableRoles ), effectivelyAssignedRoles, allAssignedRoles ); - } - - public String getName() - { - return name; - } - - public String getDescription() - { - return description; - } - - public List<String> getAssignedRoles() - { - return assignedRoles; - } - - public List<String> getAvailableRoles() - { - return availableRoles; - } - - public List<ModelTemplate> getTableHeader() - { - return tableHeader; - } - - public List<List<RoleTableCell>> getTable() - { - return table; - } - - private void computeRoles( Collection<ModelRole> applicationRoles, Collection<Role> assignableRoles, - Collection<Role> effectivelyAssignedRoles, Collection<Role> allAssignedRoles ) - { - assignedRoles = new ArrayList<String>(); - availableRoles = new ArrayList<String>(); - for ( Iterator<ModelRole> i = applicationRoles.iterator(); i.hasNext(); ) - { - ModelRole role = i.next(); - - if ( isInList( role.getName(), allAssignedRoles ) ) - { - if ( role.isAssignable() ) - { - assignedRoles.add( role.getName() ); - } - } - else if ( isInList( role.getName(), effectivelyAssignedRoles ) ) - { - // nothing - } - else if ( isInList( role.getName(), assignableRoles ) ) - { - if ( role.isAssignable() ) - { - availableRoles.add( role.getName() ); - } - } - } - - Collections.sort( assignedRoles, String.CASE_INSENSITIVE_ORDER ); - Collections.sort( availableRoles, String.CASE_INSENSITIVE_ORDER ); - } - - private Set<String> gatherResources( List<ModelTemplate> applicationTemplates, List<Role> roles ) - { - Set<String> resources = new HashSet<String>(); - for ( ModelTemplate modelTemplate : applicationTemplates ) - { - for ( Role role : roles ) - { - String roleName = role.getName(); - if ( roleName.startsWith( modelTemplate.getNamePrefix() ) ) - { - String delimiter = modelTemplate.getDelimiter(); - resources.add( roleName.substring( roleName.indexOf( delimiter ) + delimiter.length() ) ); - } - } - } - return resources; - } - - private void computeTable( Collection<String> resources, Collection<Role> effectivelyAssignedRoles, - Collection<Role> allAssignedRoles ) - { - table = new LinkedList<List<RoleTableCell>>(); - - List<String> resourcesList = new ArrayList<String>( resources ); - Collections.sort( resourcesList, String.CASE_INSENSITIVE_ORDER ); - - for ( String resource : resourcesList ) - { - LinkedList<RoleTableCell> tableRow = new LinkedList<RoleTableCell>(); - - RoleTableCell resourceCell = new RoleTableCell(); - resourceCell.setName( resource ); - resourceCell.setLabel( true ); - tableRow.add( resourceCell ); - - for ( ModelTemplate modelTemplate : tableHeader ) - { - RoleTableCell cell = new RoleTableCell(); - - cell.setName( modelTemplate.getNamePrefix() + modelTemplate.getDelimiter() + resource ); - cell.setEffectivelyAssigned( isInList( cell.getName(), effectivelyAssignedRoles ) ); - cell.setAssigned( isInList( cell.getName(), allAssignedRoles ) ); - cell.setLabel( false ); - - tableRow.add( cell ); - } - - table.add( tableRow ); - } - } - - private boolean isInList( String roleName, Collection<Role> effectivelyAssignedRoles ) - { - for ( Role role : effectivelyAssignedRoles ) - { - if ( roleName.equals( role.getName() ) ) - { - return true; - } - } - return false; - } - - public class RoleTableCell - { - private String name; - - private boolean effectivelyAssigned; - - private boolean assigned; - - private boolean label; - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - public boolean isEffectivelyAssigned() - { - return effectivelyAssigned; - } - - public void setEffectivelyAssigned( boolean effectivelyAssigned ) - { - this.effectivelyAssigned = effectivelyAssigned; - } - - public boolean isAssigned() - { - return assigned; - } - - public void setAssigned( boolean assigned ) - { - this.assigned = assigned; - } - - public boolean isLabel() - { - return label; - } - - public void setLabel( boolean label ) - { - this.label = label; - } - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/AbstractBackTrackingResult.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/AbstractBackTrackingResult.java deleted file mode 100644 index bcb572083..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/AbstractBackTrackingResult.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.archiva.redback.struts2.result; - -/* - * 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.Map; -import java.util.Set; - -import org.apache.archiva.redback.struts2.interceptor.SavedActionInvocation; -import org.apache.struts2.dispatcher.ServletActionRedirectResult; -import org.apache.archiva.redback.struts2.interceptor.ActionInvocationTracker; -import com.opensymphony.xwork2.ActionInvocation; - -@SuppressWarnings("serial") -public class AbstractBackTrackingResult - extends ServletActionRedirectResult -{ - public static final int PREVIOUS = 1; - - public static final int CURRENT = 2; - - protected boolean setupBackTrackPrevious( ActionInvocation invocation ) - { - return setupBackTrack( invocation, PREVIOUS ); - } - - protected boolean setupBackTrackCurrent( ActionInvocation invocation ) - { - return setupBackTrack( invocation, CURRENT ); - } - - @SuppressWarnings("unchecked") - protected boolean setupBackTrack( ActionInvocation invocation, int order ) - { - Map session = invocation.getInvocationContext().getSession(); - ActionInvocationTracker tracker = (ActionInvocationTracker) session.get( ActionInvocationTracker.SESSION_KEY ); - - if ( tracker != null && tracker.isBackTracked() ) - { - SavedActionInvocation savedInvocation; - - if ( order == PREVIOUS ) - { - savedInvocation = tracker.getPrevious(); - } - else - { - savedInvocation = tracker.getCurrent(); - } - - if ( savedInvocation != null ) - { - setNamespace( savedInvocation.getNamespace() ); - setActionName( savedInvocation.getActionName() ); - setMethod( savedInvocation.getMethodName() ); - - invocation.getInvocationContext().getParameters().clear(); - invocation.getInvocationContext().getParameters().putAll( savedInvocation.getParametersMap() ); - - // hack for REDBACK-188 - String resultCode = invocation.getResultCode(); - - if( resultCode != null ) - { - // hack for REDBACK-262 - // set this to null so the ResultConfig parameters won't be added in the ServletActionRedirectResult - // because we can't clear the parameters of ResultConfig since it's read-only - invocation.setResultCode( null ); - - Set<String> keys = savedInvocation.getParametersMap().keySet(); - - for( String key : keys ) - { - if ( !getProhibitedResultParams().contains( key ) ) - { - String value = ( (String[]) savedInvocation.getParametersMap().get( key ) )[0]; - if ( value != null && value.length() > 0 ) - { - addParameter( key, conditionalParse( value, invocation ) ); - } - } - } - } - - tracker.unsetBackTrack(); - } - - return true; - } - - return false; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/SecurityExternalResult.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/SecurityExternalResult.java deleted file mode 100644 index 3964ee168..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/apache/archiva/redback/struts2/result/SecurityExternalResult.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.archiva.redback.struts2.result; - -/* - * 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 com.opensymphony.xwork2.ActionInvocation; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Controller; - - -/** - * SecurityExternalResult - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@SuppressWarnings( "serial" ) -@Controller( "securityExternalResult" ) -@Scope( "prototype" ) -public class SecurityExternalResult - extends AbstractBackTrackingResult -{ - /** - * - */ - private String externalActionName = "redbackRedirect"; - - private String externalResult; - - @Override - public void execute( ActionInvocation invocation ) - throws Exception - { - // the login redirection is not captured by the http request - // tracker, so we backtrack to the current request - if ( !setupBackTrackCurrent( invocation ) ) - { - setNamespace( "/" ); - setActionName( externalActionName ); - } - - super.execute( invocation ); - } - - public String getExternalResult() - { - return externalResult; - } - - public void setExternalResult( String externalResult ) - { - this.externalResult = externalResult; - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/META-INF/spring-context.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/META-INF/spring-context.xml deleted file mode 100644 index 6f93d0d47..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/META-INF/spring-context.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> - -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" - default-lazy-init="true"> - - <context:annotation-config /> - <context:component-scan - base-package="org.apache.archiva.redback.struts2"/> - -</beans>
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/apache/archiva/redback/struts2/action/NewUserAction-validation.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/apache/archiva/redback/struts2/action/NewUserAction-validation.xml deleted file mode 100644 index 51c02fabb..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/apache/archiva/redback/struts2/action/NewUserAction-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" ?> - -<!-- - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> - -<validators> - <field name="username"> - <field-validator type="requiredstring"> - <message>You must provide a user name.</message> - </field-validator> - </field> - - <field name="fullName"> - <field-validator type="requiredstring"> - <message>You must provide your full name.</message> - </field-validator> - </field> - - <field name="email"> - <field-validator type="required"> - <message>You must provide your email address.</message> - </field-validator> - <field-validator type="email"> - <message>The email address you entered is invalid.</message> - </field-validator> - </field> - - <field name="password"> - <field-validator type="expression"> - <param name="expression">passaword.equals(passwordConfirm)</param> - <message>Passwords are not the same.</message> - </field-validator> - </field> -</validators>
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/extremecomponents/table/resource/extremetableResourceBundle_fr_FR.properties b/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/extremecomponents/table/resource/extremetableResourceBundle_fr_FR.properties deleted file mode 100644 index 18f18b94e..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/main/resources/org/extremecomponents/table/resource/extremetableResourceBundle_fr_FR.properties +++ /dev/null @@ -1,44 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -statusbar.resultsFound={0} résultats trouvés, affichage de {1} à {2} -statusbar.noResultsFound=Aucun résultat n'a été trouvé. - -toolbar.tooltip.firstPage=Première Page -toolbar.tooltip.lastPage=Dernière Page -toolbar.tooltip.prevPage=Page précédente -toolbar.tooltip.nextPage=Page suivante -toolbar.tooltip.filter=Filtrer -toolbar.tooltip.clear=Effacer - -column.headercell.tooltip.sort=Trier par - - -toolbar.tooltip.xls=Export XLS -toolbar.tooltip.pdf=Export PDF -toolbar.tooltip.csv=Export CSV -toolbar.tooltip.xml=Export XML - -toolbar.text.firstPage=Premi\u00e8re -toolbar.text.lastPage=Derni\u00e8re -toolbar.text.nextPage=Suivante -toolbar.text.prevPage=Pr\u00e9c\u00e9dente -toolbar.text.filter=Filter -toolbar.text.clear=Effacer -toolbar.text.xls=XLS -toolbar.text.pdf=PDF -toolbar.text.csv=CSV -toolbar.text.xml=XML - -column.calc.total=Total -column.calc.average=Moyenne diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionContextStub.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionContextStub.java deleted file mode 100644 index 1983b5faf..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionContextStub.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.archiva.redback.struts2; - -/* - * 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 com.opensymphony.xwork2.ActionContext; - -import java.util.HashMap; - -public class ActionContextStub - extends ActionContext -{ - public static final String CONTEXT_NAME = "context_name"; - - public static final String PARAMETER_1 = "parameter_1"; - - public static final String PARAMETER_2 = "parameter_2"; - - public static final String PARAMETER_3 = "parameter_3"; - - public static final String VALUE_1 = "value_1"; - - public static final String VALUE_2 = "value_2"; - - public static final String VALUE_3 = "value_3"; - - @SuppressWarnings("unchecked") - public ActionContextStub() - { - super( new HashMap() ); - this.setName( CONTEXT_NAME ); - this.setSession( new HashMap() ); - - this.setParameters( new HashMap<String,Object>() ); - this.getParameters().put( PARAMETER_1, VALUE_1 ); - this.getParameters().put( PARAMETER_2, VALUE_2 ); - this.getParameters().put( PARAMETER_3, VALUE_3 ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionInvocationStub.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionInvocationStub.java deleted file mode 100644 index 28efa64ef..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionInvocationStub.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.apache.archiva.redback.struts2; - -/* - * 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 com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.ActionEventListener; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.Result; -import com.opensymphony.xwork2.interceptor.PreResultListener; -import com.opensymphony.xwork2.util.ValueStack; - -/** - * @noinspection ProhibitedExceptionDeclared - */ -public class ActionInvocationStub - implements ActionInvocation -{ - private ActionContext actionContext = new ActionContextStub(); - - private ActionProxy actionProxy = new ActionProxyStub(); - - public ActionInvocationStub() - { - actionContext.setActionInvocation( this ); - } - - public Object getAction() - { - return null; - } - - public boolean isExecuted() - { - return false; - } - - public ActionContext getInvocationContext() - { - return actionContext; - } - - public ActionProxy getProxy() - { - return actionProxy; - } - - public Result getResult() - throws Exception - { - return null; - } - - public String getResultCode() - { - return null; - } - - public void setResultCode( String code ) - { - - } - - public ValueStack getStack() - { - return null; - } - - public void addPreResultListener( PreResultListener listener ) - { - - } - - public String invoke() - throws Exception - { - return null; - } - - public String invokeActionOnly() - throws Exception - { - return null; - } - - public void setActionEventListener(ActionEventListener arg0) { - - } - - public void init(ActionProxy arg0) { - - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionProxyStub.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionProxyStub.java deleted file mode 100644 index 559d98ed3..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/ActionProxyStub.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.apache.archiva.redback.struts2; - -/* - * 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 com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.ActionProxy; -import com.opensymphony.xwork2.config.entities.ActionConfig; - -public class ActionProxyStub - implements ActionProxy -{ - public static final String ACTION_NAME = "stub_action"; - - public static final String NAMESPACE = "namespace"; - - public static final String METHOD = "method"; - - private String methodName; - - private String actionName; - - public Object getAction() - { - return null; - } - - public void setActionName( String name ) - { - actionName = name; - } - - public void prepare() throws Exception - { - //Do nothing - } - - public String getActionName() - { - if ( actionName != null ) - { - return actionName; - } - else - { - return ACTION_NAME; - } - } - - public ActionConfig getConfig() - { - return null; - } - - public void setExecuteResult( boolean result ) - { - - } - - public boolean getExecuteResult() - { - return false; - } - - public ActionInvocation getInvocation() - { - return null; - } - - public String getNamespace() - { - return NAMESPACE; - } - - public String execute() - { - return null; - } - - public void setMethod( String name ) - { - methodName = name; - } - - public String getMethod() - { - if ( methodName != null ) - { - return methodName; - } - else - { - return METHOD; - } - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/LoginActionTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/LoginActionTest.java deleted file mode 100644 index 51817b3d2..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/LoginActionTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.apache.archiva.redback.struts2.action; - -/* - * 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 static org.easymock.EasyMock.anyObject; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import java.util.HashMap; - -import org.apache.archiva.redback.policy.DefaultUserSecurityPolicy; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.policy.UserSecurityPolicy; -import org.apache.archiva.redback.policy.UserValidationSettings; -import org.apache.archiva.redback.struts2.action.LoginAction; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.authentication.AuthenticationDataSource; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.system.DefaultSecuritySession; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; - -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.XWorkTestCase; - -public class LoginActionTest - extends XWorkTestCase -{ - - LoginAction action; - - protected void setUp() - throws Exception - { - super.setUp(); - action = new LoginAction(); - action.session = new HashMap<String, Object>(); - } - - public void testRedback265() - throws SecurityException, NoSuchMethodException, AccountLockedException, MustChangePasswordException, - AuthenticationException, UserNotFoundException - { - String principal = "authenticates_but_does_not_exist"; - - // Setup authentication success, with no user found - AuthenticationResult result = new AuthenticationResult( true, principal, null ); - SecuritySession session = new DefaultSecuritySession( result ); - UserSecurityPolicy policy = new DefaultUserSecurityPolicy(); - - SecuritySystem system = createMock( SecuritySystem.class ); - UserValidationSettings validationSettings = createMock( UserValidationSettings.class ); - expect( system.authenticate( (AuthenticationDataSource) anyObject() ) ).andReturn( session ); - expect( system.getPolicy() ).andReturn( policy ).anyTimes(); - expect( validationSettings.isEmailValidationRequired() ).andReturn( true ).anyTimes(); - - // Hook-up action to mock objects - action.securitySystem = system; - action.setUsername( principal ); - - replay( system, validationSettings ); - - String actionResult = action.login(); - - verify( system, validationSettings ); - - assertEquals( Action.ERROR, actionResult ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AbstractUserCredentialsActionTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AbstractUserCredentialsActionTest.java deleted file mode 100644 index e99fdf747..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AbstractUserCredentialsActionTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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 net.sf.ehcache.CacheManager; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.rbac.RBACManager; -import org.apache.archiva.redback.rbac.RbacObjectInvalidException; -import org.apache.archiva.redback.role.RoleManager; -import org.apache.archiva.redback.struts2.action.AbstractUserCredentialsAction; -import org.apache.archiva.redback.users.UserManager; -import org.apache.struts2.StrutsSpringTestCase; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.rbac.UserAssignment; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystem; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.users.memory.SimpleUser; -import org.junit.After; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import java.util.Collections; - -@RunWith( JUnit4.class ) -public abstract class AbstractUserCredentialsActionTest - extends StrutsSpringTestCase -{ - protected static final String PASSWORD = "password1"; - - //@Inject - //@Named( value = "rBACManager#memory" ) - protected RBACManager rbacManager; - - //@Inject - private RoleManager roleManager; - - //@Inject - protected SecuritySystem system; - - protected SecuritySession session; - - @Override - protected String[] getContextLocations() - { - return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" }; - } - - @Before - public void setUp() - throws Exception - { - CacheManager.getInstance().clearAll(); - super.setUp(); - - rbacManager = applicationContext.getBean( "rBACManager#memory" , RBACManager.class ); - roleManager = applicationContext.getBean( RoleManager.class ); - system = applicationContext.getBean( SecuritySystem.class ); - - - roleManager.loadRoleModel( getClass().getResource( "/redback.xml" ) ); - roleManager.createTemplatedRole( "project-administrator", "default" ); - roleManager.createTemplatedRole( "project-administrator", "other" ); - roleManager.createTemplatedRole( "project-grant-only", "default" ); - - UserManager userManager = system.getUserManager(); - - User user = new SimpleUser(); - user.setUsername( "user" ); - user.setPassword( PASSWORD ); - userManager.addUserUnchecked( user ); - - user = new SimpleUser(); - user.setUsername( "user2" ); - user.setPassword( PASSWORD ); - userManager.addUserUnchecked( user ); - - user = new SimpleUser(); - user.setUsername( "user3" ); - user.setPassword( PASSWORD ); - userManager.addUserUnchecked( user ); - - user = new SimpleUser(); - user.setUsername( "admin" ); - user.setPassword( PASSWORD ); - userManager.addUserUnchecked( user ); - - user = new SimpleUser(); - user.setUsername( "user-admin" ); - user.setPassword( PASSWORD ); - userManager.addUserUnchecked( user ); - - UserAssignment assignment = rbacManager.createUserAssignment( "admin" ); - assignment.addRoleName( "System Administrator" ); - rbacManager.saveUserAssignment( assignment ); - - assignment = rbacManager.createUserAssignment( "user-admin" ); - assignment.addRoleName( "User Administrator" ); - rbacManager.saveUserAssignment( assignment ); - - assignment = rbacManager.createUserAssignment( "user2" ); - rbacManager.saveUserAssignment( assignment ); - } - - @After - public void after() - { - CacheManager.getInstance().clearAll(); - } - - protected void addAssignment( String principal, String roleName ) - throws RbacManagerException, RbacObjectInvalidException - { - UserAssignment assignment; - - if ( rbacManager.userAssignmentExists( principal ) ) - { - assignment = rbacManager.getUserAssignment( principal ); - } - else - { - assignment = rbacManager.createUserAssignment( principal ); - } - assignment.addRoleName( roleName ); - rbacManager.saveUserAssignment( assignment ); - } - - protected void login( AbstractUserCredentialsAction action, String principal, String password ) - throws AuthenticationException, UserNotFoundException, AccountLockedException, MustChangePasswordException - { - PasswordBasedAuthenticationDataSource authdatasource = new PasswordBasedAuthenticationDataSource(); - authdatasource.setPrincipal( principal ); - authdatasource.setPassword( password ); - session = system.authenticate( authdatasource ); - assertTrue( session.isAuthenticated() ); - - action.setSession( Collections.singletonMap( SecuritySystemConstants.SECURITY_SESSION_KEY, (Object) session ) ); - } - -}
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsActionTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsActionTest.java deleted file mode 100644 index a2c4f5796..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/AssignmentsActionTest.java +++ /dev/null @@ -1,737 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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 com.google.common.collect.Lists; -import com.opensymphony.xwork2.Action; -import com.opensymphony.xwork2.ActionProxy; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.rbac.RbacObjectInvalidException; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.authorization.AuthorizationResult; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.struts2.model.ApplicationRoleDetails; -import org.apache.archiva.redback.struts2.model.ApplicationRoleDetails.RoleTableCell; -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 java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * @todo missing tests for success/fail on standard show/edit functions (non security testing related) - */ -public class AssignmentsActionTest - extends AbstractUserCredentialsActionTest -{ - //@Rule public TestName name = new TestName(); - // xxx help for jdk 7 investigation - private AssignmentsAction action; - - /* public static final List<String> favorites = - Arrays.asList("user", "user2","user3","user-admin"); - xxx help for jdk 7 investigation - private void displayInfo(boolean before) throws RbacObjectNotFoundException, RbacManagerException { - System.err.print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - if (before) { - System.err.print("(b)"); - } else { - System.err.print("(a)"); - } - System.err.println(name.getMethodName()); - for (String user : favorites) { - if (rbacManager.userAssignmentExists(user)) { - for (String s : rbacManager.getUserAssignment(user).getRoleNames()) { - System.err.println("--" + user + ">>" + s); - } - } - } - System.err.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - }*/ - - @Before - public void setUp() - throws Exception - { - super.setUp(); - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - action = (AssignmentsAction) actionProxy.getAction(); - - login( action, "user", PASSWORD ); - action.setPrincipal( "user2" ); - //displayInfo(true);//xxx help for jdk 7 investigation - - } - - /*@After xxx help for jdk 7 investigation - @Override - public void after() { - super.after(); - try { - displayInfo(false); - } catch (RbacObjectNotFoundException ex) { - Logger.getLogger(AssignmentsActionTest.class.getName()).log(Level.SEVERE, null, ex); - } catch (RbacObjectInvalidException ex) { - Logger.getLogger(AssignmentsActionTest.class.getName()).log(Level.SEVERE, null, ex); - } catch (RbacManagerException ex) { - Logger.getLogger(AssignmentsActionTest.class.getName()).log(Level.SEVERE, null, ex); - } - }*/ - /** - * Check security - show/edituser should fail if the permission 'user-management-user-role' is not present, but a - * valid 'user-management-role-grant' is. - */ - @Test - public void testUserWithOnlyRoleGrantHasNoAccess() - throws Exception - { - - addAssignment( "user", "Grant Administrator - default" ); - - List<SecureActionBundle.AuthorizationTuple> authorizationTuples = getTuples(); - for ( SecureActionBundle.AuthorizationTuple tuple : authorizationTuples ) - { - AuthorizationResult authzResult = system.authorize( session, tuple.getOperation(), tuple.getResource() ); - - assertFalse( authzResult.isAuthorized() ); - } - - rbacManager.getUserAssignment( "user" ).removeRoleName( "Grant Administrator - default" ); - } - - /** - * Check security - check success if the permission 'user-management-user-role' is present along with global - * 'user-management-role-grant'. - */ - @Test - public void testUserWithOnlyRoleGrantHasAccess() - throws Exception - { - addAssignment( "user", "Project Administrator - default" ); - - List<SecureActionBundle.AuthorizationTuple> authorizationTuples = getTuples(); - boolean result = false; - for ( SecureActionBundle.AuthorizationTuple tuple : authorizationTuples ) - { - AuthorizationResult authzResult = system.authorize( session, tuple.getOperation(), tuple.getResource() ); - - result |= authzResult.isAuthorized(); - } - assertTrue( result ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - private List<SecureActionBundle.AuthorizationTuple> getTuples() - throws SecureActionException - { - return action.getSecureActionBundle().getAuthorizationTuples(); - } - - /** - * Check roles can be assigned if the user has no previous assignments. - */ - @Test - public void testShowWhenUserHasNoAssignments() - throws Exception - { - addAssignment( "user", "Project Administrator - default" ); - - action.setPrincipal( "user3" ); - - assertEquals( Action.SUCCESS, action.show() ); - - assertEquals( 2, action.getApplicationRoleDetails().size() ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - show should filter out roles that the 'user-management-role-grant' is not present for - */ - @Test - public void testRoleGrantFilteringOnShow() - throws Exception - { - addAssignment( "user", "Project Administrator - default" ); - - assertEquals( Action.SUCCESS, action.show() ); - - assertEquals( 2, action.getApplicationRoleDetails().size() ); - ApplicationRoleDetails details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 0 ); - assertEquals( "System", details.getName() ); - assertEquals( "Roles that apply system-wide, across all of the applications", details.getDescription() ); - assertEquals( "found roles " + details.getAvailableRoles(), 0, details.getAvailableRoles().size() ); - details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 1 ); - assertEquals( "Continuum", details.getName() ); - assertEquals( "found roles " + details.getAvailableRoles(), 0, details.getAvailableRoles().size() ); - - // This table rendering code clearly has to go - List<List<RoleTableCell>> table = details.getTable(); - assertEquals( 1, table.size() ); - assertRow( table, 0, "default", "Project Administrator - default", false ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - @SuppressWarnings( "unchecked" ) - private void assertRow( List table, int index, String name, String label, boolean assigned ) - { - List<RoleTableCell> row = (List<RoleTableCell>) table.get( index ); - assertEquals( name, row.get( 0 ).getName() ); - assertEquals( label, row.get( 1 ).getName() ); - assertEquals( assigned, row.get( 2 ).isAssigned() ); - } - - /** - * Check security - show should not filter out roles if 'user-management-role-grant' is present for the global - * resource - */ - // TODO: currently returns all roles - we really want all templated roles - // public void testRoleGrantFilteringOnShowGlobalGrant() - // throws RbacObjectInvalidException, RbacManagerException - // { - // addAssignment( "user", "Global Grant Administrator" ); - // - // assertEquals( Action.SUCCESS, action.show() ); - // - // assertEquals( 2, action.getApplicationRoleDetails().size() ); - // ApplicationRoleDetails details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 0 ); - // assertEquals( "redback-xwork-integration-core", details.getName() ); - // assertEquals( 0, details.getAvailableRoles().size() ); - // - // details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 1 ); - // assertEquals( "Continuum", details.getName() ); - // assertEquals( 0, details.getAvailableRoles().size() ); - // - // List table = details.getTable(); - // assertEquals( 2, table.size() ); - // assertRow( table, 0, "default", "Project Administrator - default", false ); - // assertRow( table, 1, "other", "Project Administrator - other", false ); - // } - - /** - * Check security - edituser should skip adding a role that 'user-management-role-grant' is not present for a - * non-templated role - */ - @Test - public void testRoleGrantFilteringOnAddRolesNotPermittedTemplated() - throws RbacObjectInvalidException, RbacManagerException - { - addAssignment( "user", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - dSelectedRoles.add( "Project Administrator - other" ); - - action.setAddDSelectedRoles( dSelectedRoles ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - edituser should skip adding a role that 'user-management-role-grant' is not present for a - * templated role - */ - @Test - public void testRoleGrantFilteringOnAddRolesNotPermittedNotTemplated() - throws RbacObjectInvalidException, RbacManagerException - { - addAssignment( "user", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - ndSelectedRoles.add( "Continuum Group Project Administrator" ); - - action.setAddNDSelectedRoles( ndSelectedRoles ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - edituser should succeed if adding a role that 'user-management-role-grant' is present for - * untemplated roles - */ - @Test - public void testRoleGrantFilteringOnAddRolesPermittedNotTemplated() - throws RbacObjectInvalidException, RbacManagerException, AccountLockedException, AuthenticationException, - UserNotFoundException - { - addAssignment( "user", "Global Grant Administrator" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - ndSelectedRoles.add( "Continuum Group Project Administrator" ); - - action.setAddNDSelectedRoles( ndSelectedRoles ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertEquals( Lists.<String>newArrayList( "Continuum Group Project Administrator" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Continuum Group Project Administrator" ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Global Grant Administrator" ); - } - - /** - * Check security - edituser should succeed if adding a role that 'user-management-role-grant' is present for - * templated roles - */ - @Ignore - public void testRoleGrantFilteringOnAddRolesPermittedTemplated() - throws Exception - { - - rbacManager.removeUserAssignment( "user" ); - - addAssignment( "user", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - dSelectedRoles.add( "Project Administrator - default" ); - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - AssignmentsAction newAction = (AssignmentsAction) actionProxy.getAction(); - - login( newAction, "user", PASSWORD ); - - newAction.setPrincipal( "user2" ); - - newAction.setAddDSelectedRoles( dSelectedRoles ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - assertEquals( Action.SUCCESS, newAction.edituser() ); - - assertEquals( Arrays.asList( "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - } - - /** - * Check security - edituser should succeed if adding a role that 'user-management-role-grant' is present for - * templated roles - */ - @Test - public void testRoleGrantFilteringOnAddRolesPermittedTemplatedExistingRole() - throws Exception - { - addAssignment( "user", "Project Administrator - default" ); - - // cleanup before next test - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user2", "Project Administrator - other" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - dSelectedRoles.add( "Project Administrator - default" ); - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - AssignmentsAction newAction = (AssignmentsAction) actionProxy.getAction(); - - login( newAction, "user2", PASSWORD ); - - newAction.setPrincipal( "user2" ); - - newAction.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( Arrays.asList( "Project Administrator - other" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, newAction.edituser() ); - - //assertEquals( Arrays.asList( "Project Administrator - default", "Project Administrator - other" ), - // rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - - } - - /** - * Check security - edituser should fail if removing a role that 'user-management-role-grant' is not present for - * untemplated roles - */ - @Test - public void testRoleGrantFilteringOnRemoveRolesNotPermittedNotTemplated() - throws Exception - { - - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user", "Project Administrator - default" ); - - addAssignment( "user2", "Continuum Group Project Administrator" ); - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - AssignmentsAction newAction = (AssignmentsAction) actionProxy.getAction(); - - login( newAction, "user2", PASSWORD ); - - newAction.setPrincipal( "user2" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - newAction.setAddNDSelectedRoles( ndSelectedRoles ); - - assertEquals( Arrays.asList( "Continuum Group Project Administrator" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, newAction.edituser() ); - - assertEquals( Arrays.asList( "Continuum Group Project Administrator" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Continuum Group Project Administrator" ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - edituser should fail if removing a role that 'user-management-role-grant' is not present for - * templated roles - */ - @Ignore - public void testRoleGrantFilteringOnRemoveRolesNotPermittedTemplated() - throws Exception - { - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user", "Project Administrator - other" ); - - addAssignment( "user2", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - AssignmentsAction newAction = (AssignmentsAction) actionProxy.getAction(); - - login( newAction, "user2", PASSWORD ); - - newAction.setPrincipal( "user2" ); - - newAction.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( Arrays.asList( "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, newAction.edituser() ); - - assertEquals( Arrays.asList( "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - } - - /** - * Check security - edituser should succeed if removing a role that 'user-management-role-grant' is present for - * untemplated roles - */ - @Test - public void testRoleGrantFilteringOnRemoveRolesPermittedNotTemplated() - throws Exception - { - addAssignment( "user", "Global Grant Administrator" ); - - addAssignment( "user2", "Continuum Group Project Administrator" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - action.setAddNDSelectedRoles( ndSelectedRoles ); - - assertEquals( Arrays.asList( "Continuum Group Project Administrator" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - rbacManager.getUserAssignment( "user" ).removeRoleName( "Global Grant Administrator" ); - } - - /** - * Check security - edituser should succeed if removing a role that 'user-management-role-grant' is present for - * templated roles and there is an existing role that is not assignable by the current user. - */ - @Test - public void testRoleGrantFilteringOnRemoveRolesPermittedTemplatedExistingRole() - throws Exception - { - addAssignment( "user", "Project Administrator - default" ); - - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user2", "Project Administrator - default" ); - addAssignment( "user2", "Project Administrator - other" ); - addAssignment( "user2", "Registered User" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - dSelectedRoles.add( "Project Administrator - other" ); - dSelectedRoles.add( "Registered User" ); - action.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( - Arrays.asList( "Project Administrator - default", "Project Administrator - other", "Registered User" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - // Roles may be out of order, due to removal and subsequent re-add - List<String> user2roles = rbacManager.getUserAssignment( "user2" ).getRoleNames(); - assertTrue( user2roles.contains( "Project Administrator - other" ) ); - assertTrue( user2roles.contains( "Registered User" ) ); - - - // back to initial - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Registered User" ); - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Project Administrator - other" ); - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - edituser should succeed if removing a role that 'user-management-role-grant' is present for - * templated roles - */ - @Test - public void testRoleGrantFilteringOnRemoveRolesPermittedTemplated() - throws Exception - { - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user", "Project Administrator - default" ); - - addAssignment( "user2", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - action.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( Arrays.asList( "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - rbacManager.getUserAssignment( "user" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - show should succeed and display all roles, even without 'user-management-role-grant' or - * 'user-management-user-role' for the user administrators. - * - * @throws org.apache.archiva.redback.policy.MustChangePasswordException - */ - @Test - public void testSystemAdminCanShowRoles() - throws Exception - { - - login( action, "admin", PASSWORD ); - - assertEquals( Action.SUCCESS, action.show() ); - - assertEquals( 2, action.getApplicationRoleDetails().size() ); - ApplicationRoleDetails details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 0 ); - assertEquals( "System", details.getName() ); - assertEquals( "Roles that apply system-wide, across all of the applications", details.getDescription() ); - assertEquals( 4, details.getAvailableRoles().size() ); - assertEquals( "Guest", details.getAvailableRoles().get( 0 ) ); - assertEquals( "Registered User", details.getAvailableRoles().get( 1 ) ); - assertEquals( "System Administrator", details.getAvailableRoles().get( 2 ) ); - assertEquals( "User Administrator", details.getAvailableRoles().get( 3 ) ); - - details = (ApplicationRoleDetails) action.getApplicationRoleDetails().get( 1 ); - assertEquals( "Continuum", details.getName() ); - - assertEquals( 2, details.getAvailableRoles().size() ); - assertEquals( "Continuum Group Project Administrator", details.getAvailableRoles().get( 0 ) ); - assertEquals( "Global Grant Administrator", details.getAvailableRoles().get( 1 ) ); - - List<List<RoleTableCell>> table = details.getTable(); - assertEquals( 2, table.size() ); - assertRow( table, 0, "default", "Project Administrator - default", false ); - assertRow( table, 1, "other", "Project Administrator - other", false ); - } - - /** - * Check security - show should succeed and display all roles, even without 'user-management-role-grant' or - * 'user-management-user-role' for the user administrators. - */ - @Test - public void testUserAdminCanShowRoles() - throws Exception - { - - ActionProxy actionProxy = getActionProxy( "/security/assignments" ); - AssignmentsAction newAction = (AssignmentsAction) actionProxy.getAction(); - - login( newAction, "user-admin", PASSWORD ); - - newAction.setPrincipal( "user-admin" ); - - assertEquals( Action.SUCCESS, newAction.show() ); - - assertEquals( 2, newAction.getApplicationRoleDetails().size() ); - ApplicationRoleDetails details = (ApplicationRoleDetails) newAction.getApplicationRoleDetails().get( 0 ); - assertEquals( "System", details.getName() ); - assertEquals( "Roles that apply system-wide, across all of the applications", details.getDescription() ); - // TODO assertEquals( 3, details.getAvailableRoles().size() ); - assertEquals( "Guest", details.getAvailableRoles().get( 0 ) ); - assertEquals( "not role Registered User roles : " + details.getAvailableRoles(), "Registered User", - details.getAvailableRoles().get( 1 ) ); - // TODO: assertEquals( "User Administrator", details.getAvailableRoles().get( 2 ) ); - - details = newAction.getApplicationRoleDetails().get( 1 ); - assertEquals( "Continuum", details.getName() ); - - assertEquals( 2, details.getAvailableRoles().size() ); - assertEquals( "Continuum Group Project Administrator", details.getAvailableRoles().get( 0 ) ); - assertEquals( "Global Grant Administrator", details.getAvailableRoles().get( 1 ) ); - - List<List<RoleTableCell>> table = details.getTable(); - assertEquals( 2, table.size() ); - assertRow( table, 0, "default", "Project Administrator - default", false ); - assertRow( table, 1, "other", "Project Administrator - other", false ); - } - - /** - * Check security - edituser should succeed in adding a role, even without 'user-management-role-grant' or - * 'user-management-user-role' for the user administrators. - */ - @Test - public void testUserAdminCanAddRoles() - throws Exception - { - login( action, "user-admin", PASSWORD ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - ndSelectedRoles.add( "Continuum Group Project Administrator" ); - - action.setAddNDSelectedRoles( ndSelectedRoles ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> dSelectedRoles = new ArrayList<String>(); - dSelectedRoles.add( "Project Administrator - default" ); - - action.setAddDSelectedRoles( dSelectedRoles ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertEquals( Arrays.asList( "Continuum Group Project Administrator", "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - // back to inital - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Continuum Group Project Administrator" ); - rbacManager.getUserAssignment( "user2" ).removeRoleName( "Project Administrator - default" ); - } - - /** - * Check security - edituser should succeed in removing a role, even without 'user-management-role-grant' or - * 'user-management-user-role' for the user administrators. - */ - @Test - public void testUserAdminCanRemoveRoles() - throws Exception - { - login( action, "user-admin", PASSWORD ); - - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user2", "Continuum Group Project Administrator" ); - addAssignment( "user2", "Project Administrator - default" ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - action.setAddNDSelectedRoles( ndSelectedRoles ); - - List<String> dSelectedRoles = new ArrayList<String>(); - action.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( Arrays.asList( "Continuum Group Project Administrator", "Project Administrator - default" ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - assertTrue( rbacManager.getUserAssignment( "user2" ).getRoleNames().isEmpty() ); - } - - /** - * Check that a configured struts2 redback app only removes roles configured for the app. Without this, redback - * applications sharing a user database will remove each other's roles on save. - */ - @Test - public void testUserAdminCannotRemoveNonAppRoles() - throws Exception - { - login( action, "user-admin", PASSWORD ); - - // Create a role that isn't configured for apps - String nonAppRoleName = "Other App Role"; - Role nonAppRole = rbacManager.createRole( nonAppRoleName ); - rbacManager.saveRole( nonAppRole ); - - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user2", "Continuum Group Project Administrator" ); - addAssignment( "user2", "Project Administrator - default" ); - addAssignment( "user2", nonAppRoleName ); - - // set addDSelectedRoles (dynamic --> Resource Roles) and addNDSelectedRoles (non-dynamic --> Available Roles) - List<String> ndSelectedRoles = new ArrayList<String>(); - action.setAddNDSelectedRoles( ndSelectedRoles ); - - List<String> dSelectedRoles = new ArrayList<String>(); - action.setAddDSelectedRoles( dSelectedRoles ); - - assertEquals( - Arrays.asList( "Continuum Group Project Administrator", "Project Administrator - default", nonAppRoleName ), - rbacManager.getUserAssignment( "user2" ).getRoleNames() ); - - assertEquals( Action.SUCCESS, action.edituser() ); - - // All roles except role from other app should be removed. - List<String> user2roles = rbacManager.getUserAssignment( "user2" ).getRoleNames(); - assertTrue( !user2roles.contains( "Continuum Group Project Administrator" ) ); - assertTrue( !user2roles.contains( "Project Administrator - default" ) ); - assertTrue( user2roles.contains( nonAppRoleName ) ); - - // back to initial - rbacManager.removeRole( nonAppRole ); - rbacManager.getUserAssignment( "user2" ).removeRoleName( nonAppRoleName ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoActionTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoActionTest.java deleted file mode 100644 index 1600451ea..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/SystemInfoActionTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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.struts2.action.admin.SystemInfoAction; -import org.apache.struts2.StrutsSpringTestCase; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** - * SystemInfoActionTest - * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> - * - */ -@RunWith( JUnit4.class ) -public class SystemInfoActionTest - extends StrutsSpringTestCase -{ - private SystemInfoAction systeminfo; - - @Override - protected String[] getContextLocations() - { - return new String[]{ "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" }; - } - - @Before - public void setUp() - throws Exception - { - super.setUp(); - - systeminfo = (SystemInfoAction) getActionProxy( "/security/systeminfo" ).getAction(); - - //systeminfo = (SystemInfoAction) lookup( "com.opensymphony.xwork2.Action", "redback-sysinfo" ); - } - - @Test - public void testSystemInfoDump() - { - String result = systeminfo.show(); - assertNotNull( result ); - assertEquals( "success", result ); - assertNotNull( systeminfo.getDetails() ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/UserEditActionTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/UserEditActionTest.java deleted file mode 100644 index 6994b32d6..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/action/admin/UserEditActionTest.java +++ /dev/null @@ -1,364 +0,0 @@ -package org.apache.archiva.redback.struts2.action.admin; - -/* - * 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 com.opensymphony.xwork2.Action; -import org.apache.archiva.redback.authentication.AuthenticationException; -import org.apache.archiva.redback.policy.AccountLockedException; -import org.apache.archiva.redback.rbac.RbacManagerException; -import org.apache.archiva.redback.rbac.RbacObjectInvalidException; -import org.apache.archiva.redback.rbac.Role; -import org.apache.archiva.redback.users.User; -import org.apache.archiva.redback.users.UserNotFoundException; -import org.apache.archiva.redback.authentication.AuthenticationResult; -import org.apache.archiva.redback.policy.MustChangePasswordException; -import org.apache.archiva.redback.rbac.RbacObjectNotFoundException; -import org.apache.archiva.redback.system.DefaultSecuritySession; -import org.apache.archiva.redback.system.SecuritySession; -import org.apache.archiva.redback.system.SecuritySystemConstants; -import org.apache.archiva.redback.users.memory.SimpleUser; -import org.apache.archiva.redback.integration.model.AdminEditUserCredentials; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * @todo missing tests for success/fail on standard show/edit functions (non security testing related) - */ -public class UserEditActionTest - extends AbstractUserCredentialsActionTest -{ - - private Locale originalLocale; - - @Before - public void setUp() - throws Exception - { - super.setUp(); - - originalLocale = Locale.getDefault(); - Locale.setDefault( Locale.ENGLISH ); - } - - @After - public void tearDown() - throws Exception - { - try - { - super.tearDown(); - } - finally - { - Locale.setDefault( originalLocale == null ? Locale.ENGLISH : originalLocale ); - } - } - - @Test - public void testEditPageShowsAdministratableRoles() - throws RbacObjectInvalidException, RbacManagerException, AccountLockedException, AuthenticationException, - UserNotFoundException, MustChangePasswordException - { - - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user", "User Administrator" ); - - addAssignment( "user2", "Project Administrator - default" ); - addAssignment( "user2", "Project Administrator - other" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user2", PASSWORD ); - action.setUsername( "user2" ); - assertEquals( Action.INPUT, action.edit() ); - - List<Role> effectivelyAssignedRoles = action.getEffectivelyAssignedRoles(); - assertEquals( 2, effectivelyAssignedRoles.size() ); - Role r = effectivelyAssignedRoles.get( 0 ); - assertEquals( "Project Administrator - default", r.getName() ); - r = effectivelyAssignedRoles.get( 1 ); - assertEquals( "Project Administrator - other", r.getName() ); - assertFalse( action.isHasHiddenRoles() ); - - rbacManager.removeUserAssignment( "user2" ); - } - - @Test - public void testEditPageHidesUnadministratableRoles() - throws Exception - { - // REDBACK-29 - // user should not be able to see the other project admin role of user2, but should be able to see the one - // from their own group - - rbacManager.removeUserAssignment( "user" ); - rbacManager.removeUserAssignment( "user2" ); - - addAssignment( "user", "Project Administrator - default" ); - addAssignment( "user", "User Administrator" ); - addAssignment( "user", "Grant Administrator" ); - - addAssignment( "user2", "Project Administrator - default" ); - addAssignment( "user2", "Project Administrator - other" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user2" ); - assertEquals( Action.INPUT, action.edit() ); - - List<Role> effectivelyAssignedRoles = action.getEffectivelyAssignedRoles(); - assertEquals( 2, effectivelyAssignedRoles.size() ); - Role r = effectivelyAssignedRoles.get( 0 ); - assertEquals( "Project Administrator - default", r.getName() ); - //assertTrue( action.isHasHiddenRoles() ); - - rbacManager.removeUserAssignment( "user" ); - rbacManager.removeUserAssignment( "user2" ); - } - - @Test - public void testEditPageHidesUnassignableRoles() - throws RbacObjectInvalidException, RbacManagerException, AccountLockedException, AuthenticationException, - UserNotFoundException, MustChangePasswordException - { - // REDBACK-201 - // user should not be able to see the unassignable roles - - try - { - if ( rbacManager.getUserAssignment( "user" ) != null ) - { - rbacManager.removeUserAssignment( "user" ); - } - } - catch ( RbacObjectNotFoundException e ) - { - // ignore - } - - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user" ); - assertEquals( Action.INPUT, action.edit() ); - - List<Role> effectivelyAssignedRoles = action.getEffectivelyAssignedRoles(); - assertEquals( 1, effectivelyAssignedRoles.size() ); - Role r = effectivelyAssignedRoles.get( 0 ); - assertEquals( "User Administrator", r.getName() ); - assertFalse( action.isHasHiddenRoles() ); - - rbacManager.removeUserAssignment( "user" ); - } - - @Test - public void testRequireOldPWWhenEditingOwnAccountSuccess() - throws Exception - { - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user" ); - assertEquals( Action.INPUT, action.edit() ); - - assertTrue( action.isSelf() ); - - AdminEditUserCredentials user = action.getUser(); - user.setEmail( "user@example.com" ); - user.setFullName( "User" ); - action.setOldPassword( PASSWORD ); - - Map<String, Object> mockSession = new HashMap<String, Object>(); - - User currentUser = new SimpleUser(); - currentUser.setUsername( "user" ); - - AuthenticationResult authResult = new AuthenticationResult( true, "user", null ); - SecuritySession securitySession = new DefaultSecuritySession( authResult, currentUser ); - - mockSession.put( SecuritySystemConstants.SECURITY_SESSION_KEY, securitySession ); - action.setSession( mockSession ); - - assertEquals( Action.SUCCESS, action.submit() ); - - assertEquals( 0, action.getFieldErrors().size() ); - } - - @Test - public void testRequireOldPWWhenEditingOwnAccountFailed() - throws Exception - { - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user" ); - assertEquals( Action.INPUT, action.edit() ); - - assertTrue( action.isSelf() ); - - AdminEditUserCredentials user = action.getUser(); - user.setEmail( "user@example.com" ); - user.setFullName( "User" ); - user.setPassword( PASSWORD ); - user.setConfirmPassword( PASSWORD ); - - action.setOldPassword( "notmatchingoldpassword" ); - - assertEquals( Action.ERROR, action.submit() ); - - Map<String, List<String>> fieldErrors = action.getFieldErrors(); - List<String> oldPasswordErrors = fieldErrors.get( "oldPassword" ); - - assertNotNull( oldPasswordErrors ); - assertEquals( 1, oldPasswordErrors.size() ); - - assertEquals( action.getText( "password.provided.does.not.match.existing" ), oldPasswordErrors.get( 0 ) ); - - rbacManager.removeUserAssignment( "user" ); - } - - @Test - public void testRequireOldPWWhenEditingOwnAccountOldPasswordIsNull() - throws Exception - { - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user" ); - assertEquals( Action.INPUT, action.edit() ); - - assertTrue( action.isSelf() ); - - AdminEditUserCredentials user = action.getUser(); - user.setEmail( "user@example.com" ); - user.setFullName( "User" ); - user.setPassword( PASSWORD ); - user.setConfirmPassword( PASSWORD ); - - action.setOldPassword( null ); - - assertEquals( Action.ERROR, action.submit() ); - - Map<String, List<String>> fieldErrors = action.getFieldErrors(); - List<String> oldPasswordErrors = fieldErrors.get( "oldPassword" ); - - assertNotNull( oldPasswordErrors ); - assertEquals( 1, oldPasswordErrors.size() ); - - assertEquals( action.getText( "old.password.required" ), oldPasswordErrors.get( 0 ) ); - - rbacManager.removeUserAssignment( "user" ); - - } - - @Test - public void testRequireAdminPWWhenEditingOtherAccountPWIncorrect() - throws Exception - { - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user2" ); - - assertEquals( Action.INPUT, action.edit() ); - - assertFalse( action.isSelf() ); - - AdminEditUserCredentials user = action.getUser(); - user.setEmail( "user2@example.com" ); - user.setFullName( "User2" ); - user.setPassword( PASSWORD ); - user.setConfirmPassword( PASSWORD ); - - assertEquals( UserEditAction.CONFIRM, action.submit() ); - - assertFalse( action.isSelf() ); - - action.setUserAdminPassword( "boguspassword" ); - - assertEquals( UserEditAction.CONFIRM_ERROR, action.confirmAdminPassword() ); - - Collection<String> errors = action.getActionErrors(); - - assertNotNull( errors ); - assertEquals( 1, errors.size() ); - - assertEquals( action.getText( "user.admin.password.does.not.match.existing" ), errors.iterator().next() ); - - rbacManager.removeUserAssignment( "user" ); - } - - @Test - public void testRequireAdminPWWhenEditingOtherAccountPWEmpty() - throws Exception - { - addAssignment( "user", "User Administrator" ); - - UserEditAction action = (UserEditAction) getActionProxy( "/security/useredit" ).getAction(); - login( action, "user", PASSWORD ); - - action.setUsername( "user2" ); - assertEquals( Action.INPUT, action.edit() ); - - assertFalse( action.isSelf() ); - - AdminEditUserCredentials user = action.getUser(); - user.setEmail( "user2@example.com" ); - user.setFullName( "User2" ); - user.setPassword( PASSWORD ); - user.setConfirmPassword( PASSWORD ); - - action.setUserAdminPassword( "" ); - - assertEquals( UserEditAction.CONFIRM, action.submit() ); - - assertFalse( action.isSelf() ); - - assertEquals( UserEditAction.CONFIRM_ERROR, action.confirmAdminPassword() ); - - Collection<String> errors = action.getActionErrors(); - - assertNotNull( errors ); - assertEquals( 1, errors.size() ); - - assertEquals( action.getText( "user.admin.password.required" ), errors.iterator().next() ); - - rbacManager.removeUserAssignment( "user" ); - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/CustomInterceptorTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/CustomInterceptorTest.java deleted file mode 100644 index 073769c13..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/CustomInterceptorTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.archiva.redback.struts2.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 junit.framework.TestCase; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import javax.inject.Inject; -import javax.inject.Named; - - -/** - * - * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a> - */ -@RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) -public class CustomInterceptorTest - extends TestCase -{ - - @Inject @Named(value = "testCustomInterceptor") - MockCustomInterceptor component; - - /** - * - * @throws Exception on errors - */ - @Test - public void testLookup() - throws Exception - { - assertNotNull( component ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponent.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponent.java deleted file mode 100644 index e6f124760..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponent.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.archiva.redback.struts2.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. - */ - -/** - * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a> - */ -public interface MockComponent -{ - void displayResult( String result ); -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponentImpl.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponentImpl.java deleted file mode 100644 index 8421e149b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockComponentImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.archiva.redback.struts2.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 org.springframework.stereotype.Service; - -/** - * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a> - */ -@Service -public class MockComponentImpl - implements MockComponent -{ - private String result; - - /* (non-Javadoc) - * @see org.codehaus.plexus.xwork.interceptor.TestComponent#execute() - */ - public void displayResult( String result ) - { - this.result = result; - } - - public String getResult() - { - return result; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockCustomInterceptor.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockCustomInterceptor.java deleted file mode 100644 index 284438637..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/MockCustomInterceptor.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.apache.archiva.redback.struts2.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 com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.Interceptor; -import org.springframework.stereotype.Service; - -import javax.inject.Inject; - -/** - * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a> - */ -@Service( "testCustomInterceptor" ) -public class MockCustomInterceptor - implements Interceptor -{ - /** - * - */ - @Inject - private MockComponent testComponent; - - public MockCustomInterceptor() - { - } - - public MockCustomInterceptor( MockComponent testComponent ) - { - this.testComponent = testComponent; - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy() - */ - public void destroy() - { - // do nothing - } - - /* (non-Javadoc) - * @see com.opensymphony.xwork2.interceptor.Interceptor#init() - */ - public void init() - { - // do nothing - } - - /** - * @noinspection ProhibitedExceptionDeclared - */ - public String intercept( ActionInvocation invocation ) - throws Exception - { - String result = "Hello Custom Interceptor"; - - testComponent.displayResult( result ); - - return result; - } - - public MockComponent getTestComponent() - { - return testComponent; - } - - // Introduce a Composition Exception , see PLX - 278 - // public void setTestComponent( MockComponent testComponent ) - // { - // this.testComponent = testComponent; - // } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTrackerTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTrackerTest.java deleted file mode 100644 index a23bcdfce..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/interceptor/SimpleActionInvocationTrackerTest.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.apache.archiva.redback.struts2.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 junit.framework.TestCase; -import org.apache.archiva.redback.struts2.ActionContextStub; -import org.apache.archiva.redback.struts2.ActionInvocationStub; -import org.apache.archiva.redback.struts2.ActionProxyStub; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Map; - -@RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) -public class SimpleActionInvocationTrackerTest - extends TestCase -{ - private static final int HISTORY_SIZE = 2; - - private ActionInvocationTracker tracker; - - - - - protected String getPlexusConfigLocation() - { - return "plexus.xml"; - } - - @Before - public void setUp() - throws Exception - { - super.setUp(); - tracker = new SimpleActionInvocationTracker(); - } - - @Test - public void testAddActionInvocation() - throws Exception - { - tracker.setHistorySize( HISTORY_SIZE ); - - tracker.addActionInvocation( new ActionInvocationStub() ); - assertEquals( 1, tracker.getHistoryCount() ); - - // first entry int the stack - SavedActionInvocation actionInvocation = tracker.getActionInvocationAt( 0 ); - Map<String,Object> parametersMap = actionInvocation.getParametersMap(); - - assertEquals( ActionProxyStub.ACTION_NAME, actionInvocation.getActionName() ); - assertEquals( ActionProxyStub.METHOD, actionInvocation.getMethodName() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - - ActionInvocationStub actionInvocationStub = new ActionInvocationStub(); - - ActionProxyStub proxyStub = (ActionProxyStub) actionInvocationStub.getProxy(); - proxyStub.setActionName( "new_action" ); - proxyStub.setMethod( "new_method" ); - - ActionContextStub actionContextStub = (ActionContextStub) actionInvocationStub.getInvocationContext(); - actionContextStub.getParameters().put( "new_parameter", "new_value" ); - - tracker.addActionInvocation( actionInvocationStub ); - assertEquals( tracker.getHistoryCount(), HISTORY_SIZE ); - - // second entry in the stack - actionInvocation = tracker.getActionInvocationAt( 1 ); - parametersMap = actionInvocation.getParametersMap(); - - assertEquals( "new_action", actionInvocation.getActionName() ); - assertEquals( "new_method", actionInvocation.getMethodName() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - assertEquals( "new_value", parametersMap.get( "new_parameter" ) ); - - // first entry int the stack - actionInvocation = tracker.getActionInvocationAt( 0 ); - parametersMap = actionInvocation.getParametersMap(); - - assertEquals( ActionProxyStub.ACTION_NAME, actionInvocation.getActionName() ); - assertEquals( ActionProxyStub.METHOD, actionInvocation.getMethodName() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - } - - @Test - public void testHistoryCounter() - throws Exception - { - tracker.setHistorySize( HISTORY_SIZE ); - tracker.addActionInvocation( new ActionInvocationStub() ); - assertEquals( 1, tracker.getHistoryCount() ); - - tracker.setHistorySize( HISTORY_SIZE ); - tracker.addActionInvocation( new ActionInvocationStub() ); - assertEquals( HISTORY_SIZE, tracker.getHistoryCount() ); - - tracker.addActionInvocation( new ActionInvocationStub() ); - tracker.addActionInvocation( new ActionInvocationStub() ); - tracker.addActionInvocation( new ActionInvocationStub() ); - assertEquals( HISTORY_SIZE, tracker.getHistoryCount() ); - - tracker.addActionInvocation( new ActionInvocationStub() ); - tracker.addActionInvocation( new ActionInvocationStub() ); - tracker.addActionInvocation( new ActionInvocationStub() ); - assertEquals( HISTORY_SIZE, tracker.getHistoryCount() ); - } - -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/BackTrackingResultTest.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/BackTrackingResultTest.java deleted file mode 100644 index c7de9ca15..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/BackTrackingResultTest.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.archiva.redback.struts2.result; - -/* - * 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.apache.archiva.redback.struts2.interceptor.ActionInvocationTracker; -import org.apache.archiva.redback.struts2.interceptor.SimpleActionInvocationTracker; -import org.apache.archiva.redback.struts2.ActionContextStub; -import org.apache.archiva.redback.struts2.ActionInvocationStub; -import org.apache.archiva.redback.struts2.ActionProxyStub; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Map; - -@RunWith( SpringJUnit4ClassRunner.class ) -@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) -public class BackTrackingResultTest - extends TestCase -{ - public static final int HISTORY_SIZE = 2; - - protected String getPlexusConfigLocation() - { - return "plexus.xml"; - } - - @Test - public void testBackTrackPrevious() - throws Exception - { - // first http request - ActionInvocationStub actionInvocation1 = new ActionInvocationStub(); - SimpleBackTrackingResult backtrackingResult = new SimpleBackTrackingResult( actionInvocation1 ); - - // second http request - ActionInvocationStub previousActionInvocation = new ActionInvocationStub(); - ActionProxyStub previousProxyStub = (ActionProxyStub) previousActionInvocation.getProxy(); - previousProxyStub.setActionName( "previous_action" ); - previousProxyStub.setMethod( "previous_method" ); - - ActionContextStub previousActionContext = (ActionContextStub) previousActionInvocation.getInvocationContext(); - previousActionContext.getParameters().put( "previous_parameter", "previous_value" ); - - // third http request - ActionInvocationStub currentActionInvocation = new ActionInvocationStub(); - ActionProxyStub currentProxyStub = (ActionProxyStub) currentActionInvocation.getProxy(); - currentProxyStub.setActionName( "current_action" ); - currentProxyStub.setMethod( "current_method" ); - - ActionContextStub currentActionContext = (ActionContextStub) currentActionInvocation.getInvocationContext(); - currentActionContext.getParameters().put( "current_parameter", "current_value" ); - - SimpleActionInvocationTracker tracker = new SimpleActionInvocationTracker(); - - // save the second request and third request to the stack - tracker.setHistorySize( HISTORY_SIZE ); - tracker.addActionInvocation( previousActionInvocation ); - tracker.addActionInvocation( currentActionInvocation ); - tracker.setBackTrack(); - // add the tracker to the session - actionInvocation1.getInvocationContext().getSession().put( ActionInvocationTracker.SESSION_KEY, tracker ); - - // before backtrack - Map<String, Object> parametersMap = actionInvocation1.getInvocationContext().getParameters(); - - assertEquals( ActionProxyStub.ACTION_NAME, backtrackingResult.getActionName() ); - assertEquals( ActionProxyStub.METHOD, backtrackingResult.getMethod() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - - backtrackingResult.setupBackTrackPrevious( actionInvocation1 ); - - // after backtrack - parametersMap = actionInvocation1.getInvocationContext().getParameters(); - - assertEquals( "previous_action", backtrackingResult.getActionName() ); - assertEquals( "previous_method", backtrackingResult.getMethod() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - assertEquals( "previous_value", parametersMap.get( "previous_parameter" ) ); - - } - - @SuppressWarnings( "unchecked" ) - public void testBackTrackCurrent() - throws Exception - { - // first http request - ActionInvocationStub actionInvocation1 = new ActionInvocationStub(); - SimpleBackTrackingResult backtrackingResult = new SimpleBackTrackingResult( actionInvocation1 ); - - // second http request - ActionInvocationStub previousActionInvocation = new ActionInvocationStub(); - ActionProxyStub previousProxyStub = (ActionProxyStub) previousActionInvocation.getProxy(); - previousProxyStub.setActionName( "previous_action" ); - previousProxyStub.setMethod( "previous_method" ); - - ActionContextStub previousActionContext = (ActionContextStub) previousActionInvocation.getInvocationContext(); - previousActionContext.getParameters().put( "previous_parameter", "previous_value" ); - - // third http request - ActionInvocationStub currentActionInvocation = new ActionInvocationStub(); - ActionProxyStub currentProxyStub = (ActionProxyStub) currentActionInvocation.getProxy(); - currentProxyStub.setActionName( "current_action" ); - currentProxyStub.setMethod( "current_method" ); - - ActionContextStub currentActionContext = (ActionContextStub) currentActionInvocation.getInvocationContext(); - currentActionContext.getParameters().put( "current_parameter", "current_value" ); - - SimpleActionInvocationTracker tracker = new SimpleActionInvocationTracker(); - - // save the second request and third request to the stack - tracker.setHistorySize( HISTORY_SIZE ); - tracker.addActionInvocation( previousActionInvocation ); - tracker.addActionInvocation( currentActionInvocation ); - tracker.setBackTrack(); - // add the tracker to the session - actionInvocation1.getInvocationContext().getSession().put( ActionInvocationTracker.SESSION_KEY, tracker ); - - // before backtrack - Map<String, Object> parametersMap = actionInvocation1.getInvocationContext().getParameters(); - - assertEquals( ActionProxyStub.ACTION_NAME, backtrackingResult.getActionName() ); - assertEquals( ActionProxyStub.METHOD, backtrackingResult.getMethod() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - - backtrackingResult.setupBackTrackCurrent( actionInvocation1 ); - - // after backtrack - assertEquals( "current_action", backtrackingResult.getActionName() ); - assertEquals( "current_method", backtrackingResult.getMethod() ); - assertEquals( ActionContextStub.VALUE_1, parametersMap.get( ActionContextStub.PARAMETER_1 ) ); - assertEquals( ActionContextStub.VALUE_2, parametersMap.get( ActionContextStub.PARAMETER_2 ) ); - assertEquals( ActionContextStub.VALUE_3, parametersMap.get( ActionContextStub.PARAMETER_3 ) ); - assertEquals( "current_value", parametersMap.get( "current_parameter" ) ); - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/SimpleBackTrackingResult.java b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/SimpleBackTrackingResult.java deleted file mode 100644 index 678ae6b4b..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/java/org/apache/archiva/redback/struts2/result/SimpleBackTrackingResult.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.archiva.redback.struts2.result; - -/* - * 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.struts2.ActionInvocationStub; - -public class SimpleBackTrackingResult - extends AbstractBackTrackingResult -{ - public SimpleBackTrackingResult( ActionInvocationStub invocation ) - { - super.actionName = invocation.getProxy().getActionName(); - super.method = invocation.getProxy().getMethod(); - } - - public String getActionName() - { - return super.actionName; - } - - public String getMethod() - { - return super.method; - } -} diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/log4j2-test.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/log4j2-test.xml deleted file mode 100644 index 752c5ff8c..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/log4j2-test.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ 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. - --> - - -<configuration status="debug"> - <appenders> - <Console name="console" target="SYSTEM_OUT"> - <PatternLayout pattern="%d [%t] %-5p %c %x - %m%n"/> - </Console> - </appenders> - <loggers> - - <logger name="org.springframework" level="ERROR"/> - <logger name="com.opensymphony.xwork2" level="debug"/> - - <root level="info"> - <appender-ref ref="console"/> - </root> - </loggers> -</configuration> - - diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/org/apache/archiva/redback/config-defaults.properties b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/org/apache/archiva/redback/config-defaults.properties deleted file mode 100644 index 908577913..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/org/apache/archiva/redback/config-defaults.properties +++ /dev/null @@ -1,126 +0,0 @@ -jdbc.url=jdbc:hsqldb:mem:UnitTests -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -------------------------------------------------------------------- -# Application Configuration - -application.timestamp=EEE d MMM yyyy HH:mm:ss Z - -# -------------------------------------------------------------------- -# JDBC Setup - -jdbc.driver.name=org.hsqldb.jdbcDriver -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 - - - diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/redback.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/redback.xml deleted file mode 100644 index 7687263ba..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/redback.xml +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<redback-role-model> - <modelVersion>1.0.0</modelVersion> - <applications> - <application> - <id>Continuum</id> - <version>1.0</version> - <operations> - <operation> - <id>continuum-manage-users</id> - <name>continuum-manage-users</name> - <description>Manage Continuum Users</description> - </operation> - </operations> - <roles> - <role> - <id>continuum-group-project-administrator</id> - <name>Continuum Group Project Administrator</name> - <assignable>true</assignable> - <permanent>true</permanent> - </role> - <role> - <id>global-grant-administrator</id> - <name>Global Grant Administrator</name> - <assignable>true</assignable> - <permissions> - <permission> - <id>continuum-manage-users-roles</id> - <name>Continuum Manage User Roles</name> - <operation>user-management-user-role</operation> - <resource>global</resource> - </permission> - <permission> - <id>continuum-group-role-grant</id> - <name>Continuum Grant Group Roles</name> - <operation>user-management-role-grant</operation> - <resource>global</resource> - </permission> - </permissions> - </role> - <role> - <id>continuum-user-administrator</id> - <name>Continuum User Administrator</name> - <permanent>true</permanent> - <assignable>false</assignable> - <permissions> - <permission> - <id>continuum-manage-users</id> - <name>continuum-manage-users</name> - <operation>continuum-manage-users</operation> - <resource>global</resource> - <permanent>true</permanent> - </permission> - </permissions> - <parentRoles> - <parentRole>user-administrator</parentRole> - </parentRoles> - </role> - </roles> - <templates> - <template> - <id>project-administrator</id> - <namePrefix>Project Administrator</namePrefix> - <assignable>true</assignable> - <permissions> - <permission> - <id>continuum-manage-users-roles</id> - <name>Continuum Manage User Roles</name> - <operation>user-management-user-role</operation> - <resource>global</resource> - </permission> - <permission> - <id>continuum-group-role-grant</id> - <name>Continuum Grant Group Roles</name> - <operation>user-management-role-grant</operation> - <resource>${resource}</resource> - </permission> - </permissions> - <parentRoles> - <parentRole>continuum-group-project-administrator</parentRole> - </parentRoles> - </template> - <template> - <id>project-grant-only</id> - <namePrefix>Grant Administrator</namePrefix> - <assignable>true</assignable> - <permissions> - <permission> - <id>continuum-group-role-grant</id> - <name>Continuum Grant Group Roles</name> - <operation>user-management-role-grant</operation> - <resource>${resource}</resource> - </permission> - </permissions> - <parentRoles> - <parentRole>continuum-group-project-administrator</parentRole> - </parentRoles> - </template> - </templates> - </application> - </applications> -</redback-role-model>
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/spring-context.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/spring-context.xml deleted file mode 100755 index 59ecd5d22..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/spring-context.xml +++ /dev/null @@ -1,163 +0,0 @@ -<?xml version="1.0"?> - -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" - default-lazy-init="true"> - - <context:property-placeholder system-properties-mode="OVERRIDE"/> - - <bean name="jdoFactory#users" class="org.apache.archiva.redback.common.jdo.UserConfigurableJdoFactory"> - <property name="config" ref="userConfiguration"/> - <property name="driverName" value="org.hsqldb.jdbcDriver"/> - <property name="url" value="jdbc:hsqldb:mem:MailGeneratorTest" /> - <property name="userName" value="sa"/> - <property name="password" value=""/> - </bean> - - <bean name="rBACManager#cached" class="org.apache.archiva.redback.rbac.cached.CachedRbacManager"> - <property name="rbacImpl" ref="rBACManager#memory"/> - </bean> - - <!-- - - <component> - <role>org.apache.archiva.redback.rbac.RBACManager</role> - <role-hint>cached</role-hint> - <implementation>org.apache.archiva.redback.rbac.cached.CachedRbacManager</implementation> - <description>CachedRbacManager is a wrapped RBACManager with caching.</description> - <requirements> - <requirement> - <role>org.apache.archiva.redback.rbac.RBACManager</role> - <role-hint>memory</role-hint> - <field-name>rbacImpl</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>operations</role-hint> - <field-name>operationsCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>permissions</role-hint> - <field-name>permissionsCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>resources</role-hint> - <field-name>resourcesCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>roles</role-hint> - <field-name>rolesCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>userAssignments</role-hint> - <field-name>userAssignmentsCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>userPermissions</role-hint> - <field-name>userPermissionsCache</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>effectiveRoleSet</role-hint> - <field-name>effectiveRoleSetCache</field-name> - </requirement> - </requirements> - </component> - --> - <bean name="userManager#cached" class="org.apache.archiva.redback.users.cached.CachedUserManager"> - <property name="userImpl" ref="userManager#memory"/> - </bean> - - <!-- - <component> - <role>org.apache.archiva.redback.users.UserManager</role> - <role-hint>cached</role-hint> - <implementation>org.apache.archiva.redback.users.cached.CachedUserManager</implementation> - <description>CachedUserManager</description> - <requirements> - <requirement> - <role>org.apache.archiva.redback.users.UserManager</role> - <role-hint>memory</role-hint> - <field-name>userImpl</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>users</role-hint> - <field-name>usersCache</field-name> - </requirement> - </requirements> - </component> - --> - - <bean name="keyManager#cached" class="org.apache.archiva.redback.keys.cached.CachedKeyManager"> - <property name="keyImpl" ref="keyManager#memory"/> - </bean> - <!-- - <component> - <role>org.apache.archiva.redback.keys.KeyManager</role> - <role-hint>cached</role-hint> - <implementation>org.apache.archiva.redback.keys.cached.CachedKeyManager</implementation> - <description>CachedKeyManager</description> - <requirements> - <requirement> - <role>org.apache.archiva.redback.keys.KeyManager</role> - <role-hint>memory</role-hint> - <field-name>keyImpl</field-name> - </requirement> - <requirement> - <role>org.apache.archiva.redback.components.cache.Cache</role> - <role-hint>keys</role-hint> - <field-name>keysCache</field-name> - </requirement> - </requirements> - </component> - --> - - <!-- - <bean name="jdoFactory#users" class="org.apache.archiva.redback.components.jdo.DefaultConfigurableJdoFactory"> - <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/> - <property name="driverName" value="org.hsqldb.jdbcDriver"/> - <property name="url" value="jdbc:hsqldb:mem:UnitTest"/> - <property name="userName" value="sa"/> - <property name="otherProperties"> - <props> - <prop key="javax.jdo.PersistenceManagerFactoryClass"> - org.jpox.PersistenceManagerFactoryImpl - </prop> - <prop key="org.jpox.autoCreateTables"> - true - </prop> - <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop> - </props> - </property> - </bean> - --> -</beans>
\ No newline at end of file diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts-security.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts-security.xml deleted file mode 100755 index c4fd136f0..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts-security.xml +++ /dev/null @@ -1,348 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" - "http://struts.apache.org/dtds/struts-2.0.dtd"> - -<!-- ================================================================== - Plexus Security Tools - - This should contain the /security namespaced action configurations. - - These configurations will likely not need changing. - - These configurations point to the overlaid jsp files. - ================================================================== --> - -<struts> - <!-- ================================================================== - Security Tools for Users - - All Users should be able to access and use the actions contained - within this package. - ================================================================== --> - - <package name="security" extends="struts-default" namespace="/security"> - <result-types> - <result-type name="security-external" class="securityExternalResult" /> - </result-types> - - <interceptors> - <interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/> - <interceptor name="redbackEnvCheck" class="redbackEnvironmentCheckInterceptor"/> - <interceptor name="redbackAutoLogin" class="redbackAutoLoginInterceptor"/> - <interceptor name="redbackPolicyEnforcement" class="redbackPolicyEnforcementInterceptor"/> - <interceptor name="redbackSecureActions" class="redbackSecureActionInterceptor"/> - - <!-- - Stacks are order dependent and fail silently by not running the referenced stack. - Make sure that redbackCommonStack remains above is usages. - --> - <interceptor-stack name="redbackCommonStack"> - <interceptor-ref name="redbackEnvCheck"/> - <interceptor-ref name="redbackForceAdminUser"/> - <interceptor-ref name="redbackAutoLogin"/> - <interceptor-ref name="redbackPolicyEnforcement"/> - <interceptor-ref name="redbackSecureActions"> - <param name="enableReferrerCheck">true</param> - </interceptor-ref> - </interceptor-stack> - - <interceptor-stack name="securedStack"> - <interceptor-ref name="defaultStack"/> - <interceptor-ref name="redbackCommonStack"/> - <interceptor-ref name="tokenSession"> - <param name="excludeMethods">*</param> - </interceptor-ref> - </interceptor-stack> - - <interceptor-stack name="securedPrepareParamsStack"> - <interceptor-ref name="paramsPrepareParamsStack"/> - <interceptor-ref name="redbackCommonStack"/> - </interceptor-stack> - - </interceptors> - - <default-interceptor-ref name="securedStack"/> - - <global-results> - <result name="security-admin-user-needed" type="redirectAction"> - <param name="actionName">addadmin</param> - <param name="namespace">/security</param> - </result> - <result name="requires-authentication">/WEB-INF/jsp/redback/requiresAuthentication.jsp</result> - <result name="requires-authorization">/WEB-INF/jsp/redback/accessDenied.jsp</result> - <result name="security-must-change-password" type="redirectAction"> - <param name="actionName">password</param> - <param name="namespace">/security</param> - </result> - <result name="security-resend-validation-email" type="redirectAction"> - <param name="actionName">userlist</param> - <param name="namespace">/security</param> - </result> - <result name="invalid.token">/WEB-INF/jsp/redback/invalidToken.jsp</result> - </global-results> - - <action name="login" class="redback-login" method="show"> - <result name="input">/WEB-INF/jsp/redback/login.jsp</result> - <result name="error">/WEB-INF/jsp/redback/login.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-login-cancel</param> - </result> - <result name="security-login-locked" type="security-external"> - <param name="externalResult">security-login-locked</param> - </result> - </action> - - <action name="logout" class="redback-logout" method="logout"> - <result name="security-logout" type="security-external"> - <param name="externalResult">security-logout</param> - </result> - </action> - - <action name="register" class="redback-register" method="show"> - <result name="input">/WEB-INF/jsp/redback/register.jsp</result> - <result name="error">/WEB-INF/jsp/redback/register.jsp</result> - <result name="validation-note">/WEB-INF/jsp/redback/validationNotification.jsp</result> - <result name="security-register-success" type="security-external"> - <param name="externalResult">security-register-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-register-cancel</param> - </result> - </action> - - <action name="account" class="redback-account" method="show"> - <result name="input">/WEB-INF/jsp/redback/account.jsp</result> - <result name="error">/WEB-INF/jsp/redback/account.jsp</result> - <result name="security-account-success" type="security-external"> - <param name="externalResult">security-account-success</param> - </result> - <result name="cancel" type="security-external"> - <param name="externalResult">security-account-cancel</param> - </result> - </action> - - <action name="password" class="redback-password" method="show"> - <result name="input">/WEB-INF/jsp/redback/password.jsp</result> - <result name="error">/WEB-INF/jsp/redback/password.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="security-register-success" type="security-external"> - <param name="externalResult">security-register-success</param> - </result> - <result name="success" type="redirect">${targetUrl}</result> - <result name="cancel" type="redirectAction"> - <param name="actionName">logout</param> - <param name="namespace">/security</param> - </result> - <result name="security-change-password-success">/WEB-INF/jsp/redback/changePasswordSuccess.jsp</result> - </action> - - <action name="passwordReset" class="redback-password-reset" method="show"> - <result name="input">/WEB-INF/jsp/redback/requestPasswordReset.jsp</result> - <result name="none">/WEB-INF/jsp/redback/login.jsp</result> - </action> - - <action name="addadmin" class="redback-admin-account" method="show"> - <interceptor-ref name="defaultStack"/> - <result name="input">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result> - <result name="login-error">/WEB-INF/jsp/redback/login.jsp</result> - <result name="security-login-success" type="security-external"> - <param name="externalResult">security-login-success</param> - </result> - <result name="security-login-locked" type="security-external"> - <param name="externalResult">security-login-locked</param> - </result> - </action> - - <!-- ================================================================== - Security Tools for Administrators - - Only Administrators should be able to access and use these actions - ================================================================== --> - - <action name="systeminfo" class="redback-sysinfo" method="show"> - <result>/WEB-INF/jsp/redback/admin/systemInformation.jsp</result> - </action> - - <action name="adminConsole" class="redback-admin-console" method="show"> - <result>/WEB-INF/jsp/redback/admin/console.jsp</result> - </action> - - <action name="report" class="redback-report" method="generate"> - <result name="error" type="redirectAction">userlist</result> - </action> - - <action name="userlist" class="redback-admin-user-list" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/userList.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/userList.jsp</result> - </action> - - <action name="useredit" class="redback-admin-user-edit" method="edit"> - <result name="input">/WEB-INF/jsp/redback/admin/userEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/userEdit.jsp</result> - <result name="confirm">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result> - <result name="confirmError">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result> - <result name="success" type="redirectAction">userlist</result> - <result name="cancel" type="redirectAction">userlist</result> - </action> - - <action name="usercreate" class="redback-admin-user-create" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/userCreate.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/userCreate.jsp</result> - <result name="success" type="redirectAction"> - <param name="actionName">assignments</param> - <param name="principal">${user.username}</param> - </result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="userdelete" class="redback-admin-user-delete" method="confirm"> - <result name="input">/WEB-INF/jsp/redback/admin/userDelete.jsp</result> - <result name="error" type="redirectAction">userlist</result> - <result name="success" type="redirectAction">userlist</result> - <result name="cancel" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <!-- ==== RBAC Actions ========================================== --> - - <!-- This action is meant to be embedded within the User Edit action output jsp. - It is injected using the <ww:action> taglib --> - <action name="assignments" class="redback-assignments" method="show"> - <interceptor-ref name="securedStack"/> - <result name="input">/WEB-INF/jsp/redback/admin/assignments.jsp</result> - <result name="error">/WEB-INF/jsp/redback/include/error.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/assignments.jsp</result> - </action> - - <action name="addRolesToUser" class="redback-assignments" method="edituser"> - <result name="success" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="removeRolesFromUser" class="redback-assignments" method="edituser"> - <result name="success" type="redirectAction">userlist</result> - </action> - - <action name="rolecreate" class="redback-role-create" method="show"> - <result name="input">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result> - <result name="success" type="redirectAction">userlist</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="role" class="redback-role-edit" method="input"> - <result name="input">/WEB-INF/jsp/redback/admin/role.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/role.jsp</result> - <result name="success" type="redirectAction">roles</result> - </action> - - <action name="roleedit" class="redback-role-edit" method="edit"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success" type="redirectAction">roles</result> - </action> - - <action name="rolesave" class="redback-role-edit" method="save"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success" type="redirectAction">roles</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleusersadd" class="redback-role-edit" method="addUsers"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleusersremove" class="redback-role-edit" method="removeUsers"> - <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result> - <interceptor-ref name="securedStack"> - <param name="tokenSession.includeMethods">*</param> - </interceptor-ref> - </action> - - <action name="roleSummary" class="redback-roles" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/roleSummary.jsp</result> - </action> - - <action name="roles" class="redback-roles" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/roleList.jsp</result> - </action> - - <action name="permissions" class="redback-permissions" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/permissionList.jsp</result> - </action> - - <action name="operations" class="redback-operations" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/operationList.jsp</result> - </action> - - <action name="resources" class="redback-resources" method="list"> - <result name="list">/WEB-INF/jsp/redback/admin/resourceList.jsp</result> - </action> - - <action name="roleModel" class="redback-role-model" method="view"> - <result name="success">/WEB-INF/jsp/redback/admin/roleModel.jsp</result> - </action> - - <!-- - Backup Restore actions - --> - - <action name="backupRestore" class="backup-restore" method="view"> - <result>/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - </action> - - <action name="backup" class="backup-restore" method="backup"> - <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - <result type="redirectAction">backupRestore</result> - </action> - - <action name="restore" class="backup-restore" method="restore"> - <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result> - <result name="success" type="redirectAction">backupRestore</result> - </action> - - </package> - -</struts> diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.properties b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.properties deleted file mode 100755 index 94a94f64a..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory -struts.objectFactory.spring.autoWire = type - -# Theme -struts.ui.theme = xhtml - -struts.devMode = true - -# Locale -#struts.locale=en_EN - -# Upload -#struts.multipart.parser = jakarta -# default saveDir is defined by javax.servlet.context.tempdir property -#struts.multipart.saveDir = -# default max size is 2097152 (2MB) -#struts.multipart.maxSize = - -# Localization -struts.custom.i18n.resources=org.apache.archiva.redback.struts2.default,org.apache.archiva.redback.example.custom diff --git a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.xml b/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.xml deleted file mode 100755 index c725002cb..000000000 --- a/redback-integrations/redback-struts2/redback-struts2-integration/src/test/resources/struts.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> -<!DOCTYPE struts PUBLIC - "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" - "http://struts.apache.org/dtds/struts-2.0.dtd"> -<struts> - <include file="struts-security.xml"/> - <package name="foo" extends="struts-default"/> -</struts>
\ No newline at end of file |