Commit Graph

112 Commits

Author SHA1 Message Date
hrj
660447798f Debug Captcha: Print mismatches
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-14 10:08:33 +05:30
hrj
d3a2c6fa35 Minor: use Map.of()
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-14 10:08:33 +05:30
hrj
96b5808628 correctly parse parameter values from config
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
b765399f68 debug captcha: use safe alphabets only
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
41bdbc7fbf debug captcha: use a larger font
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
954399042c debug catpcha: only use alphabets
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
332bb2113b minor, typos in comment
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
d9fefca841 minor, spacing
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
dd1129b484 added a debug captcha
Signed-off-by: hrj <harshad.rj@gmail.com>
2021-04-13 14:54:16 +05:30
hrj
f8de5a5932 minor: added comment about per thread connections 2021-04-12 17:01:24 +05:30
hrj
e8416ff70e internal change: make maxAttempts easier to specify 2021-04-12 16:37:09 +05:30
hrj
8840a13a8f minor: moved blob variable to inner scope 2021-04-12 09:25:33 +05:30
hrj
43e1a379ac use an unbounded thread pool
mimics the performance with JLHttpServer
2021-04-12 07:22:53 +05:30
hrj
fb400a6aea remove debug print 2021-04-12 07:10:00 +05:30
hrj
6fd34c16ac optimise string operations 2021-04-12 07:06:44 +05:30
hrj
89eeb76c46 Use a fork join pool executor with parallelism = 4 2021-04-12 07:00:53 +05:30
Rahul Rudragoudar
4612dfa1cd
Migrate to HttpServer (#76)
* Migrate to Fibry

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Improve error handling

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update models and fields

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Enable fibry server

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update .gitignore

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Convert captcha class to object

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Rollback error handling

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update models

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Migrate to sun http server

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Refactor: Linter and formatter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Remove redundant dependancy

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-04-11 17:57:15 +05:30
hrj
ac0fa4e5ff fix deprecation warnings 2021-04-01 17:02:33 +05:30
Rahul Rudragoudar
fe8bf54196
Config fallback support
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-29 15:29:21 +05:30
Rahul Rudragoudar
30f152f7ec
Minor update
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-29 15:28:28 +05:30
Rahul Rudragoudar
3ea15af41a
Add attributes enum
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-29 15:26:59 +05:30
Rahul Rudragoudar
033db81721
Add captcha fields enum
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-11 21:26:58 +05:30
Rahul Rudragoudar
21b299a30f
Add captchaConfig case class
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-11 21:26:30 +05:30
Rahul Rudragoudar
2b617ef75d
Add additional filtering on captchas
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-11 21:25:33 +05:30
Rahul Rudragoudar
e931e43bb9
Extract to case class
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-11 21:24:22 +05:30
Rahul Rudragoudar
2c0f3deb8a
Add supportedParams method
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-11 21:23:24 +05:30
Rahul Rudragoudar
070b862f25
Remove access methods
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-05 14:51:17 +05:30
Rahul Rudragoudar
6c4a3d0152
Add config time support to captcha expiry
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:52:30 +05:30
Rahul Rudragoudar
0906d6b906
Minor updates
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:34:38 +05:30
Rahul Rudragoudar
5cafd037d1
Improve error handling
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:34:16 +05:30
Rahul Rudragoudar
ed39535039
Update statements
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:33:46 +05:30
Rahul Rudragoudar
c00680f631
Add config method
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:32:45 +05:30
Rahul Rudragoudar
600c7c5e8f
Add config support
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-03-02 21:31:07 +05:30
Rahul Rudragoudar
de50d8123e
Linter and Formatter support (#58)
* Add scala linter and formatter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add java formatter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add linter support

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Increase maxColumn limit

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Reformat and lint

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Minor reformatting

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add scala formatter on compile option

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Enable scala linter for CI

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-02-25 23:49:39 +05:30
Rahul Rudragoudar
6d04cdc3b4
Refactor modules (#56)
* Refactor:Modules

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add config file

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Restore sample images

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-02-24 15:21:16 +05:30
Rahul Rudragoudar
c10a66a23b
Remove POST support for media endpoint
Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2021-02-18 15:24:47 +05:30
Rahul Rudragoudar
b16c2698d2
Fix issue in GC (#54)
* Update sql to map uuid to token

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix millis to secs conversion

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add synchronisation to media enpoint DB access

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change error code for rate limiter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* move prepared statements to Thread Local Storage

* Change test end points

* init GC

* Add GC

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change status return

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Auto generate token in db

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Remove user management and rate limiting

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add seed for random number generator

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Store random instance as class member

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update locustfile

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add API documentation

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Move updateTimeStamp to getChallenge methdod
Remove user tables for the DB

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update Timestamp when creating mapId entry

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add request method type

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Minor fixes

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix issue in GC

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change db directory

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update locust test

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update .gitignore
2021-02-16 16:02:57 +05:30
Rahul Rudragoudar
5c3bdfeb83
GC, Seed and User management (#52)
* Update sql to map uuid to token

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix millis to secs conversion

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add synchronisation to media enpoint DB access

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change error code for rate limiter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* move prepared statements to Thread Local Storage

* Change test end points

* init GC

* Add GC

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change status return

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Auto generate token in db

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Remove user management and rate limiting

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add seed for random number generator

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Store random instance as class member

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update locustfile

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add API documentation

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Move updateTimeStamp to getChallenge methdod
Remove user tables for the DB

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Update Timestamp when creating mapId entry

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add request method type

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Minor fixes

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2020-09-23 22:58:42 +05:30
hrj
9af66adf9f refactor: don't inherit classes from DBConn 2020-07-16 17:53:26 +05:30
hrj
7bfde4eddb simplified check for user access
1. Make fields private as much as possible
2. single public function to check if user is valid and is within limit.
   Advantage is that only a single call to synchronisation() is required.
3. Bumped up the rate limit
2020-07-16 17:36:19 +05:30
hrj
f08f6041ec renaming and removal of unused code 2020-07-16 17:23:48 +05:30
Rahul Rudragoudar
1d7ef512bd
DB synchronisation on media endpoint (#47)
* Update sql to map uuid to token

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Fix millis to secs conversion

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Add synchronisation to media enpoint DB access

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>

* Change error code for rate limiter

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
2020-07-08 21:28:11 +05:30
hrj
62b3a098bd synchronise access to database statements 2020-07-05 00:50:05 +05:30
hrj
ab6abaf5c0 minor, formatting 2020-07-04 01:23:05 +05:30
hrj
245521017a labelcaptcha: store filenames in the token
This is a hack, for the purposes of the POC.
2020-07-04 01:22:26 +05:30
hrj
b300fa2178 minor: privatised some vars 2020-07-04 01:21:02 +05:30
hrj
3d147950a4 prevent resource leak by using try-with-resource syntax 2020-07-03 22:20:30 +05:30
hrj
300ff3162d minor: rate limit increase 2020-07-03 22:17:40 +05:30
hrj
1515af5f72 minor debug 2020-07-03 22:17:29 +05:30
hrj
239bf2cefc gracefully handle wrong input from API 2020-07-03 22:16:23 +05:30