org.modeshape.jcr.ExecutionContext.with()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.modeshape.jcr.ExecutionContext.with()方法的一些代码示例,展示了ExecutionContext.with()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext.with()方法的具体详情如下:
包路径:org.modeshape.jcr.ExecutionContext
类名称:ExecutionContext
方法名:with

ExecutionContext.with介绍

[英]Create a new execution context that mirrors this context but that contains the supplied process identifier.
[中]创建一个新的执行上下文,该上下文镜像此上下文,但包含提供的进程标识符。

代码示例

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public final void addContextData( String key,
                 String value ) {
  this.context = context.with(key, value);
}

代码示例来源:origin: ModeShape/modeshape

@Override
public final void addContextData( String key,
                 String value ) {
  this.context = context.with(key, value);
}

代码示例来源:origin: org.fcrepo/fcrepo-auth-common

@Override
public ExecutionContext authenticate(final Credentials credentials,
    final String repositoryName, final String workspaceName,
    final ExecutionContext repositoryContext,
    final Map<String, Object> sessionAttributes) {
  if (credentials instanceof ServletCredentials) {
    return repositoryContext
        .with(new AnonymousAdminSecurityContext("bypassAdmin"));
  }
  return null;
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

@Override
public ExecutionContext authenticate(Credentials credentials,
                   String repositoryName,
                   String workspaceName,
                   ExecutionContext repositoryContext,
                   Map<String, Object> sessionAttributes) {
  if (credentials instanceof OverrideCredentials) {
    return repositoryContext.with(new OverrideSecurityContext((OverrideCredentials) credentials));
  } else {
    return null;
  }
}

代码示例来源:origin: ModeShape/modeshape

final void addContextData( String key,
              String value ) {
  this.context = context.with(key, value);
  this.cache.addContextData(key, value);
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

final void addContextData( String key,
              String value ) {
  this.context = context.with(key, value);
  this.cache.addContextData(key, value);
}

代码示例来源:origin: org.fcrepo/fcrepo-auth-common

@Override
public ExecutionContext authenticate(final Credentials credentials, final String repositoryName,
    final String workspaceName, final ExecutionContext repositoryContext,
    final Map<String, Object> sessionAttributes) {
  if (credentials == null) {
    return null;
  }
  return repositoryContext.with(new ShiroSecurityContext(SecurityUtils.getSubject()));
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

@Override
public ExecutionContext authenticate(Credentials credentials,
                   String repositoryName,
                   String workspaceName,
                   ExecutionContext repositoryContext,
                   Map<String, Object> sessionAttributes) {
  if (credentials instanceof OverrideCredentials) {
    return repositoryContext.with(new AdminSecurityContext());
  } else {
    return null;
  }
}

代码示例来源:origin: ModeShape/modeshape

@Override
public ExecutionContext authenticate( Credentials credentials,
                   String repositoryName,
                   String workspaceName,
                   ExecutionContext repositoryContext,
                   Map<String, Object> sessionAttributes ) {
  if (credentials instanceof ServletCredentials) {
    ServletCredentials creds = (ServletCredentials)credentials;
    HttpServletRequest request = creds.getRequest();
    if (request != null) {
      return repositoryContext.with(new ServletSecurityContext(request));
    }
  }
  return null;
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public ExecutionContext authenticate( Credentials credentials,
                   String repositoryName,
                   String workspaceName,
                   ExecutionContext repositoryContext,
                   Map<String, Object> sessionAttributes ) {
  if (credentials instanceof ServletCredentials) {
    ServletCredentials creds = (ServletCredentials)credentials;
    HttpServletRequest request = creds.getRequest();
    if (request != null) {
      return repositoryContext.with(new ServletSecurityContext(request));
    }
  }
  return null;
}

代码示例来源:origin: ModeShape/modeshape

private ExecutionContext getSubjectFromJaas( JaasCredentials credentials, ExecutionContext repositoryContext ) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Looking for an active subject in the JaasCredentials instance...");
  }
  Subject subject = credentials.getLoginContext().getSubject();
  if (subject == null) {
    LOGGER.warn("Cannot authenticate because the JassCredentials instance has a login context with a null subject...");
    return null; 
  }
  return repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject)));
}

代码示例来源:origin: ModeShape/modeshape

