Move OAuth configs to yaml

Leave allowedOauthClientIds empty instead of moving the placeholder client ids over.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=152967043
This commit is contained in:
jianglai 2017-04-12 11:49:15 -07:00 committed by Ben McIlwain
parent ab515cb352
commit f433242125
3 changed files with 30 additions and 9 deletions

View file

@ -925,7 +925,7 @@ public final class RegistryConfig {
} }
/** /**
* Provides the OAuth scopes to check for on access tokens. * Provides the OAuth scopes to check for access tokens.
* *
* <p>This list should be a superset of the required OAuth scope set provided below. * <p>This list should be a superset of the required OAuth scope set provided below.
* *
@ -933,14 +933,14 @@ public final class RegistryConfig {
* API, which requires at least one of: * API, which requires at least one of:
* *
* <ul> * <ul>
* <li>https://www.googleapis.com/auth/appengine.apis</li> * <li>https://www.googleapis.com/auth/appengine.apis
* <li>https://www.googleapis.com/auth/cloud-platform</li> * <li>https://www.googleapis.com/auth/cloud-platform
* </ul> * </ul>
*/ */
@Provides @Provides
@Config("availableOauthScopes") @Config("availableOauthScopes")
public static ImmutableSet<String> provideAvailableOauthScopes() { public static ImmutableSet<String> provideAvailableOauthScopes(RegistryConfigSettings config) {
return ImmutableSet.of("https://www.googleapis.com/auth/userinfo.email"); return ImmutableSet.copyOf(config.oAuth.availableOauthScopes);
} }
/** /**
@ -951,15 +951,15 @@ public final class RegistryConfig {
*/ */
@Provides @Provides
@Config("requiredOauthScopes") @Config("requiredOauthScopes")
public static ImmutableSet<String> provideRequiredOauthScopes() { public static ImmutableSet<String> provideRequiredOauthScopes(RegistryConfigSettings config) {
return ImmutableSet.of("https://www.googleapis.com/auth/userinfo.email"); return ImmutableSet.copyOf(config.oAuth.requiredOauthScopes);
} }
/** Provides the allowed OAuth client IDs (could be multibinding). */ /** Provides the allowed OAuth client IDs (could be multibinding). */
@Provides @Provides
@Config("allowedOauthClientIds") @Config("allowedOauthClientIds")
public static ImmutableSet<String> provideAllowedOauthClientIds() { public static ImmutableSet<String> provideAllowedOauthClientIds(RegistryConfigSettings config) {
return ImmutableSet.of("PUT.YOUR.PROXY.CLIENT.ID.HERE", "PUT.YOUR.REGTOOL.CLIENT.ID.HERE"); return ImmutableSet.copyOf(config.oAuth.allowedOauthClientIds);
} }
/** /**

View file

@ -22,6 +22,7 @@ public class RegistryConfigSettings {
public AppEngine appEngine; public AppEngine appEngine;
public GSuite gSuite; public GSuite gSuite;
public OAuth oAuth;
public RegistryPolicy registryPolicy; public RegistryPolicy registryPolicy;
public Datastore datastore; public Datastore datastore;
public Caching caching; public Caching caching;
@ -46,6 +47,13 @@ public class RegistryConfigSettings {
} }
} }
/** Configuration options for OAuth settings. */
public static class OAuth {
public List<String> availableOauthScopes;
public List<String> requiredOauthScopes;
public List<String> allowedOauthClientIds;
}
/** Configuration options for the G Suite account used by Nomulus. */ /** Configuration options for the G Suite account used by Nomulus. */
public static class GSuite { public static class GSuite {
public String domainName; public String domainName;

View file

@ -123,6 +123,19 @@ caching:
# premium price entries that exist. # premium price entries that exist.
staticPremiumListMaxCachedEntries: 200000 staticPremiumListMaxCachedEntries: 200000
oAuth:
# OAuth scopes to check for access tokens. Superset of requiredOauthScopes.
availableOauthScopes:
- https://www.googleapis.com/auth/userinfo.email
# OAuth scopes required for authenticating. Subset of availableOauthScopes.
requiredOauthScopes:
- https://www.googleapis.com/auth/userinfo.email
# OAuth client Ids that are allowed to authenticate and communicate with
# backend services, e. g. nomulus tool, EPP proxy, etc.
allowedOauthClientIds: []
rde: rde:
# URL prefix of ICANN's server to upload RDE reports to. Nomulus adds /TLD/ID # URL prefix of ICANN's server to upload RDE reports to. Nomulus adds /TLD/ID
# to the end of this to construct the full URL. # to the end of this to construct the full URL.