Examples of CertificateCredential


Examples of org.apache.airavata.credential.store.CertificateCredential

            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.");
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

            ResultSet resultSet = preparedStatement.executeQuery();


            if (resultSet.next()) {
                CertificateCredential certificateCredential = new CertificateCredential();

                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());

                Blob blobPK = resultSet.getBlob("PRIVATE_KEY");
                byte[] pk = blobPK.getBytes(1, (int) blobPK.length());

                certificateCredential.setCertificate((X509Certificate) convertByteArrayToObject(certificate));
                certificateCredential.setPrivateKey((PrivateKey) convertByteArrayToObject(pk));

                certificateCredential.setLifeTime(resultSet.getLong("LIFETIME"));
                certificateCredential.setCommunityUser(new CommunityUser(gatewayName, communityUserName, null));
                certificateCredential.setPortalUserName(resultSet.getString("REQUESTING_PORTAL_USER_NAME"));
                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("REQUESTED_TIME"));

                return certificateCredential;
            }

        } catch (SQLException e) {
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

            preparedStatement.setString(1, gatewayName);

            ResultSet resultSet = preparedStatement.executeQuery();

            CertificateCredential certificateCredential;

            while (resultSet.next()) {
                certificateCredential = new CertificateCredential();

                certificateCredential.setCommunityUser(new CommunityUser(gatewayName,
                        resultSet.getString("COMMUNITY_USER_NAME"), null));

                Blob blobCredentials = resultSet.getBlob("CREDENTIAL");
                byte[] certificate = blobCredentials.getBytes(1, (int) blobCredentials.length());

                Blob blobPK = resultSet.getBlob("PRIVATE_KEY");
                byte[] pk = blobPK.getBytes(1, (int) blobPK.length());

                certificateCredential.setCertificate((X509Certificate) convertByteArrayToObject(certificate));
                certificateCredential.setPrivateKey((PrivateKey) convertByteArrayToObject(pk));

                certificateCredential.setNotBefore(resultSet.getString("NOT_BEFORE"));
                certificateCredential.setNotBefore(resultSet.getString("NOT_AFTER"));
                certificateCredential.setLifeTime(resultSet.getLong("LIFETIME"));
                certificateCredential.setPortalUserName(resultSet.getString("REQUESTING_PORTAL_USER_NAME"));
                certificateCredential.setCertificateRequestedTime(resultSet.getTimestamp("REQUESTED_TIME"));

                credentialList.add(certificateCredential);
            }

        } catch (SQLException e) {
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

        return new CommunityUser(gateway, name, "amila@sciencegateway.org");
    }

    private void addTestCredentials() throws Exception {

        CertificateCredential certificateCredential = new CertificateCredential();
        certificateCredential.setCertificate(x509Certificate);
        certificateCredential.setPrivateKey(privateKey);
        certificateCredential.setCommunityUser(getCommunityUser("gw1", "tom"));
        certificateCredential.setLifeTime(1000);
        certificateCredential.setPortalUserName("jerry");
        certificateCredential.setNotBefore("13 OCT 2012 5:34:23");
        certificateCredential.setNotAfter("14 OCT 2012 5:34:23");

        credentialsDAO.addCredentials(certificateCredential);
    }
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

    @Test
    public void testAddCredentials() throws Exception {

        addTestCredentials();

        CertificateCredential certificateCredential
                = credentialsDAO.getCredential("gw1", "tom");
        Assert.assertNotNull(certificateCredential);
        Assert.assertEquals("jerry", certificateCredential.getPortalUserName());
        Assert.assertEquals(x509Certificate, certificateCredential.getCertificate());
        Assert.assertEquals(privateKey, certificateCredential.getPrivateKey());

    }
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

    @Test
    public void testDeleteCredentials() throws Exception {

        addTestCredentials();

        CertificateCredential certificateCredential
                = credentialsDAO.getCredential("gw1", "tom");
        Assert.assertNotNull(certificateCredential);

        credentialsDAO.deleteCredentials("gw1", "tom");
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

    @Test
    public void testUpdateCredentials() throws Exception {

        addTestCredentials();

        CertificateCredential certificateCredential = new CertificateCredential();
        certificateCredential.setCommunityUser(getCommunityUser("gw1", "tom"));
        certificateCredential.setCertificate(x509Certificate);
        certificateCredential.setPrivateKey(privateKey);
        certificateCredential.setPortalUserName("test2");
        certificateCredential.setLifeTime(50);
        certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
        certificateCredential.setNotAfter("16 OCT 2012 5:34:23");

        credentialsDAO.updateCredentials(certificateCredential);

        certificateCredential = credentialsDAO.getCredential("gw1", "tom");

        Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
                certificateCredential.getCertificate().getIssuerDN().toString());
        Assert.assertNotNull(certificateCredential.getPrivateKey());
        Assert.assertEquals("test2", certificateCredential.getPortalUserName());

    }
View Full Code Here

Examples of org.apache.airavata.credential.store.CertificateCredential

    @Test
    public void testGetCredentials() throws Exception {

        addTestCredentials();

        CertificateCredential certificateCredential = credentialsDAO.getCredential("gw1", "tom");

        Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
                certificateCredential.getCertificate().getIssuerDN().toString());
        Assert.assertNotNull(certificateCredential.getPrivateKey());
    }
View Full Code Here

Examples of org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential

            if (credential instanceof CertificateCredential) {

                log.info("Successfully found credentials for token id - " + getRequestData().getTokenId() +
                        " gateway id - " + getRequestData().getGatewayId());

                CertificateCredential certificateCredential = (CertificateCredential) credential;

                X509Certificate[] certificates = certificateCredential.getCertificates();
                X509Credential newCredential = new X509Credential(certificateCredential.getPrivateKey(), certificates);

                GlobusGSSCredentialImpl cred = new GlobusGSSCredentialImpl(newCredential, GSSCredential.INITIATE_AND_ACCEPT);
                System.out.print(cred.export(ExtendedGSSCredential.IMPEXP_OPAQUE));
                return cred;
                //return new GlobusGSSCredentialImpl(newCredential,
View Full Code Here

Examples of org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential

    private void addTestCredentials() throws Exception {

        Connection connection = getConnection();

        try {
            CertificateCredential certificateCredential = getTestCredentialObject();
            credentialsDAO.addCredentials(certificateCredential.getCommunityUser().getGatewayName(),
                    certificateCredential, connection);

        } finally {
            connection.close();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.