mirror of https://github.com/apache/archiva.git
fix compilation
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1433423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
77794389d0
commit
acaac81784
|
@ -1496,8 +1496,8 @@
|
||||||
</association>
|
</association>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>authorizerImpls</name>
|
<name>rbacManagerImpls</name>
|
||||||
<description>The authorizer impls to use.</description>
|
<description>The RBAC Manager impls to use.</description>
|
||||||
<version>1.4.0+</version>
|
<version>1.4.0+</version>
|
||||||
<association>
|
<association>
|
||||||
<type>String</type>
|
<type>String</type>
|
||||||
|
|
|
@ -40,9 +40,9 @@ public class RedbackRuntimeConfiguration
|
||||||
private List<String> userManagerImpls = new ArrayList<String>();
|
private List<String> userManagerImpls = new ArrayList<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field authorizerImpls.
|
* Field rbacManagerImpls.
|
||||||
*/
|
*/
|
||||||
private java.util.List<String> authorizerImpls;
|
private java.util.List<String> rbacManagerImpls;
|
||||||
|
|
||||||
private LdapConfiguration ldapConfiguration;
|
private LdapConfiguration ldapConfiguration;
|
||||||
|
|
||||||
|
@ -158,14 +158,14 @@ public class RedbackRuntimeConfiguration
|
||||||
this.usersCacheConfiguration = usersCacheConfiguration;
|
this.usersCacheConfiguration = usersCacheConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getAuthorizerImpls()
|
public List<String> getRbacManagerImpls()
|
||||||
{
|
{
|
||||||
return authorizerImpls;
|
return rbacManagerImpls;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthorizerImpls( List<String> authorizerImpls )
|
public void setRbacManagerImpls( List<String> rbacManagerImpls )
|
||||||
{
|
{
|
||||||
this.authorizerImpls = authorizerImpls;
|
this.rbacManagerImpls = rbacManagerImpls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -174,7 +174,7 @@ public class RedbackRuntimeConfiguration
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append( "RedbackRuntimeConfiguration" );
|
sb.append( "RedbackRuntimeConfiguration" );
|
||||||
sb.append( "{userManagerImpls=" ).append( userManagerImpls );
|
sb.append( "{userManagerImpls=" ).append( userManagerImpls );
|
||||||
sb.append( ", authorizerImpls=" ).append( authorizerImpls );
|
sb.append( ", rbacManagerImpls=" ).append( rbacManagerImpls );
|
||||||
sb.append( ", ldapConfiguration=" ).append( ldapConfiguration );
|
sb.append( ", ldapConfiguration=" ).append( ldapConfiguration );
|
||||||
sb.append( ", migratedFromRedbackConfiguration=" ).append( migratedFromRedbackConfiguration );
|
sb.append( ", migratedFromRedbackConfiguration=" ).append( migratedFromRedbackConfiguration );
|
||||||
sb.append( ", configurationProperties=" ).append( configurationProperties );
|
sb.append( ", configurationProperties=" ).append( configurationProperties );
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
String authorizerImpls =
|
String authorizerImpls =
|
||||||
userConfiguration.getConcatenatedList( UserConfigurationKeys.AUTHORIZER_IMPL, "rbac" );
|
userConfiguration.getConcatenatedList( UserConfigurationKeys.RBAC_MANAGER_IMPL, "cached" );
|
||||||
|
|
||||||
if ( StringUtils.isNotEmpty( authorizerImpls ) )
|
if ( StringUtils.isNotEmpty( authorizerImpls ) )
|
||||||
{
|
{
|
||||||
|
@ -106,12 +106,12 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
String[] impls = StringUtils.split( authorizerImpls, ',' );
|
String[] impls = StringUtils.split( authorizerImpls, ',' );
|
||||||
for ( String impl : impls )
|
for ( String impl : impls )
|
||||||
{
|
{
|
||||||
redbackRuntimeConfiguration.getAuthorizerImpls().add( impl );
|
redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
redbackRuntimeConfiguration.getAuthorizerImpls().add( userManagerImpl );
|
redbackRuntimeConfiguration.getRbacManagerImpls().add( userManagerImpl );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,11 +154,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
// we ensure authorizerImpls is not empty if so put
|
// we ensure authorizerImpls is not empty if so put
|
||||||
if ( redbackRuntimeConfiguration.getAuthorizerImpls().isEmpty() )
|
if ( redbackRuntimeConfiguration.getRbacManagerImpls().isEmpty() )
|
||||||
{
|
{
|
||||||
log.info(
|
log.info(
|
||||||
"redbackRuntimeConfiguration with empty authorizerImpls so force at least rbac implementation !" );
|
"redbackRuntimeConfiguration with empty authorizerImpls so force at least rbac implementation !" );
|
||||||
redbackRuntimeConfiguration.getAuthorizerImpls().add( "rbac" );
|
redbackRuntimeConfiguration.getRbacManagerImpls().add( "rbac" );
|
||||||
updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.archiva.security;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.archiva.redback.rbac.RbacManagerException;
|
||||||
import org.apache.archiva.redback.system.check.EnvironmentCheck;
|
import org.apache.archiva.redback.system.check.EnvironmentCheck;
|
||||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||||
import org.apache.archiva.redback.rbac.RBACManager;
|
import org.apache.archiva.redback.rbac.RBACManager;
|
||||||
|
@ -33,8 +34,6 @@ import javax.inject.Named;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArchivaStandardRolesCheck tests for the existance of expected / standard roles and permissions.
|
* ArchivaStandardRolesCheck tests for the existance of expected / standard roles and permissions.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Service("environmentCheck#archiva-required-roles")
|
@Service("environmentCheck#archiva-required-roles")
|
||||||
public class ArchivaStandardRolesCheck
|
public class ArchivaStandardRolesCheck
|
||||||
|
@ -45,7 +44,8 @@ public class ArchivaStandardRolesCheck
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Inject @Named(value = "rbacManager#cached")
|
@Inject
|
||||||
|
@Named(value = "rbacManager#cached")
|
||||||
private RBACManager rbacManager;
|
private RBACManager rbacManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,36 +57,35 @@ public class ArchivaStandardRolesCheck
|
||||||
{
|
{
|
||||||
if ( !checked )
|
if ( !checked )
|
||||||
{
|
{
|
||||||
String expectedRoles[] = new String[] {
|
String expectedRoles[] = new String[]{ ArchivaRoleConstants.SYSTEM_ADMINISTRATOR_ROLE,
|
||||||
ArchivaRoleConstants.SYSTEM_ADMINISTRATOR_ROLE,
|
|
||||||
ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE,
|
ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE,
|
||||||
ArchivaRoleConstants.GLOBAL_REPOSITORY_OBSERVER_ROLE,
|
ArchivaRoleConstants.GLOBAL_REPOSITORY_OBSERVER_ROLE, ArchivaRoleConstants.GUEST_ROLE,
|
||||||
ArchivaRoleConstants.GUEST_ROLE,
|
ArchivaRoleConstants.REGISTERED_USER_ROLE, ArchivaRoleConstants.USER_ADMINISTRATOR_ROLE };
|
||||||
ArchivaRoleConstants.REGISTERED_USER_ROLE,
|
|
||||||
ArchivaRoleConstants.USER_ADMINISTRATOR_ROLE };
|
|
||||||
|
|
||||||
log.info( "Checking the existance of required roles." );
|
log.info( "Checking the existance of required roles." );
|
||||||
|
|
||||||
for ( String roleName : expectedRoles )
|
for ( String roleName : expectedRoles )
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if ( !rbacManager.roleExists( roleName ) )
|
if ( !rbacManager.roleExists( roleName ) )
|
||||||
{
|
{
|
||||||
violations.add( "Unable to validate the existances of the '" + roleName + "' role." );
|
violations.add( "Unable to validate the existances of the '" + roleName + "' role." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch ( RbacManagerException e )
|
||||||
|
{
|
||||||
|
log.warn( "fail to verify existence of role '{}'", roleName );
|
||||||
|
violations.add( "Unable to validate the existances of the '" + roleName + "' role." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String expectedOperations[] = new String[] {
|
String expectedOperations[] = new String[]{ ArchivaRoleConstants.OPERATION_MANAGE_USERS,
|
||||||
ArchivaRoleConstants.OPERATION_MANAGE_USERS,
|
ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, ArchivaRoleConstants.OPERATION_REGENERATE_INDEX,
|
||||||
ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION,
|
ArchivaRoleConstants.OPERATION_RUN_INDEXER, ArchivaRoleConstants.OPERATION_ACCESS_REPORT,
|
||||||
ArchivaRoleConstants.OPERATION_REGENERATE_INDEX,
|
ArchivaRoleConstants.OPERATION_ADD_REPOSITORY, ArchivaRoleConstants.OPERATION_DELETE_REPOSITORY,
|
||||||
ArchivaRoleConstants.OPERATION_RUN_INDEXER,
|
ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS, ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY,
|
||||||
ArchivaRoleConstants.OPERATION_ACCESS_REPORT,
|
ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD, ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS,
|
||||||
ArchivaRoleConstants.OPERATION_ADD_REPOSITORY,
|
|
||||||
ArchivaRoleConstants.OPERATION_DELETE_REPOSITORY,
|
|
||||||
ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS,
|
|
||||||
ArchivaRoleConstants.OPERATION_EDIT_REPOSITORY,
|
|
||||||
ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD,
|
|
||||||
ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS,
|
|
||||||
"archiva-guest" };
|
"archiva-guest" };
|
||||||
|
|
||||||
log.info( "Checking the existance of required operations." );
|
log.info( "Checking the existance of required operations." );
|
||||||
|
|
Loading…
Reference in New Issue