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

x33g5p2x  于2022-02-02 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(155)

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

Wrapper.findSecurityReference介绍

[英]Return the security role link for the specified security role reference name, if any; otherwise return null.
[中]返回指定安全角色引用名称的安全角色链接(如果有);否则返回null

代码示例

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

@Override
public boolean hasRole(final Wrapper wrapper, final Principal principal, final String rawRole) {
  String role = rawRole;
  // Check for a role alias defined in a <security-role-ref> element
  if (wrapper != null) {
    final String realRole = wrapper.findSecurityReference(role);
    if (realRole != null) {
      role = realRole;
    }
  }
  if (principal == null || role == null) {
    return false;
  }
  if (principal instanceof  GenericPrincipal) {
    return ((GenericPrincipal) principal).hasRole(role);
  }
  for (final Realm realm : realms) { // when used implicitely (always?) realms.size == 1 so no need of a strategy
    if (realm.hasRole(wrapper, principal, rawRole)) {
      return true;
    }
  }
  return false;
}

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  log.info(sm.getString("contextConfig.role.link", link));

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  log.warn(sm.getString("contextConfig.role.link", link));

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

/**
 * Return <code>true</code> if the authenticated user principal
 * possesses the specified role name.
 *
 * @param role Role name to be validated
 */
public boolean isUserInRole(String role) {
  // Have we got an authenticated principal at all?
  if (userPrincipal == null)
    return (false);
  // Identify the Realm we will use for checking role assignmenets
  if (context == null)
    return (false);
  Realm realm = context.getRealm();
  if (realm == null)
    return (false);
  // Check for a role alias defined in a <security-role-ref> element
  if (wrapper != null) {
    String realRole = wrapper.findSecurityReference(role);
    if ((realRole != null) &&
      realm.hasRole(userPrincipal, realRole))
      return (true);
  }
  // Check for a role defined directly as a <security-role>
  return (realm.hasRole(userPrincipal, role));
}

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  CatalinaLogger.STARTUP_LOGGER.roleValidationLink(link);

代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib

/*      */   public boolean isUserInRole(String role)
/*      */   {
/* 2160 */     if (this.userPrincipal == null) {
/* 2161 */       return false;
/*      */     }
/*      */ 
/* 2164 */     if (this.context == null)
/* 2165 */       return false;
/* 2166 */     Realm realm = this.context.getRealm();
/* 2167 */     if (realm == null) {
/* 2168 */       return false;
/*      */     }
/*      */ 
/* 2171 */     if (this.wrapper != null) {
/* 2172 */       String realRole = this.wrapper.findSecurityReference(role);
/* 2173 */       if ((realRole != null) && (realm.hasRole(this.userPrincipal, realRole)))
/*      */       {
/* 2175 */         return true;
/*      */       }
/*      */     }
/*      */ 
/* 2179 */     return realm.hasRole(this.userPrincipal, role);
/*      */   }
/*      */

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  log.warn(sm.getString("contextConfig.role.link", link));

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  log.info(sm.getString("contextConfig.role.link", link));

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

/**
 * Return <code>true</code> if the authenticated user principal
 * possesses the specified role name.
 *
 * @param role Role name to be validated
 */
public boolean isUserInRole(String role) {
  // Have we got an authenticated principal at all?
  Principal principal = doGetUserPrincipal();
  if (principal == null)
    return (false);
  // Identify the Realm we will use for checking role assignmenets
  if (context == null)
    return (false);
  Realm realm = context.getRealm();
  if (realm == null)
    return (false);
  // Check for a role alias defined in a <security-role-ref> element
  if (wrapper != null) {
    String realRole = wrapper.findSecurityReference(role);
    if ((realRole != null) &&
      realm.hasRole(principal, realRole))
      return (true);
  }
  // Check for a role defined directly as a <security-role>
  return (realm.hasRole(principal, role));
}

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

String link = wrapper.findSecurityReference(names[j]);
if ((link != null) && !context.findSecurityRole(link)) {
  log.warn(sm.getString("contextConfig.role.link", link));

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

/**
 * Return <code>true</code> if the authenticated user principal
 * possesses the specified role name.
 *
 * @param role Role name to be validated
 */
public boolean isUserInRole(String role) {
  // Have we got an authenticated principal at all?
  Principal principal = doGetUserPrincipal();
  if (principal == null)
    return (false);
  // Identify the Realm we will use for checking role assignmenets
  if (context == null)
    return (false);
  Realm realm = context.getRealm();
  if (realm == null)
    return (false);
  // Check for a role alias defined in a <security-role-ref> element
  if (wrapper != null) {
    String realRole = wrapper.findSecurityReference(role);
    if ((realRole != null) &&
      realm.hasRole(principal, realRole))
      return (true);
  }
  // Check for a role defined directly as a <security-role>
  return (realm.hasRole(principal, role));
}

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null) {
  role = realRole;

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

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

String realRole = wrapper.findSecurityReference(role);
if (realRole != null)
  role = realRole;

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

String realRole = wrapper.findSecurityReference(role);
if (realRole != null) {
  role = realRole;

相关文章