Search in sources :

Example 6 with CredentialReader

use of org.apache.airavata.credential.store.store.CredentialReader in project airavata by apache.

the class SecurityUtils method addSecurityContext.

public static void addSecurityContext(ProcessContext processContext) throws GFacException {
    if (!processContext.getJobSubmissionProtocol().equals(JobSubmissionProtocol.UNICORE)) {
        logger.error("This is a wrong method to invoke for UNICORE host types,please check your gfac-config.xml");
    } else {
        // set by the framework
        String credentialStoreToken = processContext.getTokenId();
        RequestData requestData;
        try {
            requestData = new RequestData(ServerSettings.getDefaultUserGateway());
        } catch (ApplicationSettingsException e1) {
            throw new GFacException(e1);
        }
        // coming from top tier
        requestData.setTokenId(credentialStoreToken);
        CredentialReader credentialReader = null;
        try {
            credentialReader = GFacUtils.getCredentialReader();
        } catch (Exception e) {
            logger.warn("Cannot get credential reader instance");
        }
        UNICORESecurityContext secCtx = new UNICORESecurityContext(credentialReader, requestData);
    // processContext.addSecurityContext(X509SecurityContext.X509_SECURITY_CONTEXT, secCtx);
    }
}
Also used : ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException) GFacException(org.apache.airavata.gfac.core.GFacException) UNICORESecurityContext(org.apache.airavata.gfac.bes.security.UNICORESecurityContext) RequestData(org.apache.airavata.gfac.core.RequestData) CredentialReader(org.apache.airavata.credential.store.store.CredentialReader) GFacException(org.apache.airavata.gfac.core.GFacException) IOException(java.io.IOException) InvalidKeyException(java.security.InvalidKeyException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException)

Aggregations

CredentialReader (org.apache.airavata.credential.store.store.CredentialReader)6 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)3 IOException (java.io.IOException)2 InvalidKeyException (java.security.InvalidKeyException)2 AiravataException (org.apache.airavata.common.exception.AiravataException)2 Credential (org.apache.airavata.credential.store.credential.Credential)2 CredentialStoreException (org.apache.airavata.credential.store.store.CredentialStoreException)2 GFacException (org.apache.airavata.gfac.core.GFacException)2 RequestData (org.apache.airavata.gfac.core.RequestData)2 MessageContext (org.apache.airavata.messaging.core.MessageContext)2 OrchestratorException (org.apache.airavata.orchestrator.core.exception.OrchestratorException)2 ParseException (java.text.ParseException)1 CommunityUser (org.apache.airavata.credential.store.credential.CommunityUser)1 CertificateCredential (org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential)1 SSHCredential (org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential)1 EmailNotificationMessage (org.apache.airavata.credential.store.notifier.impl.EmailNotificationMessage)1 CredentialReaderImpl (org.apache.airavata.credential.store.store.impl.CredentialReaderImpl)1 UNICORESecurityContext (org.apache.airavata.gfac.bes.security.UNICORESecurityContext)1 SSHKeyAuthentication (org.apache.airavata.gfac.core.authentication.SSHKeyAuthentication)1 ProcessSubmitEvent (org.apache.airavata.model.messaging.event.ProcessSubmitEvent)1