You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/04/06 11:59:32 UTC
svn commit: r1310268 [19/42] - in /archiva/redback/redback-core/trunk: ./
redback-authentication/ redback-authentication/redback-authentication-api/
redback-authentication/redback-authentication-api/src/
redback-authentication/redback-authentication-ap...
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,132 @@
+package org.codehaus.plexus.redback.example.web;
+
+/*
+ * Copyright 2001-2006 The Codehaus.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+
+/**
+ * TestUsersEnvironmentCheck
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Controller("test-users-check")
+@Scope("prototype")
+public class TestUsersEnvironmentCheck
+ implements EnvironmentCheck
+{
+ private Logger log = LoggerFactory.getLogger( TestUsersEnvironmentCheck.class );
+
+ @Inject
+ private RoleManager roleManager;
+
+ @Inject
+ private SecuritySystem securitySystem;
+
+ /**
+ * boolean detailing if this environment check has been executed
+ */
+ private boolean checked = true;
+
+ private void createUser( String username, String fullname, String email, String password, boolean locked,
+ boolean validated )
+ {
+ UserManager userManager = securitySystem.getUserManager();
+ UserSecurityPolicy policy = securitySystem.getPolicy();
+
+ User user;
+
+ try
+ {
+ user = userManager.findUser( username );
+ }
+ catch ( UserNotFoundException e )
+ {
+ policy.setEnabled( false );
+ user = userManager.createUser( username, fullname, email );
+ user.setPassword( password );
+ user.setLocked( locked );
+ user.setValidated( validated );
+ user = userManager.addUser( user );
+ }
+ finally
+ {
+ policy.setEnabled( true );
+ }
+
+ try
+ {
+ roleManager.assignRole( "registered-user", user.getPrincipal().toString() );
+ }
+ catch ( RoleManagerException e )
+ {
+ log.warn( "Unable to set role: ", e );
+ }
+ }
+
+ public void validateEnvironment( List<String> violations )
+ {
+
+ if ( !checked )
+ {
+ createUser( "testuser1", "Test User 1", "test.user@gmail.com", "pass123", false, true );
+ createUser( "testuser2", "Test User 2", "test,user.2@gmail.com", "pass123", false, true );
+
+ // Intentionally create bad users to test CSV reporting
+ createUser( "csvtest1", "CSV Test \"User\" 1", "csv.1@gmail.com", "pass123", false, false );
+ createUser( "csvtest2", "CSV Test \t'Pau 2", "csv.2@gmail.com", "pass123", false, true );
+ createUser( "csvtest3", "CSV Test User \next Generation 3", "csv.3@gmail.com", "pass123", true, true );
+
+ // Filmed On Location
+ createUser( "amy", "Amy Wong", "amy@kapa.kapa.wong.mars", "guh!", false, true );
+ createUser( "bender", "Bender Bending Rodriguez", "bender@planetexpress.com", "elzarRox",
+ false, true );
+ createUser( "leela", "Turanga Leela", "leela@planetexpress.com", "orphanarium",
+ false, true );
+ createUser( "fry", "Philip J. Fry", "fry@planetexpress.com", "cool", false, true );
+ createUser( "kif", "Kif Krooker", "kif@nimbus.doop.mil", "sigh", false, true );
+ createUser( "zapp", "Zapp Brannigan", "zapp@nimbus.doop.mil", "leela", false, false );
+ createUser( "elzar", "Elzar", "elzar@elzarscuisine.com", "BAM!", false, true );
+ createUser( "mom", "Mom", "mom@momsfriendlyrobotcompany.com", "heartless", false, true );
+ createUser( "nibbler", "Lord Nibbler", "nibbler@planetexpress.com", "growl", false, false );
+ createUser( "hermes", "Hermes Conrad", "hermes@bureaucrat.planetexpress.com", "groovy",
+ false, true );
+ createUser( "hubert", "Professor Hubert J. Farnsworth", "owner@planetexpress.com",
+ "doomsday", false, true );
+ createUser( "zoidberg", "Dr. John Zoidberg", "doctor@planetexpress.com", "sayargh",
+ true, false );
+
+ checked = true;
+ }
+ }
+
+}
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/TestUsersEnvironmentCheck.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,92 @@
+package org.codehaus.plexus.redback.example.web.action;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.redback.struts2.action.RedbackActionSupport;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+import javax.inject.Inject;
+
+/**
+ * MainAction
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Controller( "main" )
+@Scope( "prototype" )
+public class MainAction
+ extends RedbackActionSupport
+{
+ @Inject
+ private SecuritySystem securitySystem;
+
+ @Inject
+ private RoleManager roleManager;
+
+ public String show()
+ {
+ if ( securitySystem == null )
+ {
+ session.put( "SecuritySystemWARNING", "SecuritySystem is null!" );
+ }
+ else
+ {
+ session.put( "security_id_authenticator", securitySystem.getAuthenticatorId() );
+ session.put( "security_id_authorizor", securitySystem.getAuthorizerId() );
+ session.put( "security_id_user_management", securitySystem.getUserManagementId() );
+ }
+
+ try
+ {
+
+ if ( !roleManager.templatedRoleExists( "template1", "Test Resource A" ) )
+ {
+ roleManager.createTemplatedRole( "template1", "Test Resource A" );
+ }
+ if ( !roleManager.templatedRoleExists( "template2", "Test Resource A" ) )
+ {
+ roleManager.createTemplatedRole( "template2", "Test Resource A" );
+ }
+ if ( !roleManager.templatedRoleExists( "template3", "Test Resource A" ) )
+ {
+ roleManager.createTemplatedRole( "template3", "Test Resource A" );
+ }
+ if ( !roleManager.templatedRoleExists( "template1", "Test Resource B" ) )
+ {
+ roleManager.createTemplatedRole( "template1", "Test Resource B" );
+ }
+ if ( !roleManager.templatedRoleExists( "template2", "Test Resource B" ) )
+ {
+ roleManager.createTemplatedRole( "template2", "Test Resource B" );
+ }
+ if ( !roleManager.templatedRoleExists( "template3", "Test Resource B" ) )
+ {
+ roleManager.createTemplatedRole( "template3", "Test Resource B" );
+ }
+ }
+ catch ( RoleManagerException e )
+ {
+ e.printStackTrace();
+ }
+ return SUCCESS;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/MainAction.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,39 @@
+package org.codehaus.plexus.redback.example.web.action;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.codehaus.plexus.redback.struts2.action.RedbackActionSupport;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Controller;
+
+/**
+ * PlexusSecuritySystemAction:
+ *
+ * @author Jesse McConnell <je...@codehaus.org>
+ * @version $Id$
+ */
+@Controller("status")
+@Scope("prototype")
+public class StatusAction
+ extends RedbackActionSupport
+{
+
+ public String status()
+ {
+ return SUCCESS;
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/java/org/codehaus/plexus/redback/example/web/action/StatusAction.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,73 @@
+<redback-role-model>
+ <modelVersion>1.0.0</modelVersion>
+ <applications>
+ <application>
+ <id>Redback</id>
+ <version>1.0</version>
+ <operations>
+ <operation>
+ <id>redback-operation-1</id>
+ <name>redback-operation-1</name>
+ <description>Redback Operation 1</description>
+ </operation>
+ <operation>
+ <id>redback-operation-2</id>
+ <name>redback-operation-2</name>
+ <description>Redback Operation 2</description>
+ </operation>
+ <operation>
+ <id>redback-operation-3</id>
+ <name>redback-operation-3</name>
+ <description>Redback Operation 3</description>
+ </operation>
+ </operations>
+ <templates>
+ <template>
+ <id>template1</id>
+ <namePrefix>Template1</namePrefix>
+ <assignable>true</assignable>
+ <permissions>
+ <permission>
+ <id>permission-1</id>
+ <name>Permission 1</name>
+ <operation>redback-operation-1</operation>
+ <resource>${resource}</resource>
+ </permission>
+ </permissions>
+ </template>
+ <template>
+ <id>template2</id>
+ <namePrefix>Template2</namePrefix>
+ <assignable>true</assignable>
+ <permissions>
+ <permission>
+ <id>permission-2</id>
+ <name>Permission 2</name>
+ <operation>redback-operation-2</operation>
+ <resource>${resource}</resource>
+ </permission>
+ </permissions>
+ <childTemplates>
+ <childTemplate>template1</childTemplate>
+ </childTemplates>
+ </template>
+ <template>
+ <id>template3</id>
+ <namePrefix>Template3</namePrefix>
+ <assignable>true</assignable>
+ <permissions>
+ <permission>
+ <id>permission-3</id>
+ <name>Permission 3</name>
+ <operation>redback-operation-3</operation>
+ <resource>${resource}</resource>
+ </permission>
+ </permissions>
+ <childTemplates>
+ <childTemplate>template2</childTemplate>
+ </childTemplates>
+ </template>
+ </templates>
+ </application>
+ </applications>
+</redback-role-model>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/redback/redback.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+ <context:annotation-config />
+ <context:component-scan base-package="org.codehaus.plexus.redback.example.web"/>
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:executable =
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/META-INF/spring-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
+
+ <appender name="outputLog" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="file" value="${appserver.base}/logs/redback.log" />
+ <param name="append" value="true" />
+ <param name="datePattern" value="'.'yyyy-MM-dd" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c %x - %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="auditLog" class="org.apache.log4j.DailyRollingFileAppender">
+ <param name="file" value="${appserver.base}/logs/redback-audit.log" />
+ <param name="append" value="true" />
+ <param name="datePattern" value="'.'yyyy-MM-dd" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} - %X{redback.currentUser} - %m%n"/>
+ </layout>
+ </appender>
+
+ <logger name="org.codehaus.plexus.redback.struts2.action.AuditEvent" additivity="false">
+ <level value="info" />
+ <appender-ref ref="auditLog" />
+ </logger>
+
+ <root>
+ <priority value="info" />
+ <appender-ref ref="outputLog" />
+ </root>
+
+</log4j:configuration>
+
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/log4j.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties Fri Apr 6 09:58:14 2012
@@ -0,0 +1,25 @@
+#struts.objectFactory = org.codehaus.plexus.xwork.PlexusObjectFactory
+#struts.tag.altSyntax = true
+
+#struts.objectFactory = org.codehaus.plexus.spring.Struts2PlexusInSpringObjectFactory
+
+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.codehaus.plexus.redback.struts2.default,org.codehaus.plexus.redback.example.custom
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,79 @@
+<!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"/>
+
+ <!-- ==================================================================
+ Application Webapp Specific Configuration.
+ ================================================================== -->
+
+ <constant name="struts.action.extension" value="action" />
+
+ <package name="root" extends="struts-default" namespace="/">
+ <interceptors>
+ <interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/>
+ <interceptor name="redbackEnvCheck" class="redbackEnvironmentCheckInterceptor"/>
+ <interceptor name="redbackAutoLogin" class="redbackAutoLoginInterceptor"/>
+ <interceptor name="redbackSecureActions" class="redbackSecureActionInterceptor"/>
+ <interceptor name="redbackPolicyEnforcement" class="redbackPolicyEnforcementInterceptor"/>
+ <interceptor-stack name="securedStack">
+ <interceptor-ref name="defaultStack"/>
+ <interceptor-ref name="redbackEnvCheck"/>
+ <interceptor-ref name="redbackForceAdminUser"/>
+ <interceptor-ref name="redbackAutoLogin"/>
+ <interceptor-ref name="redbackPolicyEnforcement"/>
+ <interceptor-ref name="redbackSecureActions"/>
+ <interceptor-ref name="tokenSession">
+ <param name="excludeMethods">*</param>
+ </interceptor-ref>
+ </interceptor-stack>
+ <interceptor-stack name="securedPrepareParamsStack">
+ <interceptor-ref name="paramsPrepareParamsStack"/>
+ <interceptor-ref name="redbackEnvCheck"/>
+ <interceptor-ref name="redbackForceAdminUser"/>
+ <interceptor-ref name="redbackAutoLogin"/>
+ <interceptor-ref name="redbackPolicyEnforcement"/>
+ <interceptor-ref name="redbackSecureActions"/>
+ </interceptor-stack>
+ </interceptors>
+
+ <default-interceptor-ref name="securedStack"/>
+
+ <global-results>
+ <result name="security-login-success" type="redirectAction">main</result>
+ <result name="security-login-cancel" type="redirectAction">main</result>
+ <result name="security-login-locked" type="redirectAction">main</result>
+ <result name="security-logout" type="redirectAction">main</result>
+ <result name="security-register-success" type="redirectAction">main</result>
+ <result name="security-register-cancel" type="redirectAction">main</result>
+ <result name="security-account-success" type="redirectAction">main</result>
+ <result name="security-account-cancel" type="redirectAction">main</result>
+
+ <result name="security-admin-user-needed" type="redirectAction">
+ <param name="actionName">addadmin</param>
+ <param name="namespace">/security</param>
+ </result>
+
+ <result name="security-must-change-password" type="redirectAction">
+ <param name="actionName">password</param>
+ <param name="namespace">/security</param>
+ </result>
+
+ <result name="error">/WEB-INF/jsp/redback/generalError.jsp</result>
+ <result name="invalid.token">/WEB-INF/jsp/redback/invalidToken.jsp</result>
+ <result name="requires-authentication">/WEB-INF/jsp/requiresAuthentication.jsp</result>
+ <result name="requires-authorization">/WEB-INF/jsp/accessDenied.jsp</result>
+ </global-results>
+
+ <action name="redbackRedirect" class="redback-redirect" method="redirect">
+ <result type="redirectAction">main</result>
+ </action>
+
+ <action name="main" class="main" method="show">
+ <result name="success">/WEB-INF/jsp/mainpage.jsp</result>
+ </action>
+
+ </package>
+</struts>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/resources/struts.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+ <context:property-placeholder system-properties-mode="OVERRIDE"/>
+
+ <bean id="mailSession" class="org.springframework.jndi.JndiObjectFactoryBean">
+ <property name="jndiName" value="java:comp/env/mail/Session">
+ </property>
+ </bean>
+
+ <bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
+ <property name="session" ref="mailSession"/>
+ </bean>
+
+ <bean id="loginService" class="org.codehaus.redback.xmlrpc.service.LoginServiceImpl">
+ <constructor-arg ref="securitySystem" />
+ </bean>
+
+ <bean name="xmlrpcServicesList" class="java.util.ArrayList">
+ <constructor-arg>
+ <list>
+ <ref bean="loginService" />
+ </list>
+ </constructor-arg>
+ </bean>
+
+ <bean name="userConfiguration" class="org.codehaus.plexus.redback.configuration.UserConfiguration">
+ <property name="configs">
+ <list>
+ <value>${user.home}/.m2/security.properties</value>
+ <value>${user.home}/.m2/security-example.properties</value>
+ </list>
+ </property>
+ </bean>
+
+ <!--
+
+ this is default component so no need to override
+ <component>
+ <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.policy.DefaultUserSecurityPolicy</implementation>
+ <description>User Security Policy.</description>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.configuration.UserConfiguration</role>
+ <field-name>config</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.PasswordEncoder</role>
+ <role-hint>sha1</role-hint>
+ <field-name>passwordEncoder</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.UserValidationSettings</role>
+ <field-name>userValidationSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.CookieSettings</role>
+ <role-hint>rememberMe</role-hint>
+ <field-name>rememberMeCookieSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.CookieSettings</role>
+ <role-hint>signon</role-hint>
+ <field-name>signonCookieSettings</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.PasswordRule</role>
+ <field-name>rules</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+
+ -->
+
+</beans>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/applicationContext.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,21 @@
+<!--
+ ~ 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.
+ -->
+
+<decorators defaultdir="/WEB-INF/jsp/decorators">
+ <decorator name="default" page="default.jsp">
+ <pattern>/*</pattern>
+ </decorator>
+</decorators>
\ No newline at end of file
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/decorators.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp Fri Apr 6 09:58:14 2012
@@ -0,0 +1,177 @@
+<%--
+ ~ Copyright 2005-2006 The Codehaus.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ --%>
+
+<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
+<%@ taglib uri="/struts-tags" prefix="s" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="redback" uri="/redback/taglib-1.0" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html>
+<head>
+ <title>Redback Struts2 Example Webapp ::
+ <decorator:title default="Redback Struts2 Example Webapp"/>
+ </title>
+
+ <style type="text/css" media="all">
+ @IMPORT url("/css/main.css");
+ @IMPORT url("/css/redback/table.css");
+ </style>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+</head>
+
+<body onload="<decorator:getProperty property="body.onload" />" class="composite">
+
+<div id="banner">
+ <s:url id="main" action="main" namespace="/" includeParams="none"/>
+ <h1><s:a href="%{main}">Redback Struts2 Example Webapp</s:a></h1>
+ <div class="clear">
+ </div>
+</div>
+
+<div id="breadcrumbs">
+ <div class="xright">
+ <a href="http://www.codehaus.org/">Codehaus</a> |
+ <a href="http://redback.codehaus.org/">Redback</a>
+ </div>
+
+ <div class="xleft">
+ <c:import url="/WEB-INF/jsp/redback/include/securityLinks.jsp"/>
+ </div>
+
+ <div class="clear">
+ </div>
+</div>
+
+ <p class="note">
+ Guest access is :
+ <redback:ifAuthorized permission="guest-access">
+ <b>Enabled</b>
+ </redback:ifAuthorized>
+ <redback:elseAuthorized>
+ <b>Disabled</b>
+ </redback:elseAuthorized>
+ </p>
+
+ <p class="note">
+ <c:if test="${sessionScope.securitySession.user != null}">
+ Encoded Password: <c:out value="${sessionScope.securitySession.user.encodedPassword}"/><br/>
+ Password Change Required Password: <c:out value="${sessionScope.securitySession.user.passwordChangeRequired}"/>
+ </c:if>
+ </p>
+
+
+ <p class="note">The gray content is arriving via the /WEB-INF/jsp/decorators/default.jsp managed by sitemesh.<br/>
+ Everything within the white box below is the actual jsp content.</p>
+ <div id="nestedContent">
+ <decorator:body/>
+ </div>
+
+ <div id="xworkinfo">
+
+ <%--
+ <strong>application scope:</strong>
+ <ul>
+ <c:choose>
+ <c:when test="${!empty applicationScope}">
+ <c:forEach var="ss" items="${applicationScope}">
+ <li>
+ <em><c:out value="${ss.key}" /></em> :
+ <c:choose>
+ <c:when test="${ss != null}">
+ (<c:out value="${ss.value.class.name}" /> ) <br />
+ <c:out value="${ss.value}" />
+ </c:when>
+ <c:otherwise>
+ <null>
+ </c:otherwise>
+ </c:choose>
+ </li>
+ </c:forEach>
+ </c:when>
+ <c:otherwise>
+ <li>[ empty ]</li>
+ </c:otherwise>
+ </c:choose>
+ </ul>
+ --%>
+
+ <strong>session scope:</strong>
+ <ul>
+ <c:forEach var="ss" items="${sessionScope}">
+ <li>
+ <em><c:out value="${ss.key}" /></em> :
+ <c:choose>
+ <c:when test="${ss.value != null}">
+ (<c:out value="${ss.value.class.name}" /> ) <br />
+ <c:out value="${ss.value}" />
+ </c:when>
+ <c:otherwise>
+ <null>
+ </c:otherwise>
+ </c:choose>
+ </li>
+ </c:forEach>
+ </ul>
+
+ <strong>request scope:</strong>
+ <ul>
+ <c:forEach var="rs" items="${requestScope}">
+ <li>
+ <em><c:out value="${rs.key}" /></em> :
+ <c:choose>
+ <c:when test="${rs.value != null}">
+ (<c:out value="${rs.value.class.name}" /> ) <br />
+ <c:out value="${rs.value}" />
+ </c:when>
+ <c:otherwise>
+ <null>
+ </c:otherwise>
+ </c:choose>
+ </li>
+ </c:forEach>
+ </ul>
+
+ <strong>page scope:</strong>
+ <ul>
+ <c:forEach var="ps" items="${requestScope}">
+ <li>
+ <em><c:out value="${ps.key}" /></em> :
+ <c:choose>
+ <c:when test="${ps.value != null}">
+ (<c:out value="${ps.value.class.name}" /> ) <br />
+ <c:out value="${ps.value}" />
+ </c:when>
+ <c:otherwise>
+ <null>
+ </c:otherwise>
+ </c:choose>
+ </li>
+ </c:forEach>
+ </ul>
+
+ </div>
+
+<div class="clear">
+</div>
+
+<div id="footer">
+ <div class="xright">© 2006 Codehaus.org </div>
+ <div class="clear">
+ </div>
+</div>
+</body>
+</html>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp Fri Apr 6 09:58:14 2012
@@ -0,0 +1,81 @@
+<%--
+ ~ 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="redback" uri="/redback/taglib-1.0" %>
+
+<html>
+
+<head>
+ <title>Redback Security Example Webapp</title>
+ <s:head />
+</head>
+
+<body>
+
+<h4>This is the example mainpage</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>
+
+<ol>
+<li>
+ <redback:ifAuthorized permission="user-management-manage-data">
+ <p/>
+ <s:url id="backupRestoreUrl" action="backupRestore" namespace="/security"/>
+ <ul>
+ <li>Go see the <s:a href="%{backupRestoreUrl}">backup-restore</s:a>.</li>
+ </ul>
+ </redback:ifAuthorized>
+
+ <redback:ifAuthorized permission="user-management-user-list">
+ You are authorized to see this content!
+ <p/>
+
+ <s:url id="userlistUrl" action="userlist" namespace="/security"/>
+ <s:url id="rolesUrl" action="roles" namespace="/security"/>
+
+ <ul>
+ <li>Go see the <s:a href="%{userlistUrl}">userlist</s:a>.</li>
+ <li>Go see the <s:a href="%{rolesUrl}">roles</s:a>.</li>
+ </ul>
+
+
+ </redback:ifAuthorized>
+ <redback:elseAuthorized>
+ <redback:ifAuthorized permission="user-management-user-edit" resource="${sessionScope.securitySession.user.username}">
+ Your logged in, you just don't have access to much...
+ </redback:ifAuthorized>
+ <redback:elseAuthorized>
+ <s:url id="login" action="login" namespace="/security" />
+ Go Ahead <s:a href="%{login}">Login.</s:a>
+ </redback:elseAuthorized>
+ </redback:elseAuthorized>
+
+</li>
+</ol>
+
+</body>
+
+</html>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/jsp/mainpage.jsp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ 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">
+
+ <display-name>Plexus Redback Example Webapp</display-name>
+
+ <filter>
+ <filter-name>struts2-cleanup</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
+ </filter>
+
+ <filter>
+ <filter-name>sitemesh</filter-name>
+ <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
+ </filter>
+
+ <filter>
+ <filter-name>struts2</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>struts2-cleanup</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>sitemesh</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>struts2</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>
+ classpath*:META-INF/spring-context.xml
+ /WEB-INF/applicationContext.xml
+ </param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>RedbackXmlRpcServlet</servlet-name>
+ <servlet-class>
+ com.atlassian.xmlrpc.spring.BinderSpringXmlRpcServlet
+ </servlet-class>
+ <init-param>
+ <param-name>serviceListBeanName</param-name>
+ <param-value>xmlrpcServicesList</param-value>
+ </init-param>
+ <init-param>
+ <param-name>enabledForExtensions</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>RedbackXmlRpcServlet</servlet-name>
+ <url-pattern>/redback/xmlrpc</url-pattern>
+ </servlet-mapping>
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+ <!--resource-ref>
+ <res-ref-name>jdbc/users</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref-->
+
+</web-app>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css Fri Apr 6 09:58:14 2012
@@ -0,0 +1,105 @@
+body {
+ background-color: #dddddd;
+ color: #777777;
+}
+
+.clear {
+ clear: both;
+}
+
+#banner {
+ background-color: #c0c0c0;
+ padding: 10px 5px 0px 5px;
+ margin: 0px;
+}
+
+#banner h1 {
+ font-size: 1.5em;
+}
+
+#banner a {
+ color: #888888;
+ text-decoration: none;
+}
+
+#breadcrumbs {
+ background-color: #cccccc;
+ margin: 0px;
+ font-size: 0.9em;
+ padding: 5px;
+ border-bottom: 1px solid #aaaaaa;
+}
+
+#breadcrumbs a {
+ color: #888888;
+}
+
+#breadcrumbs .xright {
+ float:right;
+}
+
+.securityLinks {
+ background-color: white;
+ border: 1px solid black;
+ padding: 2px;
+ color: black;
+}
+
+.securityLinks a {
+ color: black !important;
+}
+
+.securityLinks .admin {
+ background-color: #ffdddd;
+ color: red;
+}
+
+.securityLinks .admin a {
+ color: red !important;
+}
+
+#nestedContent {
+ margin: 0px 30px 30px 30px;
+ padding: 5px;
+ border: 1px solid black;
+ background-color: white;
+ color: black;
+}
+
+#nestedContent .wwFormTable .errorMessage {
+ font-size: 0.8em;
+ font-weight: bold;
+}
+
+
+#xworkinfo {
+ font-size: 0.7em;
+}
+
+#footer {
+ border-top: 1px solid #aaaaaa;
+ font-size: 0.9em;
+}
+
+#footer .xright {
+ float: right;
+}
+
+.note {
+ margin: 30px 0px 0px 30px;
+ padding-bottom: 0px;
+ font-size: 0.6em;
+ color: gray;
+ font-style: italic;
+}
+
+.errorMessage,
+.errorLabel {
+ color: red;
+}
+
+.required {
+ color: red;
+}
+
+
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/css/main.css
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp Fri Apr 6 09:58:14 2012
@@ -0,0 +1,17 @@
+<%--
+ ~ 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.
+ --%>
+
+<%response.sendRedirect( request.getContextPath() + "/main.action" );%>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp Fri Apr 6 09:58:14 2012
@@ -0,0 +1,49 @@
+<%@ taglib uri="/struts-tags" prefix="s" %>
+<%@ taglib uri="/redback/taglib-1.0" prefix="redback" %>
+<html>
+ <head>
+ <title>Redback Security Example Webapp</title>
+ </head>
+ <body>
+ <p>
+ jsp tag test page
+ </p>
+ <hr/>
+ <p>
+ test of the jsp tag pss:ifAuthorized 1:<br/>
+ <br/>
+ you should see an X right here ->
+ <redback:ifAuthorized permission="foo">
+ X
+ </redback:ifAuthorized>
+ </p>
+ <hr/>
+ <p>
+ test of the jsp tag redback:ifAuthorized 2:<br/>
+ <br/>
+ you should NOT see an X right here ->
+ <redback:ifAuthorized permission="bar">
+ X
+ </redback:ifAuthorized>
+ </p>
+ <hr/>
+ <p>
+ test of the jsp tag redback:ifAnyAuthorized 3:<br/>
+ <br/>
+ you should see an X right here ->
+ <redback:ifAnyAuthorized permissions="foo,bar">
+ X
+ </redback:ifAnyAuthorized>
+ </p>
+ <hr/>
+ <p>
+ test of the jsp tag redback:ifAnyAuthorized 4:<br/>
+ <br/>
+ you should NOT see an X right here ->
+ <redback:ifAnyAuthorized permissions="bar,dor">
+ X
+ </redback:ifAnyAuthorized>
+ </p>
+ <hr/>
+ </body>
+</html>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/main/webapp/taglib-test.jsp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,39 @@
+<?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 log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
+ </layout>
+ </appender>
+ <logger name="org.apache.commons.configuration.DefaultConfigurationBuilder">
+ <level value="error"/>
+ </logger>
+
+ <root>
+ <priority value ="info" />
+ <appender-ref ref="console" />
+ </root>
+
+</log4j:configuration>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/log4j.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,31 @@
+<?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.
+ -->
+<Context path="/">
+ <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
+ username="sa"
+ password=""
+ driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
+ url="jdbc:derby:${catalina.base}/target/database/users;create=true"
+ />
+ <Resource name="mail/Session" auth="Container"
+ type="javax.mail.Session"
+ mail.smtp.host="localhost"/>
+
+</Context>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-example/src/test/tomcat/tomcat-context.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml Fri Apr 6 09:58:14 2012
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2005-2006 The Codehaus.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-struts2</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </parent>
+ <artifactId>redback-struts2-integration</artifactId>
+ <name>Redback :: Integration :: Struts 2 Integration</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <!-- ================================================================ -->
+ <!-- Core Plexus Security Dependencies -->
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-policy</artifactId>
+ </dependency>
+ <!-- User Management / Authentication -->
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-users</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-ldap</artifactId>
+ </dependency>
+ <!-- Keys Management / Authentication -->
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-keys-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-keys</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <!-- RBAC Management / Authorization -->
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authorization-rbac</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-rbac-role-manager</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-rbac-cached</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-users-ldap</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-users-configurable</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-data-management</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-common-integrations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.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.derby</groupId>
+ <artifactId>derby</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-keys-memory</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-authentication-memory</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.redback</groupId>
+ <artifactId>redback-rbac-memory</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.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.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>log4j-over-slf4j</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>${logbackVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logbackVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-access</artifactId>
+ <version>${logbackVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <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>
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,110 @@
+package org.codehaus.plexus.redback.struts2.action;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.struts2.ServletActionContext;
+import org.codehaus.plexus.redback.policy.PasswordRuleViolationException;
+import org.codehaus.plexus.redback.policy.PasswordRuleViolations;
+import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.codehaus.redback.integration.interceptor.SecureAction;
+import org.codehaus.redback.integration.interceptor.SecureActionBundle;
+import org.codehaus.redback.integration.interceptor.SecureActionException;
+
+/**
+ * AbstractSecurityAction
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+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;
+ }
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractSecurityAction.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java Fri Apr 6 09:58:14 2012
@@ -0,0 +1,244 @@
+package org.codehaus.plexus.redback.struts2.action;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.codehaus.plexus.redback.policy.PasswordRuleViolationException;
+import org.codehaus.plexus.redback.rbac.Permission;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.RbacManagerException;
+import org.codehaus.plexus.redback.rbac.Resource;
+import org.codehaus.plexus.redback.rbac.Role;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.redback.integration.model.UserCredentials;
+import org.codehaus.redback.integration.role.RoleConstants;
+import org.codehaus.redback.integration.security.role.RedbackRoleConstants;
+import org.codehaus.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>
+ * @version $Id$
+ */
+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.codehaus.plexus.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 );
+ }
+}
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-struts2/redback-struts2-integration/src/main/java/org/codehaus/plexus/redback/struts2/action/AbstractUserCredentialsAction.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision