use of edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment in project airavata by apache.
the class CredentialStoreCallbackServlet method createQueryParameters.
private Map<String, String> createQueryParameters(String gatewayName, String portalUserName, String portalEmail, String tokenId) {
String callbackUriKey = getEnvironment().getConstants().get(CALLBACK_URI_KEY);
ClientEnvironment clientEnvironment = (ClientEnvironment) getEnvironment();
String callbackUri = clientEnvironment.getCallback().toString();
StringBuilder stringBuilder = new StringBuilder(callbackUri);
stringBuilder.append("?").append(CredentialStoreConstants.GATEWAY_NAME_QUERY_PARAMETER).append("=").append(gatewayName).append("&").append(CredentialStoreConstants.PORTAL_USER_QUERY_PARAMETER).append("=").append(portalUserName).append("&").append(CredentialStoreConstants.PORTAL_USER_EMAIL_QUERY_PARAMETER).append("=").append(portalEmail).append("&").append(CredentialStoreConstants.PORTAL_TOKEN_ID_ASSIGNED).append("=").append(tokenId);
info("Callback URI is set to - " + stringBuilder.toString());
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(callbackUriKey, stringBuilder.toString());
return parameters;
}
use of edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment in project airavata by apache.
the class CredentialStoreCallbackServlet method loadEnvironment.
@Override
public void loadEnvironment() throws IOException {
environment = getConfigurationLoader().load();
oa4mpService = new OA4MPService((ClientEnvironment) environment);
}
use of edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment in project OA4MP by ncsa.
the class ClientServletInitializer method init.
@Override
public void init() throws ServletException {
if (hasRun)
return;
// run it once and only once.
hasRun = true;
MyLoggingFacade logger = getEnvironment().getMyLogger();
ClientEnvironment ce = (ClientEnvironment) getEnvironment();
// This next bit is a
if (ce.hasAssetStore()) {
if (ce.getAssetStore() instanceof SQLStore) {
SQLStore sqlStore = (SQLStore) ce.getAssetStore();
try {
sqlStore.checkTable();
sqlStore.checkColumns();
} catch (SQLException sqlX) {
logger.warn("Could not update store table:" + sqlX.getMessage());
}
}
Cleanup<Identifier, Asset> assetCleanup = ClientServlet.assetCleanup;
if (ce.isEnableAssetCleanup() && assetCleanup == null) {
assetCleanup = new Cleanup<Identifier, Asset>(logger);
assetCleanup.setStopThread(false);
assetCleanup.setMap(ce.getAssetStore());
assetCleanup.addRetentionPolicy(new ValidTimestampPolicy(ce.getMaxAssetLifetime()));
logger.info("Starting asset cleanup thread");
assetCleanup.start();
ClientServlet.assetCleanup = assetCleanup;
}
} else {
logger.info("No assets store, so no cleanup possible.");
}
}
use of edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment in project OA4MP by ncsa.
the class ClientLoader method createInstance.
/**
* Factory method. Override this to create the actual instance as needed.
*
* @param tokenForgeProvider
* @param clientProvider
* @param constants
* @return
*/
public T createInstance(Provider<TokenForge> tokenForgeProvider, Provider<Client> clientProvider, HashMap<String, String> constants) {
ClientEnvironment ce = null;
try {
ce = new ClientEnvironment(myLogger, constants, getAccessTokenURI(), getAuthorizeURI(), getCallback(), getInitiateURI(), getAssetURI(), checkCertLifetime(), getId(), checkPrivateKey(), checkPublicKey(), getSkin(), isEnableAssetCleanup(), getMaxAssetLifetime(), getKeypairLifetime(), getAssetProvider(), clientProvider, tokenForgeProvider, getDSP(), getAssetStoreProvider(), isShowRedirectPage(), getErrorPagePath(), getRedirectPagePath(), getSuccessPagePath());
} catch (IOException e) {
throw new MyConfigurationException("Error; Could not configure environment", e);
}
init();
return (T) ce;
}
use of edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment in project airavata by apache.
the class CredentialStoreStartServlet method loadEnvironment.
@Override
public void loadEnvironment() throws IOException {
environment = getConfigurationLoader().load();
oa4mpService = new OA4MPService((ClientEnvironment) environment);
}
Aggregations