Commit graph

591 commits

Author SHA1 Message Date
mcilwain
7ed02f4612 Reload resources before saving in ReloadAllEppResourcesAction
This prevents a potential blind write scenario in which something else has concurrently modified the EppResource in between load and save, and those changes then get overwritten.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138911873
2016-11-15 10:59:47 -05:00
ctingue
fab8ca8414 Move injectable config values into ConfigModule
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138903917
2016-11-15 10:58:20 -05:00
ctingue
1b6f2f82cd Clean up BillingEvent.Reason.AUTO_RENEW and scraps
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138903021
2016-11-15 10:56:52 -05:00
cgoldfeder
d5104df453 Fix two ErrorProne warnings in TypeUtils
1) Prefer .getConstructor().newInstance() over .newInstance()
   because otherwise checked exceptions can be propagated from
   the constructor even though they aren't declared.
2) Use the type T in the parameters to instantiate().

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138874730
2016-11-15 10:50:39 -05:00
nickfelt
f742ac8056 Refactor RequestHandler to handle request component construction
This refactors RequestHandler so that it handles the construction of the request
component itself, rather than being handed a pre-built request component
instance constructed by the invoking servlet.

The motivation for this change is so that RequestHandler can be extended in
future CLs to compute authentication results, and can provide those results as
an available binding in the constructed request component.  An alternative
approach could have been to compute the authentication results within
RequestModule itself, but I think it's clearer to keep business logic like
that outside of Dagger providers.

This CL makes the following individual changes:

- Adds request component builders, which implement a RequestComponentBuilder
  interface so they can all be manipulated by RequestHandler

- Instead of obtaining request components via factory methods on the global
  components, one now can have global-scoped bindings just inject the request
  component builders (which requires adding a module to each global component
  declaring the subcomponent).  This follows the recommended approach here:
  http://google.github.io/dagger/subcomponents.html

