org.wildfly.security.x500.util.X500PrincipalUtil.containsAllAttributes()方法的使用及代码示例

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

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

X500PrincipalUtil.containsAllAttributes介绍

[英]Determine if the given principal contains all of the attributes specified by the given OIDs. This includes occurrences within multi-valued RDNs.
[中]确定给定主体是否包含给定OID指定的所有属性。这包括多值RDN中的事件。

代码示例

代码示例来源:origin: wildfly/wildfly

public String getName(final Principal principal) {
    final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
    if (x500Principal == null) {
      return null;
    }
    if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
      return null;
    }
    final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
    if (values.length == 0) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
      return null;
    } else {
      final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
      if (ElytronMessages.log.isTraceEnabled()) {
        ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
      }
      return name;
    }
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public String getName(final Principal principal) {
    final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
    if (x500Principal == null) {
      return null;
    }
    if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
      return null;
    }
    final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
    if (values.length == 0) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
      return null;
    } else {
      final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
      if (ElytronMessages.log.isTraceEnabled()) {
        ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
      }
      return name;
    }
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

public String getName(final Principal principal) {
    final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
    if (x500Principal == null) {
      return null;
    }
    if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
      return null;
    }
    final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
    if (values.length == 0) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
      return null;
    } else {
      final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
      if (ElytronMessages.log.isTraceEnabled()) {
        ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
      }
      return name;
    }
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-x500-deprecated

public String getName(final Principal principal) {
    final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
    if (x500Principal == null) {
      return null;
    }
    if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
      return null;
    }
    final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
    if (values.length == 0) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
      return null;
    } else {
      final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
      if (ElytronMessages.log.isTraceEnabled()) {
        ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
      }
      return name;
    }
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-x500-principal

public String getName(final Principal principal) {
    final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
    if (x500Principal == null) {
      return null;
    }
    if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
      return null;
    }
    final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
    if (values.length == 0) {
      ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
      return null;
    } else {
      final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
      if (ElytronMessages.log.isTraceEnabled()) {
        ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
      }
      return name;
    }
  }
}

相关文章