- Create an HTTP-based server API based on persistent storage (perhaps a database). You should also create a client consuming the API, demonstrating that the solution satisfies the below requirements.
Minimum requirements - The application should allow a user to:
- Register
- Authenticate
- Access a list of timestamps showing the user's last 5 successful login attempts. The user should only be able to see it’s own list.
Install the below software in the developement environment.
- maven 3.3.9
- java 1.8
- docker 1.12 (https://docs.docker.com/install/)
- git
- postman (https://support.getpostman.com/)
clone the source code
> git clone https://github.com/thiyagu06/auth-manager.git
cd auth-manager
Run the postgresql database
> docker run -d -p 5432:5432 --name izettle-auth -e POSTGRES_PASSWORD={{password}} postgres:11
Create a schema in the postgres command line.
> docker run -it --rm --link izettle-auth:postgres postgres psql -h postgres -U postgres
create a schema
postgres:> CREATE SCHEMA "izettle-auth" AUTHORIZATION postgres;
Update the schema name,database credentials and schema in the dev profile.
https://github.com/thiyagu06/auth-manager/blob/master/src/main/resources/application-dev.properties
Run the application
mvn spring-boot:run -Dspring-boot.run.profiles=dev
The images are already published to the docker hub.
Update the env.sh file with required values.
> source env.sh
Run the application
> docker-compose up -d
verify whether container is running
> docker ps
> cd database
> docker build -t thiyagu06/izettle-auth-management-postgres:1.0 .
verify the image
> docker images
> mvn package dockerfile:build
verify the image
> docker images
The postman scripts are avaliable at https://github.com/thiyagu06/auth-manager/tree/master/postman. import both collection and environment json file in postman and execute the request in the order. All the request postman script is self explanatory for the scenario it tests. Update the Authorization header after successful login. The header will be sent in the response header of login success. Update the environment variable based your development environment.
- Successfully register the user
- Login with registered user credentials
- view the successful login attempts
- If you face any problem for connecting with docker daemon when building service images using mvn command, refer the below url to enable tls connection to daemon. https://forums.docker.com/t/spotify-docker-maven-plugin-cant-connect-to-localhost-2375/9093# auth-manager