--- /dev/null
+package org.apache.archiva.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;
+ }
+}
--- /dev/null
+package org.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.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;
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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 );
+ }
+}
--- /dev/null
+package org.apache.archiva.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;
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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.apache.archiva.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;
+ }
+}
--- /dev/null
+package org.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.redback.rest.api.model;
+
+import org.apache.archiva.redback.integration.util.DateUtils;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+/*
+ * 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.
+ */
+
+@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.apache.archiva.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();
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.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;
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.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;
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.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 );
+ }
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
+import org.apache.archiva.redback.rest.api.model.Application;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Path( "/roleManagementService/" )
+public interface RoleManagementService
+{
+
+ @Path( "createTemplatedRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean createTemplatedRole( @QueryParam( "templateId" ) String templateId,
+ @QueryParam( "resource" ) String resource )
+ throws RedbackServiceException;
+
+ /**
+ * removes a role corresponding to the role Id that was manufactured with the given resource
+ * <p/>
+ * it also removes any user assignments for that role
+ *
+ * @param templateId
+ * @param resource
+ * @throws Exception
+ */
+ @Path( "removeTemplatedRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean removeTemplatedRole( @QueryParam( "templateId" ) String templateId,
+ @QueryParam( "resource" ) String resource )
+ throws RedbackServiceException;
+
+
+ /**
+ * allows for a role coming from a template to be renamed effectively swapping out the bits of it that
+ * were labeled with the oldResource with the newResource
+ * <p/>
+ * it also manages any user assignments for that role
+ *
+ * @param templateId
+ * @param oldResource
+ * @param newResource
+ * @throws Exception
+ */
+ @Path( "updateRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean updateRole( @QueryParam( "templateId" ) String templateId, @QueryParam( "oldResource" ) String oldResource,
+ @QueryParam( "newResource" ) String newResource )
+ throws RedbackServiceException;
+
+
+ /**
+ * Assigns the role indicated by the roleId to the given principal
+ *
+ * @param roleId
+ * @param principal
+ * @throws Exception
+ */
+ @Path( "assignRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean assignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
+ throws RedbackServiceException;
+
+ /**
+ * Assigns the role indicated by the roleName to the given principal
+ *
+ * @param roleName
+ * @param principal
+ * @throws Exception
+ */
+ @Path( "assignRoleByName" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean assignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
+ throws RedbackServiceException;
+
+ /**
+ * Assigns the templated role indicated by the templateId
+ * <p/>
+ * fails if the templated role has not been created
+ *
+ * @param templateId
+ * @param resource
+ * @param principal
+ */
+ @Path( "assignTemplatedRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean assignTemplatedRole( @QueryParam( "templateId" ) String templateId,
+ @QueryParam( "resource" ) String resource,
+ @QueryParam( "principal" ) String principal )
+ throws RedbackServiceException;
+
+ /**
+ * Unassigns the role indicated by the role id from the given principal
+ *
+ * @param roleId
+ * @param principal
+ * @throws Exception
+ */
+ @Path( "unassignRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean unassignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
+ throws RedbackServiceException;
+
+ /**
+ * Unassigns the role indicated by the role name from the given principal
+ *
+ * @param roleName
+ * @param principal
+ * @throws Exception
+ */
+ @Path( "unassignRoleByName" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean unassignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
+ throws RedbackServiceException;
+
+ /**
+ * true of a role exists with the given roleId
+ *
+ * @param roleId
+ * @return
+ * @throws Exception
+ */
+ @Path( "roleExists" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean roleExists( @QueryParam( "roleId" ) String roleId )
+ throws RedbackServiceException;
+
+ /**
+ * true of a role exists with the given roleId
+ *
+ * @param templateId
+ * @param resource
+ * @return
+ * @throws Exception
+ */
+ @Path( "templatedRoleExists" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean templatedRoleExists( @QueryParam( "templateId" ) String templateId,
+ @QueryParam( "resource" ) String resource )
+ throws RedbackServiceException;
+
+
+ /**
+ * Check a role template is complete in the RBAC store.
+ *
+ * @param templateId the templated role
+ * @param resource the resource to verify
+ * @throws Exception
+ */
+ @Path( "verifyTemplatedRole" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ Boolean verifyTemplatedRole( @QueryParam( "templateId" ) String templateId,
+ @QueryParam( "resource" ) String resource )
+ throws RedbackServiceException;
+
+ @Path( "getEffectivelyAssignedRoles/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.4
+ */
+ List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+
+ @Path( "allRoles" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ List<Role> getAllRoles()
+ throws RedbackServiceException;
+
+ @Path( "detailledAllRoles" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ List<Role> getDetailedAllRoles()
+ throws RedbackServiceException;
+
+
+ @Path( "getApplications/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ List<Application> getApplications( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+
+ @Path( "getRole/{roleName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Role getRole( @PathParam( "roleName" ) String roleName )
+ throws RedbackServiceException;
+
+ @Path( "updateRoleDescription" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName,
+ @QueryParam( "roleDescription" ) String description )
+ throws RedbackServiceException;
+
+ @Path( "updateRoleUsers" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * update users assigned to a role
+ * @since 1.5
+ */
+ Boolean updateRoleUsers( Role role )
+ throws RedbackServiceException;
+
+ @Path( "getApplicationRoles/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * @since 1.5
+ */
+ List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+ @Path( "updateUserRoles" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+ /**
+ * update roles assigned to a user
+ * @since 1.5
+ */
+ Boolean updateUserRoles( User user )
+ throws RedbackServiceException;
+
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.RegistrationKey;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+import java.util.List;
+
+@Path( "/userService/" )
+public interface UserService
+{
+ @Path( "getUser/{userName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ User getUser( @PathParam( "userName" ) String username )
+ throws RedbackServiceException;
+
+
+ @Path( "getUsers" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+ List<User> getUsers()
+ throws RedbackServiceException;
+
+ @Path( "createUser" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION )
+ Boolean createUser( User user )
+ throws RedbackServiceException;
+
+
+ /**
+ * will create admin user only if not exists !! if exists will return false
+ */
+ @Path( "createAdminUser" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( noRestriction = true )
+ Boolean createAdminUser( User user )
+ throws RedbackServiceException;
+
+ @Path( "isAdminUserExists" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true )
+ Boolean isAdminUserExists()
+ throws RedbackServiceException;
+
+
+ @Path( "deleteUser/{userName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION )
+ Boolean deleteUser( @PathParam( "userName" ) String username )
+ throws RedbackServiceException;
+
+ @Path( "updateUser" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ Boolean updateUser( User user )
+ throws RedbackServiceException;
+
+ @Path( "lockUser/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Boolean lockUser( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+ @Path( "unlockUser/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Boolean unlockUser( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+
+ @Path( "passwordChangeRequired/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Boolean passwordChangeRequired( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+ @Path( "passwordChangeNotRequired/{username}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ /**
+ * @since 1.5
+ */
+ Boolean passwordChangeNotRequired( @PathParam( "username" ) String username )
+ throws RedbackServiceException;
+
+
+ @Path( "updateMe" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = false, noPermission = true )
+ /**
+ * update only the current user and this fields: fullname, email, password.
+ * the service verify the curent logged user with the one passed in the method
+ * @since 1.4
+ */
+ Boolean updateMe( User user )
+ throws RedbackServiceException;
+
+ @Path( "ping" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true )
+ Boolean ping()
+ throws RedbackServiceException;
+
+ @Path( "removeFromCache/{userName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ int removeFromCache( @PathParam( "userName" ) String username )
+ throws RedbackServiceException;
+
+ @Path( "getGuestUser" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ User getGuestUser()
+ throws RedbackServiceException;
+
+ @Path( "createGuestUser" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+ User createGuestUser()
+ throws RedbackServiceException;
+
+ @Path( "registerUser" )
+ @POST
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ * if redback is not configured for email validation is required, -1 is returned as key
+ * @since 1.4
+ */
+ RegistrationKey registerUser( User user )
+ throws RedbackServiceException;
+
+
+ @Path( "validateKey/{key}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ * validate the key and the user with forcing a password change for next login.
+ * http session is created.
+ * @param key authentication key
+ * @since 1.4
+ */
+ Boolean validateUserFromKey( @PathParam( "key" ) String key )
+ throws RedbackServiceException;
+
+ @Path( "resetPassword/{user}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ *
+ * @param user username for send a password reset email
+ * @since 1.4
+ */
+ Boolean resetPassword( @PathParam( "user" ) String user )
+ throws RedbackServiceException;
+
+ @Path( "getUserPermissions/{userName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+ /**
+ * @since 1.4
+ */
+ Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName )
+ throws RedbackServiceException;
+
+ @Path( "getUserOperations/{userName}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+ /**
+ * @since 1.4
+ */
+ Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName )
+ throws RedbackServiceException;
+
+ @Path( "getCurrentUserPermissions" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ * return the current logged user permissions, if no logged user guest permissions are returned
+ * @since 1.4
+ */
+ Collection<Permission> getCurrentUserPermissions()
+ throws RedbackServiceException;
+
+ @Path( "getCurrentUserOperations" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true, noPermission = true )
+ /**
+ * return the current logged user operations, if no logged user guest operations are returned
+ * @since 1.4
+ */
+ Collection<Operation> getCurrentUserOperations()
+ throws RedbackServiceException;
+
+}
--- /dev/null
+package org.apache.archiva.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.apache.archiva.redback.authorization.RedbackAuthorization;
+
+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;
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/utilServices/" )
+public interface UtilServices
+{
+
+ @Path( "getBundleResources" )
+ @GET
+ @Produces( { MediaType.TEXT_PLAIN } )
+ @RedbackAuthorization( noRestriction = true )
+ String getI18nResources( @QueryParam( "locale" ) String locale )
+ throws RedbackServiceException;
+
+ /**
+ * <b>not intended to be exposed as a REST service.</b>
+ * will load i18N resource org/codehaus/plexus/redback/users/messages in default en then in the asked locale.
+ * @param locale
+ * @return
+ * @throws RedbackServiceException
+ */
+ Properties getI18nProperties( String locale )
+ throws RedbackServiceException;
+
+
+}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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();
- }
-}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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.apache.archiva.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();
- }
-}
+++ /dev/null
-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.apache.archiva.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();
- }
-}
+++ /dev/null
-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 );
- }
-}
+++ /dev/null
-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;
- }
-}
+++ /dev/null
-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.apache.archiva.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();
- }
-}
+++ /dev/null
-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.apache.archiva.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.apache.archiva.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;
- }
-}
+++ /dev/null
-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();
- }
-}
+++ /dev/null
-package org.codehaus.redback.rest.api.model;
-
-import org.apache.archiva.redback.integration.util.DateUtils;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.List;
-
-/*
- * 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.
- */
-
-@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.apache.archiva.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();
- }
-}
+++ /dev/null
-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.apache.archiva.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;
-}
+++ /dev/null
-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.apache.archiva.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;
-}
+++ /dev/null
-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 );
- }
-}
+++ /dev/null
-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.apache.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.Application;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@Path( "/roleManagementService/" )
-public interface RoleManagementService
-{
-
- @Path( "createTemplatedRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean createTemplatedRole( @QueryParam( "templateId" ) String templateId,
- @QueryParam( "resource" ) String resource )
- throws RedbackServiceException;
-
- /**
- * removes a role corresponding to the role Id that was manufactured with the given resource
- * <p/>
- * it also removes any user assignments for that role
- *
- * @param templateId
- * @param resource
- * @throws Exception
- */
- @Path( "removeTemplatedRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean removeTemplatedRole( @QueryParam( "templateId" ) String templateId,
- @QueryParam( "resource" ) String resource )
- throws RedbackServiceException;
-
-
- /**
- * allows for a role coming from a template to be renamed effectively swapping out the bits of it that
- * were labeled with the oldResource with the newResource
- * <p/>
- * it also manages any user assignments for that role
- *
- * @param templateId
- * @param oldResource
- * @param newResource
- * @throws Exception
- */
- @Path( "updateRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean updateRole( @QueryParam( "templateId" ) String templateId, @QueryParam( "oldResource" ) String oldResource,
- @QueryParam( "newResource" ) String newResource )
- throws RedbackServiceException;
-
-
- /**
- * Assigns the role indicated by the roleId to the given principal
- *
- * @param roleId
- * @param principal
- * @throws Exception
- */
- @Path( "assignRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean assignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
- throws RedbackServiceException;
-
- /**
- * Assigns the role indicated by the roleName to the given principal
- *
- * @param roleName
- * @param principal
- * @throws Exception
- */
- @Path( "assignRoleByName" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean assignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
- throws RedbackServiceException;
-
- /**
- * Assigns the templated role indicated by the templateId
- * <p/>
- * fails if the templated role has not been created
- *
- * @param templateId
- * @param resource
- * @param principal
- */
- @Path( "assignTemplatedRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean assignTemplatedRole( @QueryParam( "templateId" ) String templateId,
- @QueryParam( "resource" ) String resource,
- @QueryParam( "principal" ) String principal )
- throws RedbackServiceException;
-
- /**
- * Unassigns the role indicated by the role id from the given principal
- *
- * @param roleId
- * @param principal
- * @throws Exception
- */
- @Path( "unassignRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean unassignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
- throws RedbackServiceException;
-
- /**
- * Unassigns the role indicated by the role name from the given principal
- *
- * @param roleName
- * @param principal
- * @throws Exception
- */
- @Path( "unassignRoleByName" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean unassignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
- throws RedbackServiceException;
-
- /**
- * true of a role exists with the given roleId
- *
- * @param roleId
- * @return
- * @throws Exception
- */
- @Path( "roleExists" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean roleExists( @QueryParam( "roleId" ) String roleId )
- throws RedbackServiceException;
-
- /**
- * true of a role exists with the given roleId
- *
- * @param templateId
- * @param resource
- * @return
- * @throws Exception
- */
- @Path( "templatedRoleExists" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean templatedRoleExists( @QueryParam( "templateId" ) String templateId,
- @QueryParam( "resource" ) String resource )
- throws RedbackServiceException;
-
-
- /**
- * Check a role template is complete in the RBAC store.
- *
- * @param templateId the templated role
- * @param resource the resource to verify
- * @throws Exception
- */
- @Path( "verifyTemplatedRole" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- Boolean verifyTemplatedRole( @QueryParam( "templateId" ) String templateId,
- @QueryParam( "resource" ) String resource )
- throws RedbackServiceException;
-
- @Path( "getEffectivelyAssignedRoles/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.4
- */
- List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
-
- @Path( "allRoles" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- List<Role> getAllRoles()
- throws RedbackServiceException;
-
- @Path( "detailledAllRoles" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- List<Role> getDetailedAllRoles()
- throws RedbackServiceException;
-
-
- @Path( "getApplications/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- List<Application> getApplications( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
-
- @Path( "getRole/{roleName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- Role getRole( @PathParam( "roleName" ) String roleName )
- throws RedbackServiceException;
-
- @Path( "updateRoleDescription" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName,
- @QueryParam( "roleDescription" ) String description )
- throws RedbackServiceException;
-
- @Path( "updateRoleUsers" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * update users assigned to a role
- * @since 1.5
- */
- Boolean updateRoleUsers( Role role )
- throws RedbackServiceException;
-
- @Path( "getApplicationRoles/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * @since 1.5
- */
- List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
- @Path( "updateUserRoles" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
- /**
- * update roles assigned to a user
- * @since 1.5
- */
- Boolean updateUserRoles( User user )
- throws RedbackServiceException;
-
-}
+++ /dev/null
-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.apache.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.RegistrationKey;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import java.util.Collection;
-import java.util.List;
-
-@Path( "/userService/" )
-public interface UserService
-{
- @Path( "getUser/{userName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- User getUser( @PathParam( "userName" ) String username )
- throws RedbackServiceException;
-
-
- @Path( "getUsers" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
- List<User> getUsers()
- throws RedbackServiceException;
-
- @Path( "createUser" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION )
- Boolean createUser( User user )
- throws RedbackServiceException;
-
-
- /**
- * will create admin user only if not exists !! if exists will return false
- */
- @Path( "createAdminUser" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( noRestriction = true )
- Boolean createAdminUser( User user )
- throws RedbackServiceException;
-
- @Path( "isAdminUserExists" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true )
- Boolean isAdminUserExists()
- throws RedbackServiceException;
-
-
- @Path( "deleteUser/{userName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION )
- Boolean deleteUser( @PathParam( "userName" ) String username )
- throws RedbackServiceException;
-
- @Path( "updateUser" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- Boolean updateUser( User user )
- throws RedbackServiceException;
-
- @Path( "lockUser/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- /**
- * @since 1.5
- */
- Boolean lockUser( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
- @Path( "unlockUser/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- /**
- * @since 1.5
- */
- Boolean unlockUser( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
-
- @Path( "passwordChangeRequired/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- /**
- * @since 1.5
- */
- Boolean passwordChangeRequired( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
- @Path( "passwordChangeNotRequired/{username}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- /**
- * @since 1.5
- */
- Boolean passwordChangeNotRequired( @PathParam( "username" ) String username )
- throws RedbackServiceException;
-
-
- @Path( "updateMe" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = false, noPermission = true )
- /**
- * update only the current user and this fields: fullname, email, password.
- * the service verify the curent logged user with the one passed in the method
- * @since 1.4
- */
- Boolean updateMe( User user )
- throws RedbackServiceException;
-
- @Path( "ping" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true )
- Boolean ping()
- throws RedbackServiceException;
-
- @Path( "removeFromCache/{userName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- int removeFromCache( @PathParam( "userName" ) String username )
- throws RedbackServiceException;
-
- @Path( "getGuestUser" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- User getGuestUser()
- throws RedbackServiceException;
-
- @Path( "createGuestUser" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
- User createGuestUser()
- throws RedbackServiceException;
-
- @Path( "registerUser" )
- @POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true, noPermission = true )
- /**
- * if redback is not configured for email validation is required, -1 is returned as key
- * @since 1.4
- */
- RegistrationKey registerUser( User user )
- throws RedbackServiceException;
-
-
- @Path( "validateKey/{key}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true, noPermission = true )
- /**
- * validate the key and the user with forcing a password change for next login.
- * http session is created.
- * @param key authentication key
- * @since 1.4
- */
- Boolean validateUserFromKey( @PathParam( "key" ) String key )
- throws RedbackServiceException;
-
- @Path( "resetPassword/{user}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true, noPermission = true )
- /**
- *
- * @param user username for send a password reset email
- * @since 1.4
- */
- Boolean resetPassword( @PathParam( "user" ) String user )
- throws RedbackServiceException;
-
- @Path( "getUserPermissions/{userName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
- /**
- * @since 1.4
- */
- Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName )
- throws RedbackServiceException;
-
- @Path( "getUserOperations/{userName}" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
- /**
- * @since 1.4
- */
- Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName )
- throws RedbackServiceException;
-
- @Path( "getCurrentUserPermissions" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true, noPermission = true )
- /**
- * return the current logged user permissions, if no logged user guest permissions are returned
- * @since 1.4
- */
- Collection<Permission> getCurrentUserPermissions()
- throws RedbackServiceException;
-
- @Path( "getCurrentUserOperations" )
- @GET
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true, noPermission = true )
- /**
- * return the current logged user operations, if no logged user guest operations are returned
- * @since 1.4
- */
- Collection<Operation> getCurrentUserOperations()
- throws RedbackServiceException;
-
-}
+++ /dev/null
-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.apache.archiva.redback.authorization.RedbackAuthorization;
-
-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;
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Path( "/utilServices/" )
-public interface UtilServices
-{
-
- @Path( "getBundleResources" )
- @GET
- @Produces( { MediaType.TEXT_PLAIN } )
- @RedbackAuthorization( noRestriction = true )
- String getI18nResources( @QueryParam( "locale" ) String locale )
- throws RedbackServiceException;
-
- /**
- * <b>not intended to be exposed as a REST service.</b>
- * will load i18N resource org/codehaus/plexus/redback/users/messages in default en then in the asked locale.
- * @param locale
- * @return
- * @throws RedbackServiceException
- */
- Properties getI18nProperties( String locale )
- throws RedbackServiceException;
-
-
-}
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<module>
+ <source path="model" />
+</module>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<module>
- <source path="model" />
-</module>
\ No newline at end of file
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.LoginService;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.LoginService;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.services.PasswordService;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.services.PasswordService;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.codehaus.redback.rest.services.utils.PasswordValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.passwordValidator = passwordValidator;
}
- public org.codehaus.redback.rest.api.model.User changePasswordWithKey( String password, String passwordConfirmation,
+ public org.apache.archiva.redback.rest.api.model.User changePasswordWithKey( String password, String passwordConfirmation,
String key )
throws RedbackServiceException
{
user.setEncodedPassword( encodedPassword );
user = securitySystem.getUserManager().updateUser( user );
- return new org.codehaus.redback.rest.api.model.User( user );
+ return new org.apache.archiva.redback.rest.api.model.User( user );
}
catch ( KeyManagerException e )
}
- public org.codehaus.redback.rest.api.model.User changePassword( String userName, String previousPassword,
+ public org.apache.archiva.redback.rest.api.model.User changePassword( String userName, String previousPassword,
String password, String passwordConfirmation )
throws RedbackServiceException
{
u.setPassword( password );
u = securitySystem.getUserManager().updateUser( u );
- return new org.codehaus.redback.rest.api.model.User( u );
+ return new org.apache.archiva.redback.rest.api.model.User( u );
}
catch ( UserNotFoundException e )
{
import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
import org.apache.archiva.redback.integration.util.RoleSorter;
-import org.codehaus.redback.rest.api.model.Application;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.RoleTemplate;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.model.Application;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.RoleTemplate;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
try
{
User user = userManager.findUser( userAssignment.getPrincipal() );
- role.getUsers().add( new org.codehaus.redback.rest.api.model.User( user ) );
+ role.getUsers().add( new org.apache.archiva.redback.rest.api.model.User( user ) );
}
catch ( UserNotFoundException e )
{
try
{
User user = userManager.findUser( userAssignment.getPrincipal() );
- role.getParentsRolesUsers().add( new org.codehaus.redback.rest.api.model.User( user ) );
+ role.getParentsRolesUsers().add( new org.apache.archiva.redback.rest.api.model.User( user ) );
}
catch ( UserNotFoundException e )
{
}
}
- List<org.codehaus.redback.rest.api.model.User> otherUsers =
- new ArrayList<org.codehaus.redback.rest.api.model.User>();
+ List<org.apache.archiva.redback.rest.api.model.User> otherUsers =
+ new ArrayList<org.apache.archiva.redback.rest.api.model.User>();
for ( User u : userManager.getUsers() )
{
- org.codehaus.redback.rest.api.model.User user = new org.codehaus.redback.rest.api.model.User( u );
+ org.apache.archiva.redback.rest.api.model.User
+ user = new org.apache.archiva.redback.rest.api.model.User( u );
if ( role.getParentsRolesUsers().contains( user ) )
{
continue;
throws RedbackServiceException
{
- for ( org.codehaus.redback.rest.api.model.User user : role.getUsers() )
+ for ( org.apache.archiva.redback.rest.api.model.User user : role.getUsers() )
{
String username = user.getUsername();
if ( !userManager.userExists( username ) )
}
}
- for ( org.codehaus.redback.rest.api.model.User user : role.getRemovedUsers() )
+ for ( org.apache.archiva.redback.rest.api.model.User user : role.getRemovedUsers() )
{
String username = user.getUsername();
if ( !userManager.userExists( username ) )
}
}
- public Boolean updateUserRoles( org.codehaus.redback.rest.api.model.User user )
+ public Boolean updateUserRoles( org.apache.archiva.redback.rest.api.model.User user )
throws RedbackServiceException
{
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.apache.archiva.redback.integration.mail.Mailer;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.RegistrationKey;
-import org.codehaus.redback.rest.api.model.Resource;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.RegistrationKey;
+import org.apache.archiva.redback.rest.api.model.Resource;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.UserService;
import org.codehaus.redback.rest.services.utils.PasswordValidator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.UtilServices;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.UtilServices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
import org.apache.archiva.redback.policy.PasswordRuleViolations;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.RedbackRestError;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.RedbackRestError;
import org.springframework.stereotype.Service;
import javax.ws.rs.core.Response;
* under the License.
*/
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.RedbackRestError;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.RedbackRestError;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.springframework.stereotype.Service;
import javax.ws.rs.core.Response;
import org.apache.archiva.redback.policy.PasswordEncoder;
import org.apache.archiva.redback.policy.PasswordRuleViolationException;
import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.LoginService;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.LoginService;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.services.UserService;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.session.SessionHandler;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.configuration.UserConfiguration;
import org.apache.archiva.redback.role.RoleManager;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.services.UserService;
import javax.inject.Inject;
import javax.inject.Named;
*/
import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.UserService;
import org.junit.Test;
/**
import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.services.UserService;
import org.junit.Test;
import java.util.Arrays;
import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
import org.apache.cxf.jaxrs.client.WebClient;
import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.UserService;
import org.codehaus.redback.rest.services.mock.EmailMessage;
import org.codehaus.redback.rest.services.mock.ServicesAssert;
import org.junit.Test;