gpt4 book ai didi

io.undertow.security.idm.X509CertificateCredential.()方法的使用及代码示例

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

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

X509CertificateCredential.<init>介绍

暂无

代码示例

代码示例来源: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: 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: 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;
}

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