Package org.apache.airavata.credential.store.credential.impl.certificate

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


            if (credential instanceof CertificateCredential) {

                log.info("Successfully found credentials for token id - " + tokenId +
                            " gateway id - " + gatewayId);

                CertificateCredential certificateCredential = (CertificateCredential) credential;

                X509Certificate[] certificates = new X509Certificate[1];
                certificates[0] = certificateCredential.getCertificate();

                //TODO suspecting about the certificate chain .... need to sort that out
                GlobusCredential newCredential = new GlobusCredential(certificateCredential.getPrivateKey(),
                        certificates);

                return new GlobusGSSCredentialImpl(newCredential,
                        GSSCredential.INITIATE_AND_ACCEPT);
            } else {
View Full Code Here


    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

        }
    }

    public CertificateCredential getTestCredentialObject() {

        CertificateCredential certificateCredential = new CertificateCredential();
        certificateCredential.setToken("tom");
        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");

        return certificateCredential;

    }
View Full Code Here

    }

    @Test
    public void testSerialization() throws IOException, ClassNotFoundException {

        CertificateCredential certificateCredential = getTestCredentialObject();

        byte[] array = CredentialsDAO.convertObjectToByteArray(certificateCredential);
        CertificateCredential readCertificateCredential = (CertificateCredential) CredentialsDAO
                .convertByteArrayToObject(array);

        Assert.assertEquals(certificateCredential.getCertificate(), readCertificateCredential.getCertificate());
        Assert.assertEquals(certificateCredential.getCertificateRequestedTime(),
                readCertificateCredential.getCertificateRequestedTime());
        Assert.assertEquals(certificateCredential.getCommunityUser().getGatewayName(), readCertificateCredential
                .getCommunityUser().getGatewayName());
        Assert.assertEquals(certificateCredential.getCommunityUser().getUserEmail(), readCertificateCredential
                .getCommunityUser().getUserEmail());
        Assert.assertEquals(certificateCredential.getCommunityUser().getUserName(), readCertificateCredential
                .getCommunityUser().getUserName());
        Assert.assertEquals(certificateCredential.getLifeTime(), readCertificateCredential.getLifeTime());
        Assert.assertEquals(certificateCredential.getNotAfter(), readCertificateCredential.getNotAfter());
        Assert.assertEquals(certificateCredential.getNotBefore(), readCertificateCredential.getNotBefore());
        Assert.assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());

        PrivateKey newKey = readCertificateCredential.getPrivateKey();

        Assert.assertNotNull(newKey);
        Assert.assertEquals(privateKey.getClass(), newKey.getClass());

        Assert.assertEquals(privateKey.getFormat(), newKey.getFormat());
View Full Code Here

        addTestCredentials();

        Connection connection = getConnection();

        try {
            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
                    "tom", connection);
            Assert.assertNotNull(certificateCredential);
            Assert.assertEquals("jerry", certificateCredential.getPortalUserName());
            Assert.assertEquals(x509Certificate, certificateCredential.getCertificate());
            Assert.assertEquals(privateKey.getFormat(), certificateCredential.getPrivateKey().getFormat());
        } finally {
            connection.close();
        }
    }
View Full Code Here

        addTestCredentials();

        Connection connection = getConnection();

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

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

        Connection connection = getConnection();

        try {
            CommunityUser communityUser = getCommunityUser("gw1", "tom");
            CertificateCredential certificateCredential = new CertificateCredential();
            certificateCredential.setToken("tom");
            certificateCredential.setCommunityUser(communityUser);
            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(communityUser.getGatewayName(), certificateCredential, connection);

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

            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());

        } finally {
            connection.close();
        }
View Full Code Here

        Connection connection = getConnection();

        try {

            CertificateCredential certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1",
                    "tom", connection);
            Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
                    certificateCredential.getCertificate().getIssuerDN().toString());
            // Assert.assertNotNull(certificateCredential.getPrivateKey());

        } finally {
            connection.close();
        }
View Full Code Here

            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

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

TOP

Related Classes of org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential

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.