Package org.italiangrid.utils.voms

Examples of org.italiangrid.utils.voms.SecurityContextImpl


     */
    protected synchronized void getFQANsFromSecurityContext() {

        log.debug( "Fectching FQANs out of the security context");
       
        SecurityContextImpl ctxt = SecurityContextImpl.getCurrentContext();
       
        try {

            List <VOMSAttribute> attrs = validator.validate(ctxt.getClientCertChain());

            List <VOMSFQAN> myFQANs = new ArrayList <VOMSFQAN>();

            for ( VOMSAttribute voAttr : attrs ) {

View Full Code Here


     * Initializes the context from a servlet request.
     * @param request
     */
    public static void setContextFromRequest( final ServletRequest request ) {

        SecurityContextImpl sc = new SecurityContextImpl();
        SecurityContextImpl.setCurrentContext( sc );

        String remoteAddress = request.getRemoteAddr();
        sc.setRemoteAddr(remoteAddress);

        X509Certificate[] certChain = null;
        try {

            certChain = (X509Certificate[]) request
                    .getAttribute( "javax.servlet.request.X509Certificate" );

        } catch ( Exception e ) {

            logger.error( "Exception during certificate chain retrieval: " + e );
            throw new PAPAuthzException( "No certificate found in request!", e );

        }
       
        if (certChain == null)
            throw new PAPAuthzException( "No certificate found in request!");

        sc.setClientCertChain( certChain );

        String subject = X500NameUtils.getReadableForm(sc.getClientX500Principal());
        String issuer = X500NameUtils.getReadableForm(sc.getIssuerX500Principal());
       
        BigInteger sn = sc.getClientCert().getSerialNumber();
        String serialNumber = ( sn == null ) ? "NULL" : sn.toString();

        logger.info( "Connection from \"" + remoteAddress + "\" by \""
                + subject + "\" (issued by \"" + issuer
                + "\", " + "serial " + serialNumber + ")" );
View Full Code Here

TOP

Related Classes of org.italiangrid.utils.voms.SecurityContextImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.