mirror of https://github.com/apache/archiva.git
[MRM-1736] map roles to ldap groups
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1430606 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55300b40ff
commit
3b024df4b9
|
@ -30,6 +30,8 @@ import org.apache.archiva.maven2.model.Artifact;
|
|||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
|
||||
import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
|
||||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||
import org.apache.archiva.redback.rest.services.RedbackAuthenticationThreadLocal;
|
||||
import org.apache.archiva.redback.rest.services.RedbackRequestInformation;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
|
@ -95,6 +97,11 @@ public abstract class AbstractRestService
|
|||
@Named(value = "archivaTaskScheduler#repository")
|
||||
protected DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler;
|
||||
|
||||
|
||||
@Inject
|
||||
@Named( value = "userConfiguration#default" )
|
||||
protected UserConfiguration config;
|
||||
|
||||
@Context
|
||||
protected HttpServletRequest httpServletRequest;
|
||||
|
||||
|
@ -143,9 +150,9 @@ public abstract class AbstractRestService
|
|||
RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
|
||||
|
||||
return redbackRequestInformation == null
|
||||
? UserManager.GUEST_USERNAME
|
||||
? config.getString( UserConfigurationKeys.DEFAULT_GUEST )
|
||||
: ( redbackRequestInformation.getUser() == null
|
||||
? UserManager.GUEST_USERNAME
|
||||
? config.getString( UserConfigurationKeys.DEFAULT_GUEST )
|
||||
: redbackRequestInformation.getUser().getUsername() );
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@ public class ArchivaAuthorizer
|
|||
@Named( value = "authorizer#rbac" )
|
||||
private Authorizer rbacAuthorizer;
|
||||
|
||||
|
||||
@Inject
|
||||
@Named( value = "authorizer#ldap" )
|
||||
private Authorizer ldapAuthorizer;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return "archiva";
|
||||
|
@ -52,6 +57,11 @@ public class ArchivaAuthorizer
|
|||
throws AuthorizationException
|
||||
{
|
||||
log.debug( "isAuthorized source: {}", source );
|
||||
|
||||
AuthorizationResult result = ldapAuthorizer.isAuthorized( source );
|
||||
|
||||
|
||||
|
||||
return rbacAuthorizer.isAuthorized( source );
|
||||
}
|
||||
|
||||
|
|
|
@ -462,6 +462,33 @@
|
|||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback.components.registry</groupId>
|
||||
<artifactId>spring-registry-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback.components.registry</groupId>
|
||||
<artifactId>spring-registry-commons</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant-optional</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>jdom</groupId>
|
||||
<artifactId>jdom</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-rest-api</artifactId>
|
||||
|
@ -643,6 +670,16 @@
|
|||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-integrations-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-authorization-ldap</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
|
|
|
@ -56,7 +56,8 @@
|
|||
</bean>
|
||||
|
||||
<!-- START SNIPPET: configuration-files-list -->
|
||||
<bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
|
||||
<bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"
|
||||
init-method="initialize">
|
||||
<property name="properties">
|
||||
<value>
|
||||
<![CDATA[
|
||||
|
|
|
@ -85,6 +85,8 @@
|
|||
|
||||
<logger name="org.apache.archiva.web.security.ArchivaAuthorizer" level="debug"/>
|
||||
|
||||
<logger name="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" level="debug"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
|
11
pom.xml
11
pom.xml
|
@ -927,6 +927,17 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-authorization-ldap</artifactId>
|
||||
<version>${redback.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.redback</groupId>
|
||||
<artifactId>redback-users-memory</artifactId>
|
||||
|
|
Loading…
Reference in New Issue