- Solution has two services and one database module:
bank-serviceprovides bank services: Cash deposit, Cash withdrawal, Check balance, etc.atm-servicesimple client for bank-service.atm-dbpostgres database docker image.
- To access
atm-servicetwo-step authentication is needed, finallyatm-servicegenerates limited time access token./api/authentication/initiatemethod checks if card is valid and generates access token which is valid only for accessing finalize method./api/authentication/finalizemethod validates card preferred authentication method (PIN, fingerprint etc.), and generates access token which is valid for accessing rest of the atm services.- After finalizing authentication JWT token payload looks like:
{ "sub": "1111222233334444", "preferred_auth": "FINGERPRINT", "roles": [ "FINALIZED_AUTHENTICATION" ], "iat": 1640896897, "exp": 1640898097 } - To access
bank-servicesomeAPI-KEYneeds to be set as a header. bank-serviceautomatically creates database schema and loads some sample data. There are about three main tables:
Hibernate enversis used for auditing.resilience4jis used for circuit breaking and rate limiting.- Both of the services have swagger ui configured and can be accessed at
/swagger-ui/index.html - Logging can be configured by setting
LOG_LEVELenv variable.
- Simplest way to start everything is to use
docker-composewhich will start postgres database and two services.
docker-compose up
- Otherwise, apps can be started using java. (postgres database is required as well)
- Access
atm-serviceswagger at: http://localhost:8080/swagger-ui/index.html - Access
bank-serviceswagger at: http://localhost:8090/swagger-ui/index.html - Postman can be also used to test some endpoints. See ready to use postman collection in source files.
ATM Emulator.postman_collection.json