public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.put("oauth.endpoint", "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(JWS_ALG, "RS256"); properties.put(AUDIENCE, "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); properties.put(PROPERTY_SESSION_INTERVAL, 3600); properties.put(TEMPLATE, "osFamily=UBUNTU,os64Bit=true,osVersionMatches=16.*"); properties.put(POLL_INITIAL_PERIOD, 5000); properties.put(POLL_MAX_PERIOD, 20000); // Node operations in DigitalOcean can be quite slow. Use a 5 minutes // timeout by default properties.put(TIMEOUT_NODE_RUNNING, 300000); properties.put(TIMEOUT_NODE_SUSPENDED, 300000); properties.put(TIMEOUT_NODE_TERMINATED, 300000); return properties; }
public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.put("oauth.endpoint", "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(JWS_ALG, "RS256"); properties.put(AUDIENCE, "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); properties.put(PROPERTY_SESSION_INTERVAL, 3600); properties.put(TEMPLATE, "osFamily=UBUNTU,os64Bit=true,osVersionMatches=14.*"); properties.put(POLL_INITIAL_PERIOD, 5000); properties.put(POLL_MAX_PERIOD, 20000); // Node operations in DigitalOcean can be quite slow. Use a 5 minutes // timeout by default properties.put(TIMEOUT_NODE_RUNNING, 300000); properties.put(TIMEOUT_NODE_SUSPENDED, 300000); properties.put(TIMEOUT_NODE_TERMINATED, 300000); return properties; }
public static Properties defaultProperties() { Properties properties = BaseHttpApiMetadata.defaultProperties(); properties.put("oauth.endpoint", "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(JWS_ALG, "RS256"); properties.put(AUDIENCE, "https://cloud.digitalocean.com/v1/oauth/token"); properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); properties.put(PROPERTY_SESSION_INTERVAL, 3600); properties.put(TEMPLATE, "osFamily=UBUNTU,os64Bit=true,osVersionMatches=16.*"); properties.put(POLL_INITIAL_PERIOD, 5000); properties.put(POLL_MAX_PERIOD, 20000); // Node operations in DigitalOcean can be quite slow. Use a 5 minutes // timeout by default properties.put(TIMEOUT_NODE_RUNNING, 300000); properties.put(TIMEOUT_NODE_SUSPENDED, 300000); properties.put(TIMEOUT_NODE_TERMINATED, 300000); return properties; }
properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString()); properties.put(DEFAULT_VNET_ADDRESS_SPACE_PREFIX, "10.0.0.0/16"); properties.put(DEFAULT_SUBNET_ADDRESS_PREFIX, "10.0.0.0/24");
protected Properties setupProperties() { Properties properties = new Properties(); properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); properties.put("oauth.endpoint", "https://login.microsoftonline.com/tenant-id/oauth2/token"); return properties; }
properties.put(PROPERTY_SESSION_INTERVAL, 300); properties.put(RESOURCE, "https://management.azure.com/"); properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString());
public static Properties bearerTokenAuthProperties(Properties properties) { properties = properties == null ? new Properties() : properties; properties.put("oauth.identity", "761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5@developer.gserviceaccount.com"); properties.put("oauth.credential", "1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M"); properties.put("oauth.endpoint", "http://localhost:5000/o/oauth2/token"); properties.put(AUDIENCE, "https://accounts.google.com/o/oauth2/token"); properties.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); return properties; }
public static Properties defaultProperties(Properties properties) { properties = properties == null ? new Properties() : properties; properties.put(CREDENTIAL_TYPE, CLIENT_CREDENTIALS_SECRET.toString()); properties.put(PROPERTY_REGIONS, "westeurope"); properties.put(IMAGE_PUBLISHERS, "Canonical"); String defaultTimeout = String.valueOf(TimeUnit.MILLISECONDS.convert(60, TimeUnit.MINUTES)); properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, defaultTimeout); properties.setProperty(TIMEOUT_NODE_RUNNING, defaultTimeout); properties.setProperty(TIMEOUT_PORT_OPEN, defaultTimeout); properties.setProperty(TIMEOUT_NODE_TERMINATED, defaultTimeout); properties.setProperty(TIMEOUT_NODE_SUSPENDED, defaultTimeout); return properties; } }
protected ContextBuilder builder() { Properties overrides = new Properties(); overrides.put(PROJECT_NAME, "party"); overrides.put(IMAGE_PROJECTS, "debian-cloud"); overrides.put(TIMEOUT_NODE_TERMINATED, "0"); // Avoid retry & polling in mock tests overrides.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); return ContextBuilder.newBuilder(new GoogleComputeEngineProviderMetadata()) .credentials(identity, credential) .endpoint(url("")) .overrides(overrides) .modules(modules); }
private AuthorizationApi api(URL url, CredentialType credentialType) throws IOException { Properties overrides = new Properties(); overrides.setProperty("oauth.endpoint", url.toString()); overrides.setProperty(JWS_ALG, "RS256"); overrides.setProperty(CREDENTIAL_TYPE, credentialType.toString()); overrides.setProperty(AUDIENCE, "https://accounts.google.com/o/oauth2/token"); overrides.setProperty(RESOURCE, "https://management.azure.com/"); overrides.setProperty(PROPERTY_MAX_RETRIES, "1"); overrides.setProperty(CERTIFICATE, toStringAndClose(OAuthTestUtils.class.getResourceAsStream("/testcert.pem"))); return ContextBuilder.newBuilder(AnonymousHttpApiMetadata.forApi(AuthorizationApi.class)) .credentials("foo", toStringAndClose(OAuthTestUtils.class.getResourceAsStream("/testpk.pem"))) .endpoint(url.toString()) .overrides(overrides) .modules(ImmutableSet.of(new ExecutorServiceModule(newDirectExecutorService()), new OAuthModule(), new Module() { @Override public void configure(Binder binder) { binder.bind(OAuthScopes.class).toInstance(SingleScope.create(SCOPE)); } })) .buildApi(AuthorizationApi.class); } }
protected ContextBuilder builder() { Properties overrides = new Properties(); overrides.put(PROJECT_NAME, "party"); overrides.put(CREDENTIAL_TYPE, BEARER_TOKEN_CREDENTIALS.toString()); return ContextBuilder.newBuilder(new GoogleCloudStorageProviderMetadata()) .credentials(identity, credential) .endpoint(url("")) .overrides(overrides) .modules(modules); }
@Override protected Properties setupProperties() { Properties props = super.setupProperties(); props.setProperty(JWS_ALG, jwsAlg); // scope is required for P12_PRIVATE_KEY_CREDENTIALS, optional for CLIENT_CREDENTIALS_SECRET. // Moved the not-NULL check to P12_PRIVATE_KEY_CREDENTIALS specific parameters. scope = setIfTestSystemPropertyPresent(props, "jclouds.oauth.scope"); // Determine which type of Credential to use, default to P12_PRIVATE_KEY_CREDENTIALS credentialType = setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE); if (credentialType == null) { credentialType = CredentialType.P12_PRIVATE_KEY_CREDENTIALS.toString(); props.setProperty(CREDENTIAL_TYPE, credentialType); } // Set the credential specific properties. if (CredentialType.fromValue(credentialType) == CredentialType.CLIENT_CREDENTIALS_SECRET) { resource = checkNotNull(setIfTestSystemPropertyPresent(props, RESOURCE), "test." + RESOURCE); } else if (CredentialType.fromValue(credentialType) == CredentialType.CLIENT_CREDENTIALS_P12_AND_CERTIFICATE) { audience = checkNotNull(setIfTestSystemPropertyPresent(props, AUDIENCE), "test.jclouds.oauth.audience"); resource = checkNotNull(setIfTestSystemPropertyPresent(props, RESOURCE), "test." + RESOURCE); certificate = setCredential(props, CERTIFICATE); credential = setCredential(props, "oauth.credential"); } else if (CredentialType.fromValue(credentialType) == CredentialType.P12_PRIVATE_KEY_CREDENTIALS) { audience = checkNotNull(setIfTestSystemPropertyPresent(props, AUDIENCE), "test.jclouds.oauth.audience"); credential = setCredential(props, "oauth.credential"); checkNotNull(scope, "test.jclouds.oauth.scope"); } return props; }