use of org.camunda.bpm.engine.impl.identity.Authentication in project camunda-bpm-platform by camunda.
the class MultiTenancyJobExecutorTest method hasAuthenticatedTenantId.
protected static DelegateExecutionAsserter hasAuthenticatedTenantId(final String expectedTenantId) {
return new DelegateExecutionAsserter() {
@Override
public void doAssert(DelegateExecution execution) {
IdentityService identityService = execution.getProcessEngineServices().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
assertThat(currentAuthentication, is(notNullValue()));
assertThat(currentAuthentication.getTenantIds(), hasItem(expectedTenantId));
}
};
}
use of org.camunda.bpm.engine.impl.identity.Authentication in project camunda-bpm-platform by camunda.
the class MultiTenancyJobExecutorTest method hasNoAuthenticatedTenantId.
protected static DelegateExecutionAsserter hasNoAuthenticatedTenantId() {
return new DelegateExecutionAsserter() {
@Override
public void doAssert(DelegateExecution execution) {
IdentityService identityService = execution.getProcessEngineServices().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
assertThat(currentAuthentication, is(nullValue()));
}
};
}
use of org.camunda.bpm.engine.impl.identity.Authentication in project camunda-bpm-platform by camunda.
the class TenantManager method configureTenantCheck.
public void configureTenantCheck(TenantCheck tenantCheck) {
if (isTenantCheckEnabled()) {
Authentication currentAuthentication = getCurrentAuthentication();
tenantCheck.setTenantCheckEnabled(true);
tenantCheck.setAuthTenantIds(currentAuthentication.getTenantIds());
} else {
tenantCheck.setTenantCheckEnabled(false);
tenantCheck.setAuthTenantIds(null);
}
}
use of org.camunda.bpm.engine.impl.identity.Authentication in project camunda-bpm-platform by camunda.
the class TenantManager method isAuthenticatedTenant.
public boolean isAuthenticatedTenant(String tenantId) {
if (tenantId != null && isTenantCheckEnabled()) {
Authentication currentAuthentication = getCurrentAuthentication();
List<String> authenticatedTenantIds = currentAuthentication.getTenantIds();
if (authenticatedTenantIds != null) {
return authenticatedTenantIds.contains(tenantId);
} else {
return false;
}
} else {
return true;
}
}
use of org.camunda.bpm.engine.impl.identity.Authentication in project camunda-bpm-platform by camunda.
the class IdentityServiceTest method testSetAuthenticatedUserGroupsAndTenants.
@Test
public void testSetAuthenticatedUserGroupsAndTenants() {
List<String> groups = Arrays.asList("sales", "development");
List<String> tenants = Arrays.asList("tenant1", "tenant2");
identityService.setAuthentication("john", groups, tenants);
Authentication currentAuthentication = identityService.getCurrentAuthentication();
assertNotNull(currentAuthentication);
assertEquals("john", currentAuthentication.getUserId());
assertEquals(groups, currentAuthentication.getGroupIds());
assertEquals(tenants, currentAuthentication.getTenantIds());
}
Aggregations