Search in sources :

Example 1 with ClientEnvironment

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;
}
Also used : HashMap(java.util.HashMap) ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment)

Example 2 with ClientEnvironment

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);
}
Also used : ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment) OA4MPService(edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService)

Example 3 with ClientEnvironment

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.");
    }
}
Also used : MyLoggingFacade(edu.uiuc.ncsa.security.core.util.MyLoggingFacade) SQLStore(edu.uiuc.ncsa.security.storage.sql.SQLStore) Identifier(edu.uiuc.ncsa.security.core.Identifier) SQLException(java.sql.SQLException) Asset(edu.uiuc.ncsa.myproxy.oa4mp.client.Asset) ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment) ValidTimestampPolicy(edu.uiuc.ncsa.security.core.cache.ValidTimestampPolicy)

Example 4 with ClientEnvironment

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;
}
Also used : MyConfigurationException(edu.uiuc.ncsa.security.core.exceptions.MyConfigurationException) IOException(java.io.IOException) ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment)

Example 5 with ClientEnvironment

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);
}
Also used : ClientEnvironment(edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment) OA4MPService(edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService)

Aggregations

ClientEnvironment (edu.uiuc.ncsa.myproxy.oa4mp.client.ClientEnvironment)5 OA4MPService (edu.uiuc.ncsa.myproxy.oa4mp.client.OA4MPService)2 Asset (edu.uiuc.ncsa.myproxy.oa4mp.client.Asset)1 Identifier (edu.uiuc.ncsa.security.core.Identifier)1 ValidTimestampPolicy (edu.uiuc.ncsa.security.core.cache.ValidTimestampPolicy)1 MyConfigurationException (edu.uiuc.ncsa.security.core.exceptions.MyConfigurationException)1 MyLoggingFacade (edu.uiuc.ncsa.security.core.util.MyLoggingFacade)1 SQLStore (edu.uiuc.ncsa.security.storage.sql.SQLStore)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1