gpt4 book ai didi

io.undertow.security.idm.X509CertificateCredential类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 15:32:40 26 4
gpt4 key购买 nike

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

X509CertificateCredential介绍

[英]A Credential implementation which wraps an X.509 certificate.
[中]封装X.509证书的凭证实现。

代码示例

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

public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) {
  SSLSessionInfo sslSession = exchange.getConnection().getSslSessionInfo();
  if (sslSession != null) {
    try {
      Certificate[] clientCerts = getPeerCertificates(exchange, sslSession, securityContext);
      if (clientCerts[0] instanceof X509Certificate) {
        Credential credential = new X509CertificateCredential((X509Certificate) clientCerts[0]);
        IdentityManager idm = getIdentityManager(securityContext);
        Account account = idm.verify(credential);
        if (account != null) {
          securityContext.authenticationComplete(account, name, false);
          return AuthenticationMechanismOutcome.AUTHENTICATED;
        }
      }
    } catch (SSLPeerUnverifiedException e) {
      // No action - this mechanism can not attempt authentication without peer certificates so allow it to drop out
      // to NOT_ATTEMPTED.
    }
  }
  /*
   * For ClientCert we do not have a concept of a failed authentication, if the client did use a key then it was deemed
   * acceptable for the connection to be established, this mechanism then just 'attempts' to use it for authentication but
   * does not mandate success.
   */
  return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
}

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

@Override
public Account verify(Credential credential) {
  if (credential instanceof X509CertificateCredential) {
    X509CertificateCredential certCredential = (X509CertificateCredential) credential;
    X509Certificate certificate = certCredential.getCertificate();
    AccountImpl account = getAccount(certificate.getSubjectDN().getName());
    return verifyCredential(account, certificate);
  }
  throw new IllegalArgumentException("Parameter must be a X509CertificateCredential");
}

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

@Override
public Account verify(Credential credential) {
  if (credential instanceof X509CertificateCredential) {
    X509CertificateCredential certCredential = (X509CertificateCredential) credential;
    X509Certificate certificate = certCredential.getCertificate();
    AccountImpl account = getAccount(certificate.getSubjectDN().getName());
    return verifyCredential(account, certificate);
  }
  throw new IllegalArgumentException("Parameter must be a X509CertificateCredential");
}

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

public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) {
  SSLSessionInfo sslSession = exchange.getConnection().getSslSessionInfo();
  if (sslSession != null) {
    try {
      Certificate[] clientCerts = getPeerCertificates(exchange, sslSession, securityContext);
      if (clientCerts[0] instanceof X509Certificate) {
        Credential credential = new X509CertificateCredential((X509Certificate) clientCerts[0]);
        IdentityManager idm = getIdentityManager(securityContext);
        Account account = idm.verify(credential);
        if (account != null) {
          securityContext.authenticationComplete(account, name, false);
          return AuthenticationMechanismOutcome.AUTHENTICATED;
        }
      }
    } catch (SSLPeerUnverifiedException e) {
      // No action - this mechanism can not attempt authentication without peer certificates so allow it to drop out
      // to NOT_ATTEMPTED.
    }
  }
  /*
   * For ClientCert we do not have a concept of a failed authentication, if the client did use a key then it was deemed
   * acceptable for the connection to be established, this mechanism then just 'attempts' to use it for authentication but
   * does not mandate success.
   */
  return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
}

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

@Override
public Account verify(Credential credential) {
  if (credential instanceof X509CertificateCredential) {
    X509CertificateCredential certCredential = (X509CertificateCredential) credential;
    X509Certificate certificate = certCredential.getCertificate();
    AccountImpl account = getAccount(certificate.getSubjectDN().getName());
    return verifyCredential(account, certificate);
  }
  throw new IllegalArgumentException("Parameter must be a X509CertificateCredential");
}

代码示例来源:origin: io.undertow/undertow-core

public AuthenticationMechanismOutcome authenticate(final HttpServerExchange exchange, final SecurityContext securityContext) {
  SSLSessionInfo sslSession = exchange.getConnection().getSslSessionInfo();
  if (sslSession != null) {
    try {
      Certificate[] clientCerts = getPeerCertificates(exchange, sslSession, securityContext);
      if (clientCerts[0] instanceof X509Certificate) {
        Credential credential = new X509CertificateCredential((X509Certificate) clientCerts[0]);
        IdentityManager idm = getIdentityManager(securityContext);
        Account account = idm.verify(credential);
        if (account != null) {
          securityContext.authenticationComplete(account, name, false);
          return AuthenticationMechanismOutcome.AUTHENTICATED;
        }
      }
    } catch (SSLPeerUnverifiedException e) {
      // No action - this mechanism can not attempt authentication without peer certificates so allow it to drop out
      // to NOT_ATTEMPTED.
    }
  }
  /*
   * For ClientCert we do not have a concept of a failed authentication, if the client did use a key then it was deemed
   * acceptable for the connection to be established, this mechanism then just 'attempts' to use it for authentication but
   * does not mandate success.
   */
  return AuthenticationMechanismOutcome.NOT_ATTEMPTED;
}

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

user = certCred.getCertificate().getSubjectDN();
} else if (credential instanceof GSSContextCredential) {
  GSSContextCredential gssCred = (GSSContextCredential) credential;

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com