- Instead of exposing request components on the global component interface,
  we now expose module-specific subclasses of RequestHandler that @Inject the
  appropriate request component builder's provider and pass it to the superclass
  (note that inheritance isn't strictly necessary here but saves boilerplate)

- RequestHandler now takes the Provider<RequestComponentBuilder> and builds
  the component itself using its own fresh RequestModule instance. This provides
  some nice encapsulation but is mainly needed for adding a RequestAuthModule
  in future work.

- RequestHandler also takes UserService now, which can be provided via Dagger
  by the subclass.  Longer-term that will go away in favor of instead providing
  AuthStrategy instances, some of which will use UserService internally.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138815648
2016-11-15 10:49:05 -05:00
mountford
0634e25822 Remove as-of date from argument list for extra create flow logic
Lai points out that, for creation, the as-of date should always be equal to the creation time. And, in fact, there was a check to throw an exception if that is not the case. So it's more straightforward just to remove that argument entirely.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138783711
2016-11-15 10:46:04 -05:00
mcilwain
07a6e55f82 Add missing @Nullable annotations to ForeignKeyIndex load methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138782186
2016-11-15 10:44:32 -05:00
mcilwain
780a5add78 Get rid of ReferenceUnions entirely
This is the third and final phase in the migration away from ReferenceUnions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138778148
2016-11-15 10:42:58 -05:00
mountford
8d97fa5858 Add TLD-specific logic for application creates
This CL applies the status flag logic, but doesn't yet do any name checking

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138769004
2016-11-15 10:39:51 -05:00
mcilwain
274b070b54 Make driveFolderId on Registry entity optional
This defaults to null, and leaving it to null now simply disables reserved terms
exporting, rather than throwing an error every time the action runs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138763161
2016-11-15 10:38:20 -05:00
nickfelt
9122372e38 Change Router to do reflective setAccessible() calls itself
This change moves the reflective setAccessible() calls on the request component
methods (needed so that they can be invoked reflectively from RequestHandler)
to within Router itself, eliminating the need to manually call this from each
Servlet class and then pass in the resulting Method objects.  Instead, we just
pass in the request component class and let Router do the rest.

Old comments say that cross-package reflection is not allowed on AppEngine, but
while it's quite possible this was once the case, I can't reproduce that
limitation, and the documentation seems to contradict any such restriction:

"""
An application is allowed full, unrestricted, reflective access to its own
classes.  It can query any private members, call the method
java.lang.reflect.AccessibleObject.setAccessible(), and read/set private
members.
"""
https://cloud.google.com/appengine/docs/java/runtime#reflection

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138693006
2016-11-10 12:30:44 -05:00
mountford
59c213c66f Add extra flow logic hook for application info
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138683307
2016-11-10 12:30:44 -05:00
mountford
09beacf746 Add extra flow logic hook for domain allocation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138679232
2016-11-10 12:30:44 -05:00
mcilwain
225f25bf42 Fix build error by adding testonly=1 to eclipse BUILD file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138652263
2016-11-10 12:30:20 -05:00
dxy
0263667dae Add Google Cloud Storage helper for non-GAE environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138563147
2016-11-10 12:30:00 -05:00
Francis Aiello
1671508547 Set svID in ConfigModule instead of hard-coding it
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138552819
2016-11-10 12:29:53 -05:00
cgoldfeder
1abd0e1123 Remove FieldExposers, since GAE reflection works normally
Calling setAccessible() cross-package used to fail in
the custom security manager. It never shouldn have failed,
and now it works correctly (not sure when it was fixed) so
remove these trampolines.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138549703
2016-11-10 11:32:07 -05:00
mcilwain
2cbfd6475d Fix @Provides method name in ConfigModule for consistency
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138512734
2016-11-10 11:30:36 -05:00
mcilwain
9aa2f3b96e Make host flows only accept canonicalized host names as input
This now throws errors when a non-lower-cased, non-puny-coded, or non-canonicalized host name is passed in as an input parameter.

The approach we'll take is to first notify registrars which hosts we'll be renaming, then
issue EPP host update commands to effect those renames as superuser, then push this code
live to production.

This fixes #38 on GitHub.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138441130
2016-11-10 11:29:03 -05:00
mmuller
cbe76e8615 Don't throw an exception on orphaned contacts
Return Optional.absent() instead of throwing NotFoundException when a user has
a contact record but the Registrar entity is missing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138423965
2016-11-10 11:27:32 -05:00
ctingue
7a77819977 Add retry logic to CreateLrpTokensCommand
A transient 404 on entity save interrupts a long-running run of this command.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138400654
2016-11-10 11:26:03 -05:00
mountford
baaaacd4f5 Add extra flow logic hooks for application delete and update
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138393251
2016-11-10 11:24:32 -05:00
mcilwain
cef07f6bc5 Use cursor to track updating of registrar sheet
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138221931
2016-11-10 11:21:29 -05:00
ctingue
3a75486c72 Clean up ConfigModule
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138219117
2016-11-10 11:19:58 -05:00
ctingue
b7a98451e6 Add retry logic for SheetSynchronizer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138211996
2016-11-10 11:18:25 -05:00
cgoldfeder
ec73b5ec1c Minor comment fix
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138119838
2016-11-10 11:16:55 -05:00
mountford
994747a8e5 Enable built-in session cleanup in production
[] enabled the built-in App Engine session cleanup servlet in alpha and sandbox, and it appears to be deleting expired sessions at the expected rate of 100 every 15 minutes. So enable it for production as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138071390
2016-11-10 11:13:52 -05:00
cgoldfeder
8256120b3a Simplify the fee extensions.
I added shared base classes to all of the Fee extension types that
make it possible to fully ignore the version in the flows. (You
ask for a FeeCreateCommandExtension, for example, and you get one
without having to worry about which). This is an improvement over
the old code that asked you to provide a list of possible fee
extensions and then ask for the first one in preference order.

As part of this I was able to make the Fee implementation a bit
simpler as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137992390
2016-11-10 11:09:23 -05:00
cgoldfeder
2dd703ef3a Refactor authInfo validation
1) Don't do ofy().load() inside a model class (in DomainAuthInfo)
2) Move the one use of verify into the one caller in ResourceFlowUtils
3) Hosts don't support authInfo, so remove useless code

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137984809
2016-11-10 11:07:54 -05:00
mcilwain
f95f27ed72 Switch over to non-ReferenceUnion fields on DomainBase
This is the second phase of a three phase migration to remove
ReferenceUnions. As of the end of this phase, ReferenceUnions are no longer read
from in any active code paths, but are still written to in case a rollback to
the previous version is necessary. The third and final phase will remove the
ReferenceUnions entirely.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137951076
2016-11-02 15:19:34 -04:00
jianglai
59d998954c Use correct <a> tag syntax in javadoc @see tag
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137946021
2016-11-02 15:19:34 -04:00
mcilwain
e7d3725f51 Revert change to Guava 20 until we get it working properly
*** Reason for rollback ***

This broke the Nomulus build.

*** Original change description ***

Update opensource Guava to version 20

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137945645
2016-11-02 15:19:34 -04:00
mcilwain
1627bd4975 Revert Guava 20 features until we get the build working properly
*** Original change description ***

