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);
}
}
Aggregations