Search in sources :

Example 1 with SpringSecurityPrincipalProvider

use of org.pentaho.platform.repository2.unified.jcr.jackrabbit.security.SpringSecurityPrincipalProvider in project pentaho-platform by pentaho.

the class SpringSecurityPrincipalProvider_Caching_Test method setUp.

@Before
public void setUp() throws Exception {
    userResolver = mock(ITenantedPrincipleNameResolver.class);
    roleResolver = mock(ITenantedPrincipleNameResolver.class);
    cacheManager = spy(new SimpleMapCacheManager());
    doReturn(false).when(cacheManager).cacheEnabled(USER_CACHE_REGION);
    doReturn(false).when(cacheManager).cacheEnabled(ROLE_CACHE_REGION);
    userTenant = new Tenant(USER_PRINCIPLE, true);
    roleTenant = new Tenant(ROLE_PRINCIPLE, true);
    mp = new MicroPlatform(getSolutionPath());
    mp.defineInstance("tenantedUserNameUtils", userResolver);
    mp.defineInstance("tenantedRoleNameUtils", roleResolver);
    mp.defineInstance(ICacheManager.class, cacheManager);
    mp.start();
    provider = new SpringSecurityPrincipalProvider();
    provider.init(new Properties());
    provider = spy(provider);
    User user = new User(USER_PRINCIPLE, "", true, true, true, true, new ArrayList<GrantedAuthority>());
    doReturn(user).when(provider).internalGetUserDetails(USER_PRINCIPLE);
}
Also used : Tenant(org.pentaho.platform.core.mt.Tenant) ITenant(org.pentaho.platform.api.mt.ITenant) User(org.springframework.security.core.userdetails.User) GrantedAuthority(org.springframework.security.core.GrantedAuthority) MicroPlatform(org.pentaho.test.platform.engine.core.MicroPlatform) ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver) Properties(java.util.Properties) SpringSecurityPrincipalProvider(org.pentaho.platform.repository2.unified.jcr.jackrabbit.security.SpringSecurityPrincipalProvider) SimpleMapCacheManager(org.pentaho.platform.engine.core.system.SimpleMapCacheManager) Before(org.junit.Before)

Aggregations

Properties (java.util.Properties)1 Before (org.junit.Before)1 ITenant (org.pentaho.platform.api.mt.ITenant)1 ITenantedPrincipleNameResolver (org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)1 Tenant (org.pentaho.platform.core.mt.Tenant)1 SimpleMapCacheManager (org.pentaho.platform.engine.core.system.SimpleMapCacheManager)1 SpringSecurityPrincipalProvider (org.pentaho.platform.repository2.unified.jcr.jackrabbit.security.SpringSecurityPrincipalProvider)1 MicroPlatform (org.pentaho.test.platform.engine.core.MicroPlatform)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1 User (org.springframework.security.core.userdetails.User)1