当前位置: 首页>>代码示例>>Java>>正文


Java IdentityService.getCurrentAuthentication方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:20,代码来源:UasTenantIdProvider.java

示例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);
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:ApplicationContextPathUtil.java

示例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);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:AbstractAuthorizedRestResource.java

示例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;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:DefaultAuthorizationProvider.java

示例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));
    }
  };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:MultiTenancyJobExecutorTest.java

示例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()));
    }
  };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:MultiTenancyJobExecutorTest.java

示例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);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:TaskCommentResourceImpl.java

示例8: logAuthentication

import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
protected void logAuthentication(IdentityService identityService) {
  CURRENT_AUTHENTICATION = identityService.getCurrentAuthentication();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:4,代码来源:MyDelegationService.java


注:本文中的org.camunda.bpm.engine.IdentityService.getCurrentAuthentication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。