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

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

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

X500PrincipalUtil.asX500Principal介绍

[英]Attempt to convert the given principal to an X.500 principal.
[中]尝试将给定主体转换为X.500主体。

代码示例

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

  1. /**
  2. * Attempt to convert the given principal to an X.500 principal.
  3. *
  4. * @param principal the original principal
  5. * @return the X.500 principal or {@code null} if the principal can not be converted.
  6. */
  7. public static X500Principal asX500Principal(Principal principal) {
  8. return asX500Principal(principal, false);
  9. }

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

  1. public String getName(final Principal principal) {
  2. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
  3. if (x500Principal == null) {
  4. return null;
  5. }
  6. if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
  7. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
  8. return null;
  9. }
  10. final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
  11. if (values.length == 0) {
  12. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
  13. return null;
  14. } else {
  15. final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
  16. if (ElytronMessages.log.isTraceEnabled()) {
  17. ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
  18. }
  19. return name;
  20. }
  21. }
  22. }

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

  1. return new KeyStoreRealmIdentity(name);
  2. } else {
  3. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal);
  4. if (x500Principal == null) {
  5. log.tracef("KeyStoreRealm: conversion of principal [%s] to X500Principal failed", principal);
  6. if (keyStore.isCertificateEntry(alias)) {
  7. final Certificate certificate = keyStore.getCertificate(alias);
  8. if (certificate instanceof X509Certificate && x500Principal.equals(X500PrincipalUtil.asX500Principal(((X509Certificate) certificate).getSubjectX500Principal()))) {
  9. log.tracef("KeyStoreRealm: certificate found by X500Principal in alias [%s]", alias);
  10. return new KeyStoreRealmIdentity(alias);

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

  1. throw ElytronMessages.log.emptyChainNotTrusted();
  2. Principal principal = X500PrincipalUtil.asX500Principal(chain[0].getSubjectX500Principal());
  3. if (principal == null) {
  4. throw ElytronMessages.log.notTrusted(null);

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

  1. /**
  2. * Attempt to convert the given principal to an X.500 principal.
  3. *
  4. * @param principal the original principal
  5. * @return the X.500 principal or {@code null} if the principal can not be converted.
  6. */
  7. public static X500Principal asX500Principal(Principal principal) {
  8. return asX500Principal(principal, false);
  9. }

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

  1. /**
  2. * Attempt to convert the given principal to an X.500 principal.
  3. *
  4. * @param principal the original principal
  5. * @return the X.500 principal or {@code null} if the principal can not be converted.
  6. */
  7. public static X500Principal asX500Principal(Principal principal) {
  8. return asX500Principal(principal, false);
  9. }

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

  1. /**
  2. * Attempt to convert the given principal to an X.500 principal.
  3. *
  4. * @param principal the original principal
  5. * @return the X.500 principal or {@code null} if the principal can not be converted.
  6. */
  7. public static X500Principal asX500Principal(Principal principal) {
  8. return asX500Principal(principal, false);
  9. }

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

  1. public String getName(final Principal principal) {
  2. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
  3. if (x500Principal == null) {
  4. return null;
  5. }
  6. if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
  7. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
  8. return null;
  9. }
  10. final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
  11. if (values.length == 0) {
  12. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
  13. return null;
  14. } else {
  15. final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
  16. if (ElytronMessages.log.isTraceEnabled()) {
  17. ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
  18. }
  19. return name;
  20. }
  21. }
  22. }

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

  1. public String getName(final Principal principal) {
  2. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
  3. if (x500Principal == null) {
  4. return null;
  5. }
  6. if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
  7. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
  8. return null;
  9. }
  10. final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
  11. if (values.length == 0) {
  12. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
  13. return null;
  14. } else {
  15. final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
  16. if (ElytronMessages.log.isTraceEnabled()) {
  17. ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
  18. }
  19. return name;
  20. }
  21. }
  22. }

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

  1. public String getName(final Principal principal) {
  2. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
  3. if (x500Principal == null) {
  4. return null;
  5. }
  6. if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
  7. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
  8. return null;
  9. }
  10. final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
  11. if (values.length == 0) {
  12. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
  13. return null;
  14. } else {
  15. final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
  16. if (ElytronMessages.log.isTraceEnabled()) {
  17. ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
  18. }
  19. return name;
  20. }
  21. }
  22. }

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

  1. public String getName(final Principal principal) {
  2. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal, convert);
  3. if (x500Principal == null) {
  4. return null;
  5. }
  6. if (requiredOids != null && requiredOids.length != 0 && ! X500PrincipalUtil.containsAllAttributes(x500Principal, requiredOids)) {
  7. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - does not contain required oids", x500Principal);
  8. return null;
  9. }
  10. final String[] values = X500PrincipalUtil.getAttributeValues(x500Principal, oid, reverse);
  11. if (values.length == 0) {
  12. ElytronMessages.log.tracef("X500 principal [%s] was not decoded - no values of attribute [%s]", x500Principal, oid);
  13. return null;
  14. } else {
  15. final String name = Arrays.stream(values).skip(startSegment).limit(maximumSegments).collect(Collectors.joining(joiner));
  16. if (ElytronMessages.log.isTraceEnabled()) {
  17. ElytronMessages.log.tracef("X500 principal [%s] decoded as name [%s] (attribute values: [%s])", x500Principal, name, String.join(", ", values));
  18. }
  19. return name;
  20. }
  21. }
  22. }

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

  1. return new KeyStoreRealmIdentity(name);
  2. } else {
  3. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal);
  4. if (x500Principal == null) {
  5. log.tracef("KeyStoreRealm: conversion of principal [%s] to X500Principal failed", principal);
  6. if (keyStore.isCertificateEntry(alias)) {
  7. final Certificate certificate = keyStore.getCertificate(alias);
  8. if (certificate instanceof X509Certificate && x500Principal.equals(X500PrincipalUtil.asX500Principal(((X509Certificate) certificate).getSubjectX500Principal()))) {
  9. log.tracef("KeyStoreRealm: certificate found by X500Principal in alias [%s]", alias);
  10. return new KeyStoreRealmIdentity(alias);

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

  1. return new KeyStoreRealmIdentity(name);
  2. } else {
  3. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal);
  4. if (x500Principal == null) {
  5. log.tracef("KeyStoreRealm: conversion of principal [%s] to X500Principal failed", principal);
  6. if (keyStore.isCertificateEntry(alias)) {
  7. final Certificate certificate = keyStore.getCertificate(alias);
  8. if (certificate instanceof X509Certificate && x500Principal.equals(X500PrincipalUtil.asX500Principal(((X509Certificate) certificate).getSubjectX500Principal()))) {
  9. log.tracef("KeyStoreRealm: certificate found by X500Principal in alias [%s]", alias);
  10. return new KeyStoreRealmIdentity(alias);

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

  1. return new KeyStoreRealmIdentity(name);
  2. } else {
  3. final X500Principal x500Principal = X500PrincipalUtil.asX500Principal(principal);
  4. if (x500Principal == null) {
  5. log.tracef("KeyStoreRealm: conversion of principal [%s] to X500Principal failed", principal);
  6. if (keyStore.isCertificateEntry(alias)) {
  7. final Certificate certificate = keyStore.getCertificate(alias);
  8. if (certificate instanceof X509Certificate && x500Principal.equals(X500PrincipalUtil.asX500Principal(((X509Certificate) certificate).getSubjectX500Principal()))) {
  9. log.tracef("KeyStoreRealm: certificate found by X500Principal in alias [%s]", alias);
  10. return new KeyStoreRealmIdentity(alias);

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

  1. throw ElytronMessages.log.emptyChainNotTrusted();
  2. Principal principal = X500PrincipalUtil.asX500Principal(chain[0].getSubjectX500Principal());
  3. if (principal == null) {
  4. throw ElytronMessages.log.notTrusted(null);

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

  1. throw ElytronMessages.log.emptyChainNotTrusted();
  2. Principal principal = X500PrincipalUtil.asX500Principal(chain[0].getSubjectX500Principal());
  3. if (principal == null) {
  4. throw ElytronMessages.log.notTrusted(null);

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

  1. throw ElytronMessages.log.emptyChainNotTrusted();
  2. Principal principal = X500PrincipalUtil.asX500Principal(chain[0].getSubjectX500Principal());
  3. if (principal == null) {
  4. throw ElytronMessages.log.notTrusted(null);

相关文章