本文整理汇总了Java中org.camunda.bpm.engine.IdentityService.getCurrentAuthentication方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityService.getCurrentAuthentication方法的具体用法?Java IdentityService.getCurrentAuthentication怎么用?Java IdentityService.getCurrentAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.IdentityService
的用法示例。
在下文中一共展示了IdentityService.getCurrentAuthentication方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTenantIdOfCurrentAuthentication
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
protected String getTenantIdOfCurrentAuthentication() {
IdentityService identityService = Context.getProcessEngineConfiguration().getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
if (currentAuthentication != null) {
List<String> tenantIds = currentAuthentication.getTenantIds();
if (tenantIds.size() == 1) {
return tenantIds.get(0);
} else if (tenantIds.isEmpty()) {
return null;
} else {
throw new IllegalStateException("more than one authenticated tenant");
}
} else {
return null;
}
}
示例2: getApplicationPathForDeployment
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
public static String getApplicationPathForDeployment(ProcessEngine engine, String deploymentId) {
// get the name of the process application that made the deployment
String processApplicationName = null;
IdentityService identityService = engine.getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
try {
identityService.clearAuthentication();
processApplicationName = engine.getManagementService().getProcessApplicationForDeployment(deploymentId);
} finally {
identityService.setAuthentication(currentAuthentication);
}
if (processApplicationName == null) {
// no a process application deployment
return null;
} else {
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(processApplicationName);
return processApplicationInfo.getProperties().get(ProcessApplicationInfo.PROP_SERVLET_CONTEXT_PATH);
}
}
示例3: isAuthorized
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
protected boolean isAuthorized(Permission permission, Resource resource, String resourceId) {
if (!processEngine.getProcessEngineConfiguration().isAuthorizationEnabled()) {
// if authorization is disabled everyone is authorized
return true;
}
final IdentityService identityService = processEngine.getIdentityService();
final AuthorizationService authorizationService = processEngine.getAuthorizationService();
Authentication authentication = identityService.getCurrentAuthentication();
if(authentication == null) {
return true;
} else {
return authorizationService
.isUserAuthorized(authentication.getUserId(), authentication.getGroupIds(), permission, resource, resourceId);
}
}
示例4: newDeployment
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
public AuthorizationEntity[] newDeployment(Deployment deployment) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
IdentityService identityService = processEngineConfiguration.getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
if (currentAuthentication != null && currentAuthentication.getUserId() != null) {
String userId = currentAuthentication.getUserId();
String deploymentId = deployment.getId();
AuthorizationEntity authorization = createGrantAuthorization(userId, null, DEPLOYMENT, deploymentId, READ, DELETE);
return new AuthorizationEntity[]{ authorization };
}
return null;
}
示例5: hasAuthenticatedTenantId
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
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));
}
};
}
示例6: hasNoAuthenticatedTenantId
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
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()));
}
};
}
示例7: isHistoryEnabled
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
private boolean isHistoryEnabled() {
IdentityService identityService = engine.getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
try {
identityService.clearAuthentication();
int historyLevel = engine.getManagementService().getHistoryLevel();
return historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE;
} finally {
identityService.setAuthentication(currentAuthentication);
}
}
示例8: logAuthentication
import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
protected void logAuthentication(IdentityService identityService) {
CURRENT_AUTHENTICATION = identityService.getCurrentAuthentication();
}