Remove deprecated methods with Guava 20 release

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137945126
2016-11-02 15:19:34 -04:00
cgoldfeder
053538b1b5 Turn Flow into an interface and inject all its fields
This concludes your flow flattening experience. Please
fill out a flow flattening satisfaction survey before
exiting.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137903095
2016-11-02 15:19:34 -04:00
jianglai
82b0bff9b5 Remove deprecated methods with Guava 20 release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137849843
2016-11-02 15:19:34 -04:00
ctingue
73e88b2391 Automated g4 rollback of changelist 137841045.
*** Reason for rollback ***

Not necessary for the time being (will do a more comprehensive update at a later date).

*** Original change description ***

Update errorprone to 2.0.14

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137844619
2016-11-02 15:19:34 -04:00
ctingue
883f194e0f Update errorprone to 2.0.14
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137841045
2016-11-02 15:19:34 -04:00
ctingue
83cbf5a01f Fix warnings nits from RegistrarAction rename
([]

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137833414
2016-11-02 15:19:34 -04:00
ctingue
a244202267 Update opensource Guava to version 20
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137832517
2016-11-02 15:19:34 -04:00
mmuller
fa05c82b11 Fix registrar settings method name
Fix RegistrarSettingsAction method name in FrontendComponent (this got left
behind in the rename CL).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137732524
2016-11-02 15:19:34 -04:00
mountford
da3e855b19 Add temporary @OnLoad to set period in DomainApplication
We are adding the registration period to DomainApplication. For the moment, add an @OnLoad which, if the period is missing, populates it from the EPP XML. This can be removed once we have resaved all applications.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137723098
2016-11-02 15:19:34 -04:00
ctingue
b29d11f0de Fix CreateLrpTokensCommand to not split lines on double-quoted comma
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137722530
2016-11-02 15:19:34 -04:00
mmuller
3928ccf03f Rename and reorder RegistrarAction
Rename RegistrarAction to RegistrarSettingsAction and reorder class contents
according to local style.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137554457
2016-11-02 15:19:34 -04:00
cgoldfeder
b3a166b0c4 Remove an unnecessary constructor
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137539751
2016-11-02 15:19:34 -04:00
mountford
5f691d6329 Enable built-in session cleanup in alpha and sandbox
App Engine provides a servlet which deletes up to 100 expired _ah_SESSION entities from DataStore. This CL adds a cron job to call the servlet every 15 minutes in both alpha and sandbox. Assuming all goes well, we will turn it on in production.

I originally learned about this servlet here:

http://www.radomirml.com/blog/2011/03/26/cleaning-up-expired-sessions-from-app-engine-datastore/

But it appears that we do not need a servlet definition, just a cron entry.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137533532
2016-11-02 15:19:34 -04:00
mountford
78a36925f4 Remove commitAdditionalLogicChanges(), part 1
Now that the flows are flattened, the commitAdditionalLogicChanges() call, which used to come later in the flow to actually save the Datastore objects, is now happening right after the performAdditionalXXXLogic() call. So we can instead just do the saves in performAdditionalXXXLogic(), and get rid of the separate call. As a first step, this CL simply makes commitAdditionalLogicChanges() a private method that gets called internally by the extra logic manager. Later, we can move the saves into their proper position, affecting only the extra logic class itself.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137529991
2016-11-02 15:19:34 -04:00
mmuller
bbd20ec71d Convert RegistrarServlet to RegistrarAction
Convert to an action and remove ResourceServlet, JsonTransportServlet and
JsonTransportServlet, all of which exist only to support it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137519385
2016-11-02 15:19:34 -04:00
mmuller
2e4273c4f4 Genericize Google Drive Links
Replace the two drive links on the "contact us" page with values that can be
driven from the config.  The drive links are the link to the technical
documentation folder and the link to the registrar's transaction activity
reports.  The former is a straightforward static replacement, but the latter
is derived from a per-registrar Google Drive id which must be formatted using
a template from the config module.

Note: This currently requires adding the transaction activity URL template to
the old-style RegistryConfig class instead of the daggerized ConfigModule
because this is the easiest way to pass it though to the non-daggerized
RegistrarServlet.  In an upcoming CL, I'll convert RegistrarServlet to
RegistrarAction and then I'll be able to make this template injectable.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137518466
2016-11-02 15:19:34 -04:00
ctingue
c89a902b72 Add metadata parameters to CreateLrpTokensCommand
As part of this change, built out a KeyValueMapParameter from the existing TransitionListParameter in order to enable other Map types in commands (two of which are used in CreateLrpTokensCommand).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137476564
2016-11-02 15:19:34 -04:00
cgoldfeder
1dbc5f6bb0 Replace command.applyTo() with inlined builder operations
These are much easier to understand.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137446273
2016-11-02 15:19:34 -04:00