Package edu.uiuc.ncsa.myproxy.oa4mp.client

Examples of edu.uiuc.ncsa.myproxy.oa4mp.client.AssetResponse


            JSPUtil.fwd(request, response, ERROR_PAGE);
            return;
        }
        info("2.a Token and verifier found.");
        X509Certificate cert = null;
        AssetResponse assetResponse = null;
        OA4MPResponse oa4MPResponse = null;

        Map<String, String> parameters = createQueryParameters(gatewayName, portalUserName,
                                                     contactEmail, duration);

        try {
            info("Requesting private key ...");
            oa4MPResponse = getOA4MPService().requestCert(parameters);

            info("2.a. Getting the cert(s) from the service");
            assetResponse = getOA4MPService().getCert(token, verifier);
            cert = assetResponse.getX509Certificates()[0];

            // The work in this call
        } catch (Throwable t) {
            warn("2.a. Exception from the server: " + t.getCause().getMessage());
            error("Exception while trying to get cert. message:" + t.getMessage());
            request.setAttribute("exception", t);
            JSPUtil.fwd(request, response, ERROR_PAGE);
            return;
        }
        info("2.b. Done! Displaying success page.");

        CertificateCredential certificateCredential = new CertificateCredential();

        certificateCredential.setNotBefore(Utility.convertDateToString(cert.getNotBefore()));
        certificateCredential.setNotAfter(Utility.convertDateToString(cert.getNotAfter()));
        certificateCredential.setCertificate(cert);
        certificateCredential.setPrivateKey(oa4MPResponse.getPrivateKey());
        certificateCredential.setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(),
                contactEmail));
        certificateCredential.setPortalUserName(portalUserName);
        certificateCredential.setLifeTime(duration);

        certificateCredentialWriter.writeCredentials(certificateCredential);

        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
        stringBuilder.append(" Certificate DN - ").append(cert.getSubjectDN());

        info(stringBuilder.toString());

        String contextPath = request.getContextPath();
View Full Code Here


            JSPUtil.fwd(request, response, ERROR_PAGE);
            return;
        }
        info("2.a Token and verifier found.");
        X509Certificate cert = null;
        AssetResponse assetResponse = null;
        OA4MPResponse oa4MPResponse = null;

        Map<String, String> parameters = createQueryParameters(gatewayName, portalUserName, contactEmail, portalTokenId);

        try {
            info("Requesting private key ...");
            oa4MPResponse = getOA4MPService().requestCert(parameters);
            // oa4MPResponse = getOA4MPService().requestCert();

            info("2.a. Getting the cert(s) from the service");
            assetResponse = getOA4MPService().getCert(token, verifier);
            cert = assetResponse.getX509Certificates()[0];

            // The work in this call
        } catch (Throwable t) {
            warn("2.a. Exception from the server: " + t.getCause().getMessage());
            error("Exception while trying to get cert. message:" + t.getMessage());
            request.setAttribute("exception", t);
            JSPUtil.fwd(request, response, ERROR_PAGE);
            return;
        }
        info("2.b. Done! Displaying success page.");

        CertificateCredential certificateCredential = new CertificateCredential();

        certificateCredential.setNotBefore(Utility.convertDateToString(cert.getNotBefore()));
        certificateCredential.setNotAfter(Utility.convertDateToString(cert.getNotAfter()));
        certificateCredential.setCertificate(cert);
        certificateCredential.setPrivateKey(oa4MPResponse.getPrivateKey());
        certificateCredential
                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
        certificateCredential.setPortalUserName(portalUserName);
        certificateCredential.setLifeTime(duration);
        certificateCredential.setToken(portalTokenId);

        certificateCredentialWriter.writeCredentials(certificateCredential);

        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
        stringBuilder.append(" Certificate DN - ").append(cert.getSubjectDN());

        info(stringBuilder.toString());

        String contextPath = request.getContextPath();