protected SessionQueryContext( JcrSession session, Locale locale ) {
  this.session = session;  
  this.executionContext = (locale == null) ? session.context() : session.context().with(locale);
  this.factories = executionContext.getValueFactories();
}

代码示例来源:origin: org.overlord.sramp/s-ramp-repository-jcr-modeshape

/**
 * @see org.modeshape.jcr.security.AuthenticationProvider#authenticate(javax.jcr.Credentials, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext, java.util.Map)
 */
@Override
public ExecutionContext authenticate(Credentials credentials, String repositoryName,
    String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) {
  return repositoryContext.with(new MockSecurityContext());
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

protected SessionQueryContext( JcrSession session, Locale locale ) {
  this.session = session;  
  this.executionContext = (locale == null) ? session.context() : session.context().with(locale);
  this.factories = executionContext.getValueFactories();
}

代码示例来源:origin: org.overlord.sramp/s-ramp-repository-jcr-modeshape

/**
 * @see org.modeshape.jcr.security.JaasProvider#authenticate(javax.jcr.Credentials, java.lang.String, java.lang.String, org.modeshape.jcr.ExecutionContext, java.util.Map)
 */
@Override
public ExecutionContext authenticate(Credentials credentials, String repositoryName,
    String workspaceName, ExecutionContext repositoryContext, Map<String, Object> sessionAttributes) {
  ExecutionContext ctx = super.authenticate(credentials, repositoryName, workspaceName, repositoryContext, sessionAttributes);
  if (ctx != null) {
    return repositoryContext.with(new SrampSecurityContext(ctx.getSecurityContext()));
  }
  return ctx;
}

代码示例来源:origin: ModeShape/modeshape

private ExecutionContext getPreauthenticatedSubject( ExecutionContext repositoryContext ) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Received null credentials, attempting to search for an active subject on the calling thread via JACC");
  }
  // There are no credentials, so see if there is an authenticated Subject ...
  Subject subject = Subject.getSubject(AccessController.getContext());
  if (subject != null) {
    // There is, so use this subject ...
    return repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject)));
  }
  subject = jaccSubjectResolver.resolveSubject();
  // there are no credentials and we failed to find a pre-authenticated subject, so return null.
  return subject != null ? repositoryContext.with(new JBossSecurityContext(new JaasSecurityContext(subject))) : null;
}

代码示例来源:origin: ModeShape/modeshape

@Override
public ExecutionContext authenticate( Credentials credentials, String repositoryName, String workspaceName,
                   ExecutionContext repositoryContext, Map<String, Object> sessionAttributes ) {
  stringFactory = repositoryContext.getValueFactories().getStringFactory();
  return repositoryContext.with(this);
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

/**
 * Create a new importer that will place the content in the supplied destination under the supplied path.
 *
 * @param context the context in which the importing should be performed; may not be null
 *
 */
public CndImporter( ExecutionContext context ) {
  assert context != null;
  this.localRegistry = new LocalNamespaceRegistry(context.getNamespaceRegistry());
  this.context = context.with(this.localRegistry);
  this.valueFactory = new JcrValueFactory(this.context);
  this.nameFactory = this.context.getValueFactories().getNameFactory();
  this.stringFactory = this.context.getValueFactories().getStringFactory();
  this.nodeTypes = new LinkedList<NodeTypeDefinition>();
}

代码示例来源:origin: ModeShape/modeshape

/**
 * Create a new importer that will place the content in the supplied destination under the supplied path.
 *
 * @param context the context in which the importing should be performed; may not be null
 *
 */
public CndImporter( ExecutionContext context ) {
  assert context != null;
  this.localRegistry = new LocalNamespaceRegistry(context.getNamespaceRegistry());
  this.context = context.with(this.localRegistry);
  this.valueFactory = new JcrValueFactory(this.context);
  this.nameFactory = this.context.getValueFactories().getNameFactory();
  this.stringFactory = this.context.getValueFactories().getStringFactory();
  this.nodeTypes = new LinkedList<NodeTypeDefinition>();
}

代码示例来源:origin: ModeShape/modeshape

@Test
  public void shouldCreateSubcontextsWithDifferentIdentifiers() {
    ExecutionContext newContext = context.with(mock(BinaryStore.class));
    assertThat(newContext.getId(), is(not(context.getId())));
  }
}

相关文章