x509certificatecredentialsnoninteractiveaction.java

来自「CAS在Tomcat中实现单点登录项目,单点登录(Single Sign On 」· Java 代码 · 共 48 行

JAVA
48
字号
/* * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license * distributed with this file and available online at * http://www.ja-sig.org/products/cas/overview/license/ */package org.jasig.cas.adaptors.x509.web.flow;import java.security.cert.X509Certificate;import org.jasig.cas.adaptors.x509.authentication.principal.X509CertificateCredentials;import org.jasig.cas.authentication.principal.Credentials;import org.jasig.cas.web.flow.AbstractNonInteractiveCredentialsAction;import org.springframework.webflow.execution.RequestContext;/** * Concrete implementation of AbstractNonInteractiveCredentialsAction that * obtains the X509 Certificates from the HttpServletRequest and places them in * the X509CertificateCredentials. *  * @author Scott Battaglia * @version $Revision: 42053 $ $Date: 2007-06-10 09:17:55 -0400 (Sun, 10 Jun 2007) $ * @since 3.0.4 */public final class X509CertificateCredentialsNonInteractiveAction extends    AbstractNonInteractiveCredentialsAction {    private static final String CERTIFICATE_REQUEST_ATTRIBUTE = "javax.servlet.request.X509Certificate";    protected Credentials constructCredentialsFromRequest(        final RequestContext context) {        final X509Certificate[] certificates = (X509Certificate[]) context            .getExternalContext().getRequestMap().get(                CERTIFICATE_REQUEST_ATTRIBUTE);        if (certificates == null || certificates.length == 0) {            if (logger.isDebugEnabled()) {                logger.debug("Certificates not found in request.");            }            return null;        }        if (logger.isDebugEnabled()) {            logger.debug("Certificate found in request.");        }        return new X509CertificateCredentials(certificates);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?