View Full Code Here

            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }
        info("2.a Token and verifier found.");
        X509Certificate[] certificates;
        AssetResponse assetResponse = null;

        PrivateKey privateKey;

        try {

            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
            privateKey = privateKeyStore.getKey(portalTokenId);

            if (privateKey != null) {
                info("Found private key for token " + portalTokenId);
            } else {
                info("Could not find private key for token " + portalTokenId);
            }

            info("2.a. Getting the cert(s) from the service");
            assetResponse = getOA4MPService().getCert(token, verifier);

            certificates = assetResponse.getX509Certificates();

        } catch (Throwable t) {
            warn("2.a. Exception from the server: " + t.getCause().getMessage());
            error("Exception while trying to get cert. message:" + t.getMessage());
            request.setAttribute("exception", t);
            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }

        info("2.b. Done! Displaying success page.");

        CertificateCredential certificateCredential = new CertificateCredential();

        certificateCredential.setNotBefore(Utility.convertDateToString(certificates[0].getNotBefore())); //TODO check this is correct
        certificateCredential.setNotAfter(Utility.convertDateToString(certificates[0].getNotAfter()));
        certificateCredential.setCertificates(certificates);
        certificateCredential.setPrivateKey(privateKey);
        certificateCredential
                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
        certificateCredential.setPortalUserName(portalUserName);
        certificateCredential.setLifeTime(duration);
        certificateCredential.setToken(portalTokenId);


        certificateCredentialWriter.writeCredentials(certificateCredential);

        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
        stringBuilder.append(" Certificate DN - ").append(certificates[0].getSubjectDN());

        info(stringBuilder.toString());

        if (isUrlInSameServer(configurationReader.getSuccessUrl())) {
View Full Code Here

            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }
        info("2.a Token and verifier found.");
        X509Certificate[] certificates;
        AssetResponse assetResponse = null;

        PrivateKey privateKey;

        try {

            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
            privateKey = privateKeyStore.getKey(portalTokenId);

            if (privateKey != null) {
                info("Found private key for token " + portalTokenId);
            } else {
                info("Could not find private key for token " + portalTokenId);
            }

            info("2.a. Getting the cert(s) from the service");
            assetResponse = getOA4MPService().getCert(token, verifier);

            certificates = assetResponse.getX509Certificates();

        } catch (Throwable t) {
            warn("2.a. Exception from the server: " + t.getCause().getMessage());
            error("Exception while trying to get cert. message:" + t.getMessage());
            request.setAttribute("exception", t);
            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }

        info("2.b. Done! Displaying success page.");

        CertificateCredential certificateCredential = new CertificateCredential();

        certificateCredential.setNotBefore(Utility.convertDateToString(certificates[0].getNotBefore())); //TODO check this is correct
        certificateCredential.setNotAfter(Utility.convertDateToString(certificates[0].getNotAfter()));
        certificateCredential.setCertificates(certificates);
        certificateCredential.setPrivateKey(privateKey);
        certificateCredential
                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
        certificateCredential.setPortalUserName(portalUserName);
        certificateCredential.setLifeTime(duration);
        certificateCredential.setToken(portalTokenId);


        certificateCredentialWriter.writeCredentials(certificateCredential);

        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
        stringBuilder.append(" Certificate DN - ").append(certificates[0].getSubjectDN());

        info(stringBuilder.toString());

        if (isUrlInSameServer(configurationReader.getSuccessUrl())) {
View Full Code Here

            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }
        info("2.a Token and verifier found.");
        X509Certificate[] certificates;
        AssetResponse assetResponse = null;

        PrivateKey privateKey;

        try {

            PrivateKeyStore privateKeyStore = PrivateKeyStore.getPrivateKeyStore();
            privateKey = privateKeyStore.getKey(portalTokenId);

            if (privateKey != null) {
                info("Found private key for token " + portalTokenId);
            } else {
                info("Could not find private key for token " + portalTokenId);
            }

            info("2.a. Getting the cert(s) from the service");
            assetResponse = getOA4MPService().getCert(token, verifier);

            certificates = assetResponse.getX509Certificates();

        } catch (Throwable t) {
            warn("2.a. Exception from the server: " + t.getCause().getMessage());
            error("Exception while trying to get cert. message:" + t.getMessage());
            request.setAttribute("exception", t);
            JSPUtil.fwd(request, response, configurationReader.getErrorUrl());
            return;
        }

        info("2.b. Done! Displaying success page.");

        CertificateCredential certificateCredential = new CertificateCredential();

        certificateCredential.setNotBefore(Utility.convertDateToString(certificates[0].getNotBefore())); //TODO check this is correct
        certificateCredential.setNotAfter(Utility.convertDateToString(certificates[0].getNotAfter()));
        certificateCredential.setCertificates(certificates);
        certificateCredential.setPrivateKey(privateKey);
        certificateCredential
                .setCommunityUser(new CommunityUser(gatewayName, assetResponse.getUsername(), contactEmail));
        certificateCredential.setPortalUserName(portalUserName);
        certificateCredential.setLifeTime(duration);
        certificateCredential.setToken(portalTokenId);


        certificateCredentialWriter.writeCredentials(certificateCredential);

        StringBuilder stringBuilder = new StringBuilder("Certificate for community user ");
        stringBuilder.append(assetResponse.getUsername()).append(" successfully persisted.");
        stringBuilder.append(" Certificate DN - ").append(certificates[0].getSubjectDN());

        info(stringBuilder.toString());

        if (isUrlInSameServer(configurationReader.getSuccessUrl())) {
View Full Code Here

TOP

Related Classes of edu.uiuc.ncsa.myproxy.oa4mp.client.AssetResponse

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.