org.apache.catalina.Container.getRealm()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(141)

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

Container.getRealm介绍

[英]Return the Realm with which this Container is associated. If there is no associated Realm, return the Realm associated with our parent Container (if any); otherwise return null.
[中]返回与此容器关联的域。如果没有关联的领域,则返回与父容器关联的领域(如果有);否则返回null

代码示例

代码示例来源:origin: magro/memcached-session-manager

@Override
public Principal readPrincipal( final ObjectInputStream ois ) throws ClassNotFoundException, IOException {
  return SerializablePrincipal.readPrincipal( ois, getContainer().getRealm() );
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: tomcat/catalina

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public Realm getRealm() {
    if (realm != null)
      return realm;
    
    if (parent != null){
      Realm configured = parent.getRealm();
      if (configured != null)
        return configured;
    }
    return null;
  }
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  if (realm != null)
    return (realm);
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: org.glassfish.main.web/web-core

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Realm getRealm() {
  try {
    readLock.lock();
    if (realm != null)
      return (realm);
  } finally {
    readLock.unlock();
  }
  if (parent != null)
    return (parent.getRealm());
  return (null);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  Lock l = realmLock.readLock();
  l.lock();
  try {
    if (realm != null)
      return realm;
    if (parent != null)
      return parent.getRealm();
    return null;
  } finally {
    l.unlock();
  }
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  Lock l = realmLock.readLock();
  try {
    l.lock();
    if (realm != null)
      return (realm);
    if (parent != null)
      return (parent.getRealm());
    return null;
  } finally {
    l.unlock();
  }
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Return the Realm with which this Container is associated.  If there is
 * no associated Realm, return the Realm associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
@Override
public Realm getRealm() {
  Lock l = realmLock.readLock();
  try {
    l.lock();
    if (realm != null)
      return (realm);
    if (parent != null)
      return (parent.getRealm());
    return null;
  } finally {
    l.unlock();
  }
}

代码示例来源:origin: apache/flex-blazeds

public boolean authorize(Principal principal, List roles)
{
  Realm realm = container.getRealm();
  Iterator iter = roles.iterator();
  while (iter.hasNext())
  {
    String role = (String)iter.next();
    if (realm.hasRole(principal, role))
      return true;
  }
  return false;
}

代码示例来源:origin: apache/flex-blazeds

public boolean authorize(Principal principal, List roles)
{
  Realm realm = container.getRealm();
  Iterator iter = roles.iterator();
  while (iter.hasNext())
  {
    String role = (String)iter.next();
    if (realm.hasRole(principal, role))
      return true;
  }
  return false;
}

代码示例来源:origin: kiegroup/droolsjbpm-integration

@Override
  public void lifecycleEvent(LifecycleEvent lifecycleEvent) {
    Lifecycle lifecycle = lifecycleEvent.getLifecycle();

    if (Lifecycle.AFTER_START_EVENT.equals(lifecycleEvent.getType())) {
      if (lifecycle instanceof Container) {
        TomcatRealmLoginModule.setRealm(((Container) lifecycle).getRealm());
      }
    }
  }
}

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

@Override
  public void containerEvent(final ContainerEvent event) {
    if (Context.class.isInstance(event.getData()) && Container.ADD_CHILD_EVENT.equals(event.getType())) {
      final Context context = Context.class.cast(event.getData());
      if (context.getRealm() != context.getParent().getRealm()) {
        addTracker(context.getRealm());
      }
    }
  }
}

代码示例来源:origin: org.codehaus.fabric3.tomcat/fabric3-tomcat-extension

@Init()
public void init() {
  realm = connectorService.getConnector().getContainer().getRealm();
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

private void addTomEERealm(final Host host) {
  final Realm realm = host.getRealm();
  if (realm != null && !(realm instanceof TomEERealm) && (host.getParent() == null || (!realm.equals(host.getParent().getRealm())))) {
    host.setRealm(tomeeRealm(realm));
  }
}

代码示例来源:origin: org.apache.tomee/tomee-catalina

private void addTomEERealm(final Engine engine) {
  final Realm realm = engine.getRealm();
  if (realm != null && !(realm instanceof TomEERealm) && (engine.getParent() == null || (!realm.equals(engine.getParent().getRealm())))) {
    final Realm tomeeRealm = tomeeRealm(realm);
    engine.setRealm(tomeeRealm);
    if (LifecycleState.STARTING_PREP.equals(engine.getState())) {
      try {
        Lifecycle.class.cast(tomeeRealm).start();
      } catch (final LifecycleException e) {
        throw new IllegalStateException(e);
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat

public Realm getRealm() {
    if (realm != null)
      return realm;
    
    if (parent != null){
      Realm configured = parent.getRealm();
      if (configured != null)
        return configured;
    }
    
    //No realms found up the chain, so lets create a default JAAS Realm
    TomcatJAASRealm defaultRealm = new TomcatJAASRealm();
    defaultRealm.setUserClassNames("org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
    defaultRealm.setRoleClassNames("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
    this.setRealm(defaultRealm);
    return defaultRealm;
  }
}

相关文章

微信公众号

最新文章

更多