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


Java IdentityService.clearAuthentication方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.IdentityService.clearAuthentication方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityService.clearAuthentication方法的具体用法?Java IdentityService.clearAuthentication怎么用?Java IdentityService.clearAuthentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.IdentityService的用法示例。


在下文中一共展示了IdentityService.clearAuthentication方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: execute

import org.camunda.bpm.engine.IdentityService; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
  ensureNotNull("jobId", jobId);

  final JobEntity job = commandContext.getDbEntityManager().selectById(JobEntity.class, jobId);

  final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
  final IdentityService identityService = processEngineConfiguration.getIdentityService();

  final JobExecutorContext jobExecutorContext = Context.getJobExecutorContext();

  if (job == null) {
    if (jobExecutorContext != null) {
      // CAM-1842
      // Job was acquired but does not exist anymore. This is not a problem.
      // It usually means that the job has been deleted after it was acquired which can happen if the
      // the activity instance corresponding to the job is cancelled.
      LOG.debugAcquiredJobNotFound(jobId);
      return null;

    } else {
      throw LOG.jobNotFoundException(jobId);
    }
  }

  jobFailureCollector.setJob(job);

  if (jobExecutorContext == null) { // if null, then we are not called by the job executor
    for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
      checker.checkUpdateJob(job);
    }
  } else {
    jobExecutorContext.setCurrentJob(job);

    // if the job is called by the job executor then set the tenant id of the job
    // as authenticated tenant to enable tenant checks
    String tenantId = job.getTenantId();
    if (tenantId != null) {
      identityService.setAuthentication(null, null, Collections.singletonList(tenantId));
    }
  }

  try {

    // register as command context close lister to intercept exceptions on flush
    commandContext.registerCommandContextListener(jobFailureCollector);

    commandContext.setCurrentJob(job);

    job.execute(commandContext);

  }
  finally {
    if (jobExecutorContext != null) {
      jobExecutorContext.setCurrentJob(null);
      identityService.clearAuthentication();
    }
  }

  return null;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:61,代码来源:ExecuteJobsCmd.java


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