A One Time Password micro service using H2 in memory database.
application.properties holds your configuration settings.
Pass an id to the service and receive back a OTP code in JSON as below.
This code has a default expiry of 5 minutes.
{
"id": 2222222,
"code": 987826,
"expires": "2022-02-04T02:25:39.596+00:00"
}
Pass an id and a custom lifetime to the service and receive back a OTP code in JSON as above.
The lifetime should be the time in milliseconds that the code will be valid for. eg. 60000 is 1 minute.
Accepts a json encoded body in the following format:
{
"id": 2222222,
"code": 516971
}
Returns a string response indicating failed or ok.
The one time password table is cleaned of expired codes using a scheduled task. The application property
scheduler.clean.otpdb
identifies the time between running the task in milliseconds. If set as default to
10 seconds.