archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1310268 [12/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...
Date Fri, 06 Apr 2012 09:59:32 GMT
Added: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,186 @@
+package org.codehaus.redback.jsecurity;
+
+/*
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+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.UserAssignment;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.jsecurity.authc.AuthenticationException;
+import org.jsecurity.authc.AuthenticationInfo;
+import org.jsecurity.authc.AuthenticationToken;
+import org.jsecurity.authc.SimpleAuthenticationInfo;
+import org.jsecurity.authc.UsernamePasswordToken;
+import org.jsecurity.authc.credential.CredentialsMatcher;
+import org.jsecurity.authz.AuthorizationInfo;
+import org.jsecurity.authz.SimpleAuthorizationInfo;
+import org.jsecurity.realm.AuthorizingRealm;
+import org.jsecurity.subject.PrincipalCollection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RedbackRealm extends AuthorizingRealm
+{
+    private Logger log = LoggerFactory.getLogger(RedbackRealm.class);
+
+    private final UserManager userManager;
+
+    private final RBACManager rbacManager;
+
+    private final UserSecurityPolicy securityPolicy;
+
+    public RedbackRealm(UserManager userManager, RBACManager rbacManager, UserSecurityPolicy securityPolicy)
+    {
+        this.userManager = userManager;
+        this.rbacManager = rbacManager;
+        this.securityPolicy = securityPolicy;
+    }
+    
+    @Override
+    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals)
+    {
+        final String username = (String) principals.fromRealm(getName()).iterator().next();
+
+        try
+        {
+            final UserAssignment assignment = rbacManager.getUserAssignment(username);
+            final Set<String> roleNames = new HashSet<String>(assignment.getRoleNames());
+            final Set<String> permissions = new HashSet<String>();
+
+            for (Iterator<Permission> it = rbacManager.getAssignedPermissions(username).iterator(); it.hasNext();)
+            {
+                Permission permission = it.next();
+                permissions.add(permission.getName());
+            }
+
+            SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo(roleNames);
+            authorizationInfo.setStringPermissions(permissions);
+
+            return authorizationInfo;
+        }
+        catch (RbacManagerException e)
+        {
+            log.error("Could not authenticate against data source", e);
+        }
+        
+        return null;
+    }
+
+    @Override
+    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
+        throws AuthenticationException
+    {
+        if (token == null)
+        {
+            throw new AuthenticationException("AuthenticationToken cannot be null");
+        }
+        
+        final UsernamePasswordToken passwordToken = (UsernamePasswordToken)token;
+
+        User user = null;
+        try
+        {
+            user = userManager.findUser(passwordToken.getUsername());
+        }
+        catch (UserNotFoundException e)
+        {
+            log.error("Could not find user " + passwordToken.getUsername());
+        }
+
+        if (user == null)
+        {
+            return null;
+        }
+
+        if ( user.isLocked() && !user.isPasswordChangeRequired() )
+        {
+            throw new PrincipalLockedException("User " + user.getPrincipal() + " is locked.");
+        }
+
+        if ( user.isPasswordChangeRequired() )
+        {
+            throw new PrincipalPasswordChangeRequiredException("Password change is required for user " + user.getPrincipal());
+        }
+
+        return new RedbackAuthenticationInfo(user, getName());
+    }
+
+    @Override
+    public CredentialsMatcher getCredentialsMatcher()
+    {
+        return new CredentialsMatcher()
+        {
+            public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info)
+            {
+                final String credentials = new String((char[])token.getCredentials());
+                final boolean match = securityPolicy.getPasswordEncoder().encodePassword(credentials).equals((String)info.getCredentials());
+                if (!match)
+                {
+                    User user = ((RedbackAuthenticationInfo)info).getUser();
+                    try
+                    {
+                        securityPolicy.extensionExcessiveLoginAttempts( user );
+                    }
+                    catch (AccountLockedException e)
+                    {
+                        log.info("User{} has been locked", user.getUsername(), e);
+                    }
+                    finally
+                    {
+                        try
+                        {
+                            userManager.updateUser( user );
+                        }
+                        catch (UserNotFoundException e)
+                        {
+                            log.error("The user to be updated could not be found", e);
+                        }
+                    }
+                }
+                return match;
+            }
+        };
+    }
+
+    final class RedbackAuthenticationInfo extends SimpleAuthenticationInfo
+    {
+        private final User user;
+
+        public RedbackAuthenticationInfo(User user, String realmName)
+        {
+            super(user.getPrincipal(), user.getEncodedPassword(), realmName);
+            this.user = user;
+        }
+
+        public User getUser()
+        {
+            return user;
+        }
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/main/java/org/codehaus/redback/jsecurity/RedbackRealm.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,198 @@
+package org.codehaus.redback.jsecurity;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.rbac.Operation;
+import org.codehaus.plexus.redback.rbac.Permission;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.Resource;
+import org.codehaus.plexus.redback.rbac.Role;
+import org.codehaus.plexus.redback.rbac.UserAssignment;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.jsecurity.authc.IncorrectCredentialsException;
+import org.jsecurity.authc.UsernamePasswordToken;
+import org.jsecurity.mgt.DefaultSecurityManager;
+import org.jsecurity.subject.PrincipalCollection;
+import org.jsecurity.subject.SimplePrincipalCollection;
+import org.jsecurity.subject.Subject;
+import org.junit.After;
+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 javax.inject.Inject;
+import javax.inject.Named;
+
+
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+public class RedbackRealmTest
+    extends TestCase
+{
+    private DefaultSecurityManager securityManager;
+
+    private RedbackRealm realm;
+
+    @Inject
+    @Named( value = "userManager#memory" )
+    private UserManager userManager;
+
+    @Inject
+    @Named( value = "rBACManager#memory" )
+    private RBACManager rbacManager;
+
+    @Inject
+    private UserSecurityPolicy userSecurityPolicy;
+
+    private User user;
+
+    @Before
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        securityManager = new DefaultSecurityManager();
+
+
+
+        realm = new RedbackRealm( userManager, rbacManager, userSecurityPolicy );
+        securityManager.setRealm( realm );
+
+        user = userManager.createUser( "test1", "John Tester", "jtester@redback.codehaus.org" );
+        user.setPassword( "password1" );
+        userManager.addUser( user );
+        userManager.updateUser( user );
+    }
+
+    @After
+    public void tearDown()
+        throws Exception
+    {
+        super.tearDown();
+        securityManager.destroy();
+        securityManager = null;
+        realm = null;
+    }
+
+    protected String getPlexusConfigLocation()
+    {
+        return "plexus.xml";
+    }
+
+    public void testThrowsExceptionIfUserAccountLocked()
+        throws Exception
+    {
+        user.setLocked( true );
+        userManager.updateUser( user );
+        try
+        {
+            securityManager.login( new UsernamePasswordToken( "test1", "password1" ) );
+            fail( "Should not be able to login" );
+        }
+        catch ( PrincipalLockedException e )
+        {
+            assertTrue( true );
+        }
+    }
+
+    @Test
+    public void testThrowsExceptionIfUserAccountNeedsPasswordChange()
+        throws Exception
+    {
+        user.setPasswordChangeRequired( true );
+        userManager.updateUser( user );
+        try
+        {
+            securityManager.login( new UsernamePasswordToken( "test1", "password1" ) );
+            fail( "Should not be able to login" );
+        }
+        catch ( PrincipalPasswordChangeRequiredException e )
+        {
+            assertTrue( true );
+        }
+    }
+
+    @Test
+    public void testUnsuccessfullAuthAttemptsLockAccount()
+        throws Exception
+    {
+        assertFalse( user.isLocked() );
+        userSecurityPolicy.setLoginAttemptCount( 2 );
+        try
+        {
+            securityManager.login( new UsernamePasswordToken( "test1", "incorrectpassowrd" ) );
+            fail( "password should be incorrect" );
+        }
+        catch ( IncorrectCredentialsException e )
+        {
+            assertFalse( user.isLocked() );
+        }
+
+        try
+        {
+            securityManager.login( new UsernamePasswordToken( "test1", "incorrectpassowrd" ) );
+            fail( "password should be incorrect" );
+        }
+        catch ( IncorrectCredentialsException e )
+        {
+            assertTrue( user.isLocked() );
+        }
+    }
+
+    @Test
+    public void testBasic()
+        throws Exception
+    {
+        assertEquals( 1, userManager.getUsers().size() );
+
+        Role role1 = rbacManager.createRole( "role1" );
+        Permission permission = rbacManager.createPermission( "Allowed to write to repository" );
+        Operation operation = rbacManager.createOperation( "myop" );
+        Resource resource = rbacManager.createResource( "filesystem" );
+
+        permission.setOperation( operation );
+        permission.setPermanent( false );
+        permission.setResource( resource );
+
+        role1.addPermission( permission );
+        rbacManager.savePermission( permission );
+        rbacManager.saveRole( role1 );
+
+        Role role2 = rbacManager.createRole( "role2" );
+
+        UserAssignment assignment = rbacManager.createUserAssignment( user.getUsername() );
+        assignment.addRoleName( "role1" );
+        rbacManager.saveUserAssignment( assignment );
+
+        Subject subject = securityManager.login( new UsernamePasswordToken( "test1", "password1" ) );
+        assertTrue( subject.isAuthenticated() );
+        assertTrue( subject.hasRole( "role1" ) );
+        assertFalse( subject.hasRole( "role2" ) );
+
+        PrincipalCollection principals = new SimplePrincipalCollection( "test1", realm.getName() );
+
+        assertTrue( securityManager.isPermitted( principals, "Allowed to write to repository" ) );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-jsecurity/src/test/java/org/codehaus/redback/jsecurity/RedbackRealmTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml Fri Apr  6 09:58:14 2012
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+  ~ Copyright 2011 The Codehaus.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <groupId>org.codehaus.redback</groupId>
+    <artifactId>redback-integrations</artifactId>
+    <version>1.5-SNAPSHOT</version>
+  </parent>
+  
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.codehaus.redback</groupId>
+  <artifactId>redback-rest</artifactId>
+  <packaging>pom</packaging>
+  <name>Redback :: REST</name>
+  
+  <modules>
+    <module>redback-rest-api</module>
+    <module>redback-rest-services</module>
+  </modules>
+</project>
\ No newline at end of file

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml Fri Apr  6 09:58:14 2012
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<!--
+  ~ Copyright 2011 The Codehaus.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>redback-rest</artifactId>
+    <groupId>org.codehaus.redback</groupId>
+    <version>1.5-SNAPSHOT</version>
+  </parent>
+  <artifactId>redback-rest-api</artifactId>
+  <name>Redback :: REST :: Api</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-authorization-api</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>
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>jsr311-api</artifactId>
+    </dependency>
+    <!-- normally not needed but here for wadl feature currently in cxf -->
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-bundle-jaxrs</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bind-sources</id>
+            <goals>
+              <goal>jar-no-fork</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,95 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ */
+@XmlRootElement( name = "application" )
+public class Application
+    implements Serializable
+{
+    /**
+     * Field version
+     */
+    private String version;
+
+    /**
+     * Field id
+     */
+    private String id;
+
+    /**
+     * Field description
+     */
+    private String description;
+
+    /**
+     * Field longDescription
+     */
+    private String longDescription;
+
+    public Application()
+    {
+        // no op
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getLongDescription()
+    {
+        return longDescription;
+    }
+
+    public void setLongDescription( String longDescription )
+    {
+        this.longDescription = longDescription;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,123 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.Collection;
+
+
+/**
+ * @author Olivier Lamy
+ * @since 1.5
+ */
+@XmlRootElement( name = "applicationRole" )
+public class ApplicationRoles
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private Collection<String> globalRoles;
+
+    private Collection<RoleTemplate> roleTemplates;
+
+    private Collection<String> resources;
+
+
+    public ApplicationRoles()
+    {
+        // no op
+    }
+
+    public ApplicationRoles( String name, String description, Collection<String> globalRoles,
+                             Collection<RoleTemplate> roleTemplates, Collection<String> resources )
+    {
+        this.name = name;
+        this.description = description;
+        this.globalRoles = globalRoles;
+        this.roleTemplates = roleTemplates;
+        this.resources = resources;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public Collection<String> getGlobalRoles()
+    {
+        return globalRoles;
+    }
+
+    public void setGlobalRoles( Collection<String> globalRoles )
+    {
+        this.globalRoles = globalRoles;
+    }
+
+    public Collection<RoleTemplate> getRoleTemplates()
+    {
+        return roleTemplates;
+    }
+
+    public void setRoleTemplates( Collection<RoleTemplate> roleTemplates )
+    {
+        this.roleTemplates = roleTemplates;
+    }
+
+    public Collection<String> getResources()
+    {
+        return resources;
+    }
+
+    public void setResources( Collection<String> resources )
+    {
+        this.resources = resources;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "ApplicationRoles" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", globalRoles=" ).append( globalRoles );
+        sb.append( ", roleTemplates=" ).append( roleTemplates );
+        sb.append( ", resources=" ).append( resources );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,74 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "errorMessage" )
+public class ErrorMessage
+    implements Serializable
+{
+    private String errorKey;
+
+    private String[] args;
+
+    private static final String[] EMPTY = new String[0];
+
+    public ErrorMessage()
+    {
+        // no op
+    }
+
+    public ErrorMessage( String errorKey )
+    {
+        this.errorKey = errorKey;
+        this.args = EMPTY;
+    }
+
+    public ErrorMessage( String errorKey, String[] args )
+    {
+        this.errorKey = errorKey;
+        this.args = args;
+    }
+
+    public String getErrorKey()
+    {
+        return errorKey;
+    }
+
+    public void setErrorKey( String errorKey )
+    {
+        this.errorKey = errorKey;
+    }
+
+    public String[] getArgs()
+    {
+        return args;
+    }
+
+    public void setArgs( String[] args )
+    {
+        this.args = args;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,91 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "operation" )
+public class Operation
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private boolean permanent;
+
+    public Operation()
+    {
+        // no op
+    }
+
+    public Operation( org.codehaus.plexus.redback.rbac.Operation operation )
+    {
+        this.name = operation.getName();
+        this.description = operation.getDescription();
+        this.permanent = operation.isPermanent();
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Operation" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,99 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "permission" )
+public class Permission
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private Operation operation;
+
+    private Resource resource;
+
+    private boolean permanent;
+
+    public Permission()
+    {
+        // no op
+    }
+
+    public Permission( org.codehaus.plexus.redback.rbac.Permission permission )
+    {
+        this.name = permission.getName();
+        this.description = permission.getDescription();
+        this.operation = permission.getOperation() == null ? null : new Operation( permission.getOperation() );
+        this.resource = permission.getResource() == null ? null : new Resource( permission.getResource() );
+        this.permanent = permission.isPermanent();
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public Operation getOperation()
+    {
+        return operation;
+    }
+
+    public void setOperation( Operation operation )
+    {
+        this.operation = operation;
+    }
+
+    public Resource getResource()
+    {
+        return resource;
+    }
+
+    public void setResource( Resource resource )
+    {
+        this.resource = resource;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Permission" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", operation=" ).append( operation );
+        sb.append( ", resource=" ).append( resource );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,69 @@
+package org.codehaus.redback.rest.api.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.commons.lang.StringUtils;
+import org.codehaus.redback.rest.api.services.RedbackServiceException;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "redbackRestError" )
+public class RedbackRestError
+    implements Serializable
+{
+
+    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>( 1 );
+
+    public RedbackRestError()
+    {
+        // no op
+    }
+
+    public RedbackRestError( RedbackServiceException e )
+    {
+        errorMessages.addAll( e.getErrorMessages() );
+        if ( e.getErrorMessages().isEmpty() && StringUtils.isNotEmpty( e.getMessage() ) )
+        {
+            errorMessages.add( new ErrorMessage( e.getMessage(), null ) );
+        }
+    }
+
+
+    public List<ErrorMessage> getErrorMessages()
+    {
+        return errorMessages;
+    }
+
+    public void setErrorMessages( List<ErrorMessage> errorMessages )
+    {
+        this.errorMessages = errorMessages;
+    }
+
+    public void addErrorMessage( ErrorMessage errorMessage )
+    {
+        this.errorMessages.add( errorMessage );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,53 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "registrationKey" )
+public class RegistrationKey
+    implements Serializable
+{
+    private String key;
+
+    public RegistrationKey()
+    {
+        // nope
+    }
+
+    public RegistrationKey( String key )
+    {
+        this.key = key;
+    }
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,91 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "resource" )
+public class Resource
+    implements Serializable
+{
+    private String identifier;
+
+    private boolean pattern;
+
+    private boolean permanent;
+
+    public Resource()
+    {
+        // no op
+    }
+
+    public Resource( org.codehaus.plexus.redback.rbac.Resource resource )
+    {
+        this.identifier = resource.getIdentifier();
+        this.pattern = resource.isPattern();
+        this.permanent = resource.isPermanent();
+    }
+
+    public String getIdentifier()
+    {
+        return identifier;
+    }
+
+    public void setIdentifier( String identifier )
+    {
+        this.identifier = identifier;
+    }
+
+    public boolean isPattern()
+    {
+        return pattern;
+    }
+
+    public void setPattern( boolean pattern )
+    {
+        this.pattern = pattern;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Resource" );
+        sb.append( "{identifier='" ).append( identifier ).append( '\'' );
+        sb.append( ", pattern=" ).append( pattern );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,282 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "role" )
+public class Role
+    implements Serializable
+{
+    /**
+     * Field name
+     */
+    private String name;
+
+    /**
+     * Field description
+     */
+    private String description;
+
+    /**
+     * Field assignable
+     */
+    private boolean assignable = false;
+
+    /**
+     * Field childRoleNames
+     */
+    private List<String> childRoleNames = new ArrayList<String>(0);
+
+    /**
+     * Field permissions
+     */
+    private List<Permission> permissions = new ArrayList<Permission>(0);
+
+    /**
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<String> parentRoleNames = new ArrayList<String>(0);
+
+    /**
+     * user with a parent role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> parentsRolesUsers = new ArrayList<User>(0);
+
+    /**
+     * user with this role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> users = new ArrayList<User>(0);
+
+    /**
+     * users without this role or parent role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> otherUsers = new ArrayList<User>(0);
+
+    /**
+     * users to remove assignement to this role
+     */
+    private List<User> removedUsers = new ArrayList<User>(0);
+
+    /**
+     * Field permanent
+     */
+    private boolean permanent = false;
+
+    public Role()
+    {
+        // no op
+    }
+
+    public Role( String name )
+    {
+        this.name = name;
+    }
+
+    public Role( org.codehaus.plexus.redback.rbac.Role role )
+    {
+        this.name = role.getName();
+        this.description = role.getDescription();
+        this.assignable = role.isAssignable();
+        this.childRoleNames = role.getChildRoleNames() == null
+            ? new ArrayList<String>( 0 )
+            : new ArrayList<String>( role.getChildRoleNames() );
+
+        if ( role.getPermissions() == null )
+        {
+            this.permissions = new ArrayList<Permission>( 0 );
+        }
+        else
+        {
+            for ( org.codehaus.plexus.redback.rbac.Permission p : role.getPermissions() )
+            {
+                this.permissions.add( new Permission( p ) );
+            }
+        }
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public boolean isAssignable()
+    {
+        return assignable;
+    }
+
+    public void setAssignable( boolean assignable )
+    {
+        this.assignable = assignable;
+    }
+
+    public List<String> getChildRoleNames()
+    {
+        return childRoleNames;
+    }
+
+    public void setChildRoleNames( List<String> childRoleNames )
+    {
+        this.childRoleNames = childRoleNames;
+    }
+
+    public List<Permission> getPermissions()
+    {
+        return permissions;
+    }
+
+    public void setPermissions( List<Permission> permissions )
+    {
+        this.permissions = permissions;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    public List<String> getParentRoleNames()
+    {
+        return parentRoleNames;
+    }
+
+    public void setParentRoleNames( List<String> parentRoleNames )
+    {
+        this.parentRoleNames = parentRoleNames;
+    }
+
+    public List<User> getParentsRolesUsers()
+    {
+        return parentsRolesUsers;
+    }
+
+    public void setParentsRolesUsers( List<User> parentsRolesUsers )
+    {
+        this.parentsRolesUsers = parentsRolesUsers;
+    }
+
+    public List<User> getUsers()
+    {
+        return users;
+    }
+
+    public void setUsers( List<User> users )
+    {
+        this.users = users;
+    }
+
+    public List<User> getOtherUsers()
+    {
+        return otherUsers;
+    }
+
+    public void setOtherUsers( List<User> otherUsers )
+    {
+        this.otherUsers = otherUsers;
+    }
+
+    public List<User> getRemovedUsers()
+    {
+        return removedUsers;
+    }
+
+    public void setRemovedUsers( List<User> removedUsers )
+    {
+        this.removedUsers = removedUsers;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Role" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", assignable=" ).append( assignable );
+        sb.append( ", childRoleNames=" ).append( childRoleNames );
+        sb.append( ", permissions=" ).append( permissions );
+        sb.append( ", parentRoleNames=" ).append( parentRoleNames );
+        sb.append( ", parentsRolesUsers=" ).append( parentsRolesUsers );
+        sb.append( ", users=" ).append( users );
+        sb.append( ", otherUsers=" ).append( otherUsers );
+        sb.append( ", removedUsers=" ).append( removedUsers );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        Role role = (Role) o;
+
+        if ( name != null ? !name.equals( role.name ) : role.name != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return name != null ? name.hashCode() : 0;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,138 @@
+package org.codehaus.redback.rest.api.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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.5
+ */
+@XmlRootElement( name = "roleTemplate" )
+public class RoleTemplate
+    implements Serializable
+{
+    /**
+     * Field id
+     */
+    private String id;
+
+    private String namePrefix;
+
+    private String delimiter = " - ";
+
+    private String description;
+
+    private String resource;
+
+    private List<String> roles;
+
+    public RoleTemplate()
+    {
+        // no op
+    }
+
+    public RoleTemplate( String id, String namePrefix, String delimiter, String description, String resource,
+                         List<String> roles )
+    {
+        this.id = id;
+        this.namePrefix = namePrefix;
+        this.delimiter = delimiter;
+        this.description = description;
+        this.resource = resource;
+        this.roles = roles;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getNamePrefix()
+    {
+        return namePrefix;
+    }
+
+    public void setNamePrefix( String namePrefix )
+    {
+        this.namePrefix = namePrefix;
+    }
+
+    public String getDelimiter()
+    {
+        return delimiter;
+    }
+
+    public void setDelimiter( String delimiter )
+    {
+        this.delimiter = delimiter;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getResource()
+    {
+        return resource;
+    }
+
+    public void setResource( String resource )
+    {
+        this.resource = resource;
+    }
+
+    public List<String> getRoles()
+    {
+        return roles;
+    }
+
+    public void setRoles( List<String> roles )
+    {
+        this.roles = roles;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "RoleTemplate" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", namePrefix='" ).append( namePrefix ).append( '\'' );
+        sb.append( ", delimiter='" ).append( delimiter ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", resource='" ).append( resource ).append( '\'' );
+        sb.append( ", roles=" ).append( roles );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,287 @@
+package org.codehaus.redback.rest.api.model;
+
+import org.codehaus.redback.integration.util.DateUtils;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+/*
+* Copyright 2009 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.
+*/
+@XmlRootElement( name = "user" )
+public class User
+    implements Serializable
+{
+    private String username;
+
+    private String fullName;
+
+    private String email;
+
+    private boolean validated;
+
+    private boolean locked;
+
+    private String password;
+
+    private boolean passwordChangeRequired;
+
+    private boolean permanent;
+
+    private String confirmPassword;
+
+    // Display Only Fields.
+    private String timestampAccountCreation;
+
+    private String timestampLastLogin;
+
+    private String timestampLastPasswordChange;
+
+    /**
+     * for password change only
+     *
+     * @since 1.4
+     */
+    private String previousPassword;
+
+    /**
+     * for roles update only <b>not return on user read</b>
+     * @since 1.5
+     */
+    private List<String> assignedRoles;
+
+    public User()
+    {
+        // no op
+    }
+
+    public User( String username, String fullName, String email, boolean validated, boolean locked )
+    {
+        this.username = username;
+        this.fullName = fullName;
+        this.email = email;
+        this.validated = validated;
+        this.locked = locked;
+    }
+
+    public User( org.codehaus.plexus.redback.users.User user )
+    {
+        setUsername( user.getUsername() );
+        this.setEmail( user.getEmail() );
+        this.setFullName( user.getFullName() );
+        this.setLocked( user.isLocked() );
+        this.setPassword( user.getPassword() );
+        this.setValidated( user.isValidated() );
+        this.setPasswordChangeRequired( user.isPasswordChangeRequired() );
+        this.setPermanent( user.isPermanent() );
+
+        setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
+        setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
+        setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
+    }
+
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+
+    public String getFullName()
+    {
+        return fullName;
+    }
+
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+
+    public String getEmail()
+    {
+        return email;
+    }
+
+    public void setEmail( String email )
+    {
+        this.email = email;
+    }
+
+    public boolean isValidated()
+    {
+        return validated;
+    }
+
+    public void setValidated( boolean validated )
+    {
+        this.validated = validated;
+    }
+
+    public boolean isLocked()
+    {
+        return locked;
+    }
+
+    public void setLocked( boolean isLocked )
+    {
+        this.locked = isLocked;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword( String password )
+    {
+        this.password = password;
+    }
+
+    public boolean isPasswordChangeRequired()
+    {
+        return passwordChangeRequired;
+    }
+
+    public void setPasswordChangeRequired( boolean passwordChangeRequired )
+    {
+        this.passwordChangeRequired = passwordChangeRequired;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    public String getConfirmPassword()
+    {
+        return confirmPassword;
+    }
+
+    public void setConfirmPassword( String confirmPassword )
+    {
+        this.confirmPassword = confirmPassword;
+    }
+
+    public String getTimestampAccountCreation()
+    {
+        return timestampAccountCreation;
+    }
+
+    public void setTimestampAccountCreation( String timestampAccountCreation )
+    {
+        this.timestampAccountCreation = timestampAccountCreation;
+    }
+
+    public String getTimestampLastLogin()
+    {
+        return timestampLastLogin;
+    }
+
+    public void setTimestampLastLogin( String timestampLastLogin )
+    {
+        this.timestampLastLogin = timestampLastLogin;
+    }
+
+    public String getTimestampLastPasswordChange()
+    {
+        return timestampLastPasswordChange;
+    }
+
+    public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
+    {
+        this.timestampLastPasswordChange = timestampLastPasswordChange;
+    }
+
+    public String getPreviousPassword()
+    {
+        return previousPassword;
+    }
+
+    public void setPreviousPassword( String previousPassword )
+    {
+        this.previousPassword = previousPassword;
+    }
+
+    public List<String> getAssignedRoles()
+    {
+        return assignedRoles;
+    }
+
+    public void setAssignedRoles( List<String> assignedRoles )
+    {
+        this.assignedRoles = assignedRoles;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "User" );
+        sb.append( "{username='" ).append( username ).append( '\'' );
+        sb.append( ", fullName='" ).append( fullName ).append( '\'' );
+        sb.append( ", email='" ).append( email ).append( '\'' );
+        sb.append( ", validated=" ).append( validated );
+        sb.append( ", locked=" ).append( locked );
+        sb.append( ", password='" ).append( password ).append( '\'' );
+        sb.append( ", passwordChangeRequired=" ).append( passwordChangeRequired );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( ", confirmPassword='" ).append( confirmPassword ).append( '\'' );
+        sb.append( ", timestampAccountCreation='" ).append( timestampAccountCreation ).append( '\'' );
+        sb.append( ", timestampLastLogin='" ).append( timestampLastLogin ).append( '\'' );
+        sb.append( ", timestampLastPasswordChange='" ).append( timestampLastPasswordChange ).append( '\'' );
+        sb.append( ", previousPassword='" ).append( previousPassword ).append( '\'' );
+        sb.append( ", assignedRoles=" ).append( assignedRoles );
+        sb.append( '}' );
+        return sb.toString();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( !( o instanceof User ) )
+        {
+            return false;
+        }
+
+        User user = (User) o;
+
+        if ( !username.equals( user.username ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return username.hashCode();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,90 @@
+package org.codehaus.redback.rest.api.services;
+
+/*
+ * Copyright 2011 The Codehaus.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.cxf.jaxrs.model.wadl.Description;
+import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
+import org.codehaus.redback.rest.api.model.User;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+@Path( "/loginService/" )
+public interface LoginService
+{
+
+    @Path( "addAuthenticationKey" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    String addAuthenticationKey( @QueryParam( "providerKey" ) String providedKey,
+                                 @QueryParam( "principal" ) String principal, @QueryParam( "purpose" ) String purpose,
+                                 @QueryParam( "expirationMinutes" ) int expirationMinutes )
+        throws RedbackServiceException;
+
+
+    @Path( "ping" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean ping()
+        throws RedbackServiceException;
+
+
+    @Path( "pingWithAutz" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = false, noPermission = true )
+    Boolean pingWithAutz()
+        throws RedbackServiceException;
+
+    @Path( "logIn" )
+    @GET
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    /**
+     * check username/password and create a http session.
+     * So no more need of reuse username/password for all ajaxRequest
+     */
+    User logIn( @QueryParam( "userName" ) String userName, @QueryParam( "password" ) String password )
+        throws RedbackServiceException;
+
+    @Path( "isLogged" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    /**
+     * simply check if current user has an http session opened with authz passed
+     * @since 1.4
+     */
+    Boolean isLogged()
+        throws RedbackServiceException;
+
+    @Path( "logout" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * clear user http session
+     * @since 1.4
+     */
+    Boolean logout()
+        throws RedbackServiceException;
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,64 @@
+package org.codehaus.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
+import org.codehaus.redback.rest.api.model.User;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/passwordService/" )
+public interface PasswordService
+{
+    @GET
+    @Path( "changePasswordWithKey" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * used to change the password on first user connection after registration use.
+     * the key is mandatory and a control will be done on the username provided.
+     * <b>need to be logged by {@link UserService#validateUserFromKey(String)}</b>
+     * @return username
+     */
+    User changePasswordWithKey( @QueryParam( "password" ) String password,
+                                  @QueryParam( "passwordConfirmation" ) String passwordConfirmation,
+                                  @QueryParam( "key" ) String key )
+        throws RedbackServiceException;
+
+    @GET
+    @Path( "changePassword" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * used to change the password on passwordChangeRequired state.
+     */
+    User changePassword( @QueryParam( "userName" ) String userName,
+                            @QueryParam( "previousPassword" ) String previousPassword,
+                            @QueryParam( "password" ) String password,
+                            @QueryParam( "passwordConfirmation" ) String passwordConfirmation )
+        throws RedbackServiceException;
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,92 @@
+package org.codehaus.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.redback.rest.api.model.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.3
+ */
+public class RedbackServiceException
+    extends Exception
+{
+    private int httpErrorCode = 500;
+
+    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>(0);
+
+    public RedbackServiceException( String s )
+    {
+        super( s );
+    }
+
+    public RedbackServiceException( String s, int httpErrorCode )
+    {
+        super( s );
+        this.httpErrorCode = httpErrorCode;
+    }
+
+    public RedbackServiceException( ErrorMessage errorMessage )
+    {
+        errorMessages.add( errorMessage );
+    }
+
+    public RedbackServiceException( ErrorMessage errorMessage, int httpErrorCode )
+    {
+        this.httpErrorCode = httpErrorCode;
+        errorMessages.add( errorMessage );
+    }
+
+    public RedbackServiceException( List<ErrorMessage> errorMessage )
+    {
+        errorMessages.addAll( errorMessage );
+    }
+
+    public int getHttpErrorCode()
+    {
+        return httpErrorCode;
+    }
+
+    public void setHttpErrorCode( int httpErrorCode )
+    {
+        this.httpErrorCode = httpErrorCode;
+    }
+
+    public List<ErrorMessage> getErrorMessages()
+    {
+        if ( errorMessages == null )
+        {
+            this.errorMessages = new ArrayList<ErrorMessage>();
+        }
+        return errorMessages;
+    }
+
+    public void setErrorMessages( List<ErrorMessage> errorMessages )
+    {
+        this.errorMessages = errorMessages;
+    }
+
+    public void addErrorMessage( ErrorMessage errorMessage )
+    {
+        this.errorMessages.add( errorMessage );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message