Commit Graph

379 Commits

Author SHA1 Message Date
Colin McDonald
3e78262cd5 Add disposable login tokens feature. Documentation is available at https://github.com/FrozenOrb/APIv3/wiki/Disposable-Login-Token-Routes 2016-07-13 19:38:55 -04:00
Colin McDonald
ea70e1b347 Remove ip null checks directly before a call to IpUtils#isValidIp, as IpUtils#isValidIp will perform a null check automatically 2016-07-13 19:37:51 -04:00
Colin McDonald
f04ee19b6c Remove note regarding audit log / punishment / grant / ip ban lookups 2016-07-13 19:36:40 -04:00
Colin McDonald
131e255116 Change public reason used on imported punishments 2016-07-13 19:36:01 -04:00
Colin McDonald
24a73f72cf Add the ability to rollback created punishments via the audit log 2016-07-13 19:35:35 -04:00
Colin McDonald
2502f4a1b2 Add user session integration. We still need to add routes that require auth in our session handler 2016-07-12 21:56:28 -04:00
Colin McDonald
f42f714863 Add logging with log4j. Completes #40 2016-07-11 23:54:21 -04:00
Colin McDonald
38dec65bf9 Add ip ban dumps. Adds #39 2016-07-11 23:05:00 -04:00
Colin McDonald
8e85914d64 Change default values in GETDumpsType.java to be immutable versions 2016-07-11 22:56:30 -04:00
Colin McDonald
e65686f339 Make queries made as part of punishment, ip ban, grant, and audit log lookups use UuidUtils.parseUuid to accept uuids without dashes 2016-07-11 22:54:28 -04:00
Colin McDonald
254d5336bf Don't require removedBy field when deleting grants, ip bans, and punishments 2016-07-11 22:53:31 -04:00
Colin McDonald
e48a0c1736 Add audit log todo 2016-07-11 21:50:37 -04:00
Colin McDonald
1f3d01b4e2 Remove debug from MaxMind util 2016-07-11 18:39:20 -04:00
Colin McDonald
d2dcd8c3e1 Add default permissions 2016-07-11 18:39:07 -04:00
Colin McDonald
b9c9a3f9bc Change default log level back to error 2016-07-11 18:38:48 -04:00
Colin McDonald
536de6d8b2 Make all save and delete methods on models use void callbacks (instead of exposing Mongo's internal result) 2016-07-10 16:15:29 -04:00
Colin McDonald
ecaf008f66 Properly register POST /users/:userId/confirmPhone 2016-07-10 15:49:29 -04:00
Colin McDonald
5e44d53216 Fix naming of some path parameters 2016-07-10 15:48:51 -04:00
Colin McDonald
45a706e0d7 Encode and then decode GET /metrics response to fix serialization issue with Vertx's JsonObject 2016-07-10 15:43:29 -04:00
Colin McDonald
529bf25daf Replace 3 line BlockingCallback pattern with 1 line SyncUtils#runBlocking lambda pattern 2016-07-10 15:42:42 -04:00
Colin McDonald
6319f944bb Optimize imports 2016-07-10 14:20:29 -04:00
Colin McDonald
07e1090445 Modify User#findByPhone to search for usages in both confirmed numbers and pending numbers 2016-07-10 14:20:16 -04:00
Colin McDonald
f84f8635a2 Finish Zang telephone linking (hopefully!). Completes #27 2016-07-10 14:17:18 -04:00
Colin McDonald
0071291236 Move body handler up in the route order to fix stack traces we were having 2016-07-10 13:12:31 -04:00
Colin McDonald
752c2cae96 Add debug to MaxMind circuit breaker 2016-07-10 13:12:01 -04:00
Colin McDonald
6e4169c6ad Add formatted timestamps to API logs 2016-07-10 13:11:45 -04:00
Colin McDonald
e4a574852a Add support for reading the http keystore path + keystore password from our config file 2016-07-10 12:50:04 -04:00
Colin McDonald
5aa0827d18 Change default log level to warn 2016-07-10 12:45:41 -04:00
Colin McDonald
b6f987e75a Readd metrics integration with Librato (and small redis metrics) 2016-07-10 12:45:13 -04:00
Colin McDonald
a61ad36151 Add commented line with code to return relative time in responses 2016-07-10 12:18:33 -04:00
Colin McDonald
53aa9ce368 Remove debug code from main class, use vertx's timeout handler instead of our debugging version 2016-07-10 12:18:07 -04:00
Colin McDonald
f0d8256f07 Add MaxMind circuit breaker. Finishes #38 2016-07-10 12:17:03 -04:00
Colin McDonald
53a56401e0 Change POST /grants|ipBans|punishments to use expiresIn (a relative field in seconds) instead of expiresAt (absolute time) 2016-07-10 11:48:53 -04:00
Colin McDonald
6fbc8925eb Optimize imports 2016-07-09 17:25:54 -04:00
Colin McDonald
f431cd40d6 Remove unused @Slf4j annotations 2016-07-09 17:25:18 -04:00
Colin McDonald
9043abfa72 Add short circuit to MaxMindUtils until we can fix (with timeout + circuit breaker) 2016-07-09 17:23:34 -04:00
Colin McDonald
a6e31129e9 Commit two forgotten files from taking out metrics 2016-07-09 17:23:02 -04:00
Colin McDonald
a30823099d Remove unneeded @Slf4j annotation in User and MojangUtils 2016-07-09 17:22:39 -04:00
Colin McDonald
d519527986 Commit ?active=true flag for GET /punishments 2016-07-09 17:21:43 -04:00
Colin McDonald
97b296a79d Add store order + item id for Ariel 2016-07-09 17:21:24 -04:00
Colin McDonald
f999319666 Remove metrics, change GET /ipLog/:id to accept both ips and user uuids 2016-07-09 17:20:57 -04:00
Colin McDonald
d55325d255 Add SyncUtils#vertxWrap. This is something we wrap all mongo callbacks with so all business logic is ran on vertx worker threads. This is important for 2 reasons:
1. Running all of our logic on the vertx threads makes sense, as we're a vertx application. (This also allows us to utilize vertx's thread pool logic + config, instead of relying on mongo's thread pool)
2. The more important one, it allows exceptions to be processed (instead of swallowed by mongo) with relevant context information.

There is an overhead to the thread switching we'll be doing because of this, but doing all of our work on a better thought out thread pool and (more importantly) having stack traces completely make this change worth the overhead.
2016-07-09 17:19:20 -04:00
Colin McDonald
5de25c498b Fix NPE when checking an access token's locked ips 2016-07-09 17:14:04 -04:00
Colin McDonald
a99d10c002 Add basic metrics + GET /metrics route 2016-07-03 19:59:42 -04:00
Colin McDonald
7bb1b17575 Small changes discovered while writing documentation 2016-07-03 19:41:01 -04:00
Colin McDonald
85b98b4a1d Add debug timeout handler, change default log level (for now) 2016-07-03 16:32:56 -04:00
Colin McDonald
fa5aee848a Commit two totp changes from before 2016-07-03 16:32:02 -04:00
Colin McDonald
d3bdeb6d50 Public/private reasons on punishments 2016-07-03 16:31:43 -04:00
Colin McDonald
252a18d326 Add translationId and translationParams to non-standard error types 2016-07-03 16:31:17 -04:00
Colin McDonald
035e9fbb81 Add UuidUtils#parseUuid, which is more liberal on what it accepts, and convert most everything to use it 2016-07-03 16:30:24 -04:00
Colin McDonald
527f465c12 Fail properly if MaxMind fails to respond / returns invalid data 2016-07-03 16:28:31 -04:00
Colin McDonald
77c3e49048 Fix logins not saving users, ip intel in heartbeats 2016-07-02 17:39:30 -04:00
Colin McDonald
adb16d8c8d Add Mojang api debug 2016-07-02 17:38:56 -04:00
Colin McDonald
de9a490aa1 Change ErrorUtils#respondInternalError to print the error + request info with slf4j 2016-06-30 23:01:13 -04:00
Colin McDonald
043bc76cd3 Update dump cache immediately upon startup 2016-06-30 17:30:20 -04:00
Colin McDonald
c1017f9241 Fix a few mistakes we made when passing callback results back up 2016-06-30 17:29:28 -04:00
Colin McDonald
968ceb1a1d Modify APIv3#respondJson to not have default status code 2016-06-29 21:23:37 -04:00
Colin McDonald
bcd95d9e9b Code updates to fit "expected" documentation 2016-06-29 00:24:41 -04:00
Colin McDonald
f4dcf7c3be Optimize imports 2016-06-27 23:01:37 -04:00
Colin McDonald
c8c1ac153d Even more Zang telephone work! 2016-06-27 23:01:12 -04:00
Colin McDonald
822dd27536 Remove maxmind debug 2016-06-27 22:14:51 -04:00
Colin McDonald
f1c9b3666e Update POST /ranks for new Rank constructor 2016-06-27 21:57:24 -04:00
Colin McDonald
c742b6d01f Require totp authorization on some actions 2016-06-27 21:55:35 -04:00
Colin McDonald
ac0865fde7 Create audit log entries for login fails/successes 2016-06-27 21:16:34 -04:00
Colin McDonald
e0af72caf5 Add access token CRUD routes 2016-06-27 21:07:52 -04:00
Colin McDonald
29a13c1647 Convert authorization to use access tokens. Completes #24 2016-06-27 16:55:21 -04:00
Colin McDonald
bcae144e8c Optimize imports 2016-06-26 23:34:04 -04:00
Colin McDonald
74f23bcb62 Remove user field (not used) and bestRank field (will be assumed by the client) from login info 2016-06-26 23:27:36 -04:00
Colin McDonald
9110acd14a More work on Zang integration 2016-06-26 22:51:11 -04:00
Colin McDonald
ff4ac3ab9d Comment out bad server timeout code 2016-06-26 22:50:15 -04:00
Colin McDonald
1532bee954 More work on Zang phone registration 2016-06-26 22:24:06 -04:00
Colin McDonald
9f4089a752 Prevent duplicate email addresses 2016-06-26 21:48:26 -04:00
Colin McDonald
8740d32621 Fix infinite while loop issue 2016-06-26 21:31:59 -04:00
Colin McDonald
75aac64e91 Change MaxMind log from a warn to an info 2016-06-26 19:33:37 -04:00
Colin McDonald
10e9ac5bea Don't send 'totpSetup' in login info, it isn't used. 2016-06-26 19:27:37 -04:00
Colin McDonald
4101538202 Readd simple exception handler 2016-06-26 19:26:01 -04:00
Colin McDonald
95d8a45d86 Don't send access unless needed 2016-06-26 19:25:42 -04:00
Colin McDonald
8d66bd1568 Fix issue w/ live cache updates 2016-06-26 19:19:34 -04:00
Colin McDonald
983c428a09 Redo rank calculation to allow ranks that aren't part of the primary inheritance chain. Finishes #33 2016-06-26 19:09:11 -04:00
Colin McDonald
1b20362f4d Finish audit log redux - completes #5 2016-06-26 17:14:47 -04:00
Colin McDonald
d8b66742de Populate cached models immediately upon startup 2016-06-26 15:09:03 -04:00
Colin McDonald
a4d00ca5b0 Hide thread info in slf4j-simple 2016-06-26 15:08:31 -04:00
Colin McDonald
3a838b8b56 Add MaxMind debug info 2016-06-26 15:01:00 -04:00
Colin McDonald
4313f6f14f Optimize imports 2016-06-25 21:30:54 -04:00
Colin McDonald
2a5118ee3f Work on audit log redux 2016-06-25 21:30:39 -04:00
Colin McDonald
f8bf433953 Add email domain blacklisting 2016-06-25 20:40:45 -04:00
Colin McDonald
daa48688eb Optimize imports 2016-06-25 19:21:59 -04:00
Colin McDonald
6957b67863 Add banned cell carrier model to prepare for full Zang integration 2016-06-25 19:21:23 -04:00
Colin McDonald
49a441fe03 Change server heartbeat's players section from an array to a dict 2016-06-25 19:09:51 -04:00
Colin McDonald
a39a1801e4 Slightly optimize number of db queries used in POST /users/:id/leave 2016-06-25 19:02:07 -04:00
Colin McDonald
439f92f596 Remove unused event types 2016-06-25 19:01:46 -04:00
Colin McDonald
8d1fb524ec Add heartbeat timeout 2016-06-25 18:55:48 -04:00
Colin McDonald
fde7d50edc Make some changes to make IntelliJ's code inspection happier 2016-06-25 18:41:44 -04:00
Colin McDonald
a648fb7f30 Refactor permissions in prep for ranks not on the inheritance tree 2016-06-25 18:20:32 -04:00
Colin McDonald
3381d74a8b Readd very basic metrics 2016-06-25 18:02:07 -04:00
Colin McDonald
70d26256bd Disable debug (for now) 2016-06-25 16:25:59 -04:00
Colin McDonald
f4abba2309 Optimize imports 2016-06-25 16:24:04 -04:00
Colin McDonald
605b70bf01 Finish the server heartbeat 2016-06-25 16:23:44 -04:00
Colin McDonald
a255d45603 Auto-update the cache (for cached models) when inserting/deleting 2016-06-24 23:54:34 -04:00
Colin McDonald
ef3f7345e5 More work on the heartbeat 2016-06-24 23:50:51 -04:00
Colin McDonald
1d21d70371 Optimize imports 2016-06-24 23:16:42 -04:00
Colin McDonald
e2da72db1b Fully implement banned asns. Closes #25 2016-06-24 23:16:24 -04:00
Colin McDonald
00b3ac19f3 Rename PUT routes to align with their definitions in APIv3.java 2016-06-24 23:13:36 -04:00
Colin McDonald
04369a1f97 Add basic Zang functionality 2016-06-24 22:54:49 -04:00
Colin McDonald
a68a44f781 Remove Jackson experiment from APIv3.java 2016-06-24 22:54:30 -04:00
Colin McDonald
2ca872706c Clean up http request code in MandrillUtils and MaxMindUtils 2016-06-24 22:53:57 -04:00
Colin McDonald
0a036f5ec5 Move mandrill sending from inside notifications to its own utility 2016-06-24 22:36:15 -04:00
Colin McDonald
8972605a02 Fix possible concurrency issue with POST /users/:id/leave 2016-06-24 22:18:45 -04:00
Colin McDonald
a87578a8a6 Fix compilation issue created by adding new user fields 2016-06-24 22:05:37 -04:00
Colin McDonald
26e274596b Finish #18, make POST /users/:id/verifyTotp async, cleanup totp code 2016-06-24 22:03:52 -04:00
Colin McDonald
0653edaae3 Rename route classes to match their actual paths 2016-06-24 19:38:00 -04:00
Colin McDonald
fd1ec2b475 Add password reset route. Closes #29 2016-06-24 19:23:31 -04:00
Colin McDonald
4901e63599 Change Jackson constructors from public to private 2016-06-24 19:00:40 -04:00
Colin McDonald
1c07b20f89 Fix compilation issue produced by the previous commit 2016-06-24 18:56:37 -04:00
Colin McDonald
aaba9cb369 Modify POST /user/:id/setupTotp to work with adjusted requirements 2016-06-24 18:55:47 -04:00
Colin McDonald
4a727f3d04 Large commit to convert all models to be full async 2016-06-24 03:00:37 -04:00
Colin McDonald
e9da784953 Remove MojangUtils debug, it appears to be fine now 2016-06-24 02:59:08 -04:00
Colin McDonald
6eeb153413 Add more MaxMind results 2016-06-24 02:58:44 -04:00
Colin McDonald
3de5e8d756 Make authorized field in UserActor final 2016-06-24 02:57:54 -04:00
Colin McDonald
ddd0e0159a Integrate user logins with MaxMind, and deny access to users on VPNs 2016-06-23 13:31:44 -04:00
Colin McDonald
4e00381e50 Always use HTTPS when communicating with the Mojang api 2016-06-23 13:30:33 -04:00
Colin McDonald
2e439a5b18 Add defaults to MaxMind result parsing 2016-06-23 13:29:27 -04:00
Colin McDonald
61197b1050 Remove bugsnag, with all async code it serves little to no purpose 2016-06-23 01:01:54 -04:00
Colin McDonald
66b2fc5951 Make GET /dumps' background thread use the Vert.x scheduler instead of being a standalone thread 2016-06-23 00:59:18 -04:00
Colin McDonald
43b59dcf2c Move HttpClient/RedisClient from APIv3.java to their relevant util classes 2016-06-23 00:58:42 -04:00
Colin McDonald
23b9d81923 Make BugsnagSlf4jLogger final 2016-06-23 00:57:33 -04:00
Colin McDonald
8c67a1bc54 Optimize imports 2016-06-23 00:56:57 -04:00
Colin McDonald
5310a0c6c4 Remove notes about using an array for scopes in POST /grants, it's already been done 2016-06-23 00:56:43 -04:00
Colin McDonald
b291e9e13b Convert more routes to use body fields instead of query params 2016-06-23 00:56:04 -04:00
Colin McDonald
c00b424fe8 Allow specifying the user to search for in GET /auditLog, /punishments, /grants, and /ipBans 2016-06-23 00:54:40 -04:00
Colin McDonald
2eeabf7ef8 Remove note regarding async inserts - Vert.x's CompositeFuture's methods don't allow clean integration, and it isn't worth the development time to adapt it. 2016-06-23 00:52:42 -04:00
Colin McDonald
86a7504af6 Optimize imports 2016-06-22 19:47:08 -04:00
Colin McDonald
9f2e4a63f0 Convert MaxMindResult's subdivisions to a list 2016-06-22 19:45:49 -04:00
Colin McDonald
5c3274d483 Swap Mongo's Document for Vert.x's JsonObject 2016-06-22 19:44:39 -04:00
Colin McDonald
2bdd54836d Convert a few routes to use body parameters instead of query params 2016-06-22 18:13:09 -04:00
Colin McDonald
152492eb06 Remove debug 2016-06-22 17:36:20 -04:00
Colin McDonald
d47b0a6170 Part 2 of the big "make this closer to a RESTful api" commit [Doesn't compile] 2016-06-22 17:14:51 -04:00
Colin McDonald
8ade7066f9 Part 1 of the big "make this closer to a RESTful api" commit 2016-06-21 17:08:17 -04:00
Colin McDonald
217683407e Add bugsnag TODO in ErrorUtils#respondInternalError 2016-06-21 17:07:23 -04:00
Colin McDonald
7b594d695b Convert MaxMindTraits' user_type to an enum 2016-06-21 17:06:34 -04:00
Colin McDonald
d261ef507a Add note to V2Importer regarding possible future optimization 2016-06-21 17:02:20 -04:00
Colin McDonald
a0188e2d8c Move permissions check from UserActor to ActorAttributeHandler to make the async conversion easier 2016-06-21 17:01:59 -04:00
Colin McDonald
825e1c586e Only create ip bans for bans and blacklists, not all punishments. Closes #22 2016-06-21 10:50:59 -04:00
Colin McDonald
4ba3dcd907 Redo email / user registration to make a lot more sense. Closes #14 and closes #15 2016-06-21 01:39:14 -04:00
Colin McDonald
63384231c2 Partially complete POST /user/:id/changePassword. Still requires TOTP integration 2016-06-21 01:31:48 -04:00
Colin McDonald
0d656ab96d Properly register GET /user/:id/requiresTOTP as an async handler 2016-06-21 01:20:43 -04:00
Colin McDonald
d466abe113 Fix our response to internal errors in GET /user/:id/requiresTOTP 2016-06-21 01:20:01 -04:00
Colin McDonald
1eb09b9714 Remove bad password list (for now) -- we'll eventually come back and implement this in a better way 2016-06-21 01:18:38 -04:00
Colin McDonald
a5acd2c9ff Move GET /user/:id/requiresTOTP logic into User to make future expansion easier 2016-06-21 01:18:06 -04:00
Colin McDonald
39f0b7d665 Create GET /emailToken/:emailToken/owner to retrieve an email token's owner, rename POST /user/confirmRegister/:emailToken: to POST /emailToken/:emailToken/confirm. Closes #16 2016-06-21 01:00:03 -04:00