This project contains implementation of OAuth 2.0 which is the industry-standard protocol for authorization. It's developed by using Spring Boot framework in Java.
These instructions provide information on how to use the oauth-server project.
You can run the server in your local environment with below commands.
mvn clean install
You will need a postgres database with OAuth Server entities to run the server. You can run the OAuth Server Hasura in your local environment to get a proper database.
You will need to add below environment variables to run the server. These values must be provided in env.properties file in the root directory.:
Variable Name | Description | Required | Default Value |
---|---|---|---|
DB_HOST | Represents the hostname of the database that needs to be connected. | YES | - |
DB_NAME | Represents the name of the database that needs to be connected. | YES | - |
DB_USER | Represents the user of the database that needs to be connected. | YES | - |
DB_PASSWORD | Represents the password of the database that needs to be connected. | YES | - |
AUTHORIZATION_CODE_EXPIRES_MS | Represents the expiry time of authorization code in milliseconds. | NO | 300000 |
LOGIN_SIGNUP_ENDPOINT | Represents the login/signup endpoint of the implementer application. | YES | - |
COOKIE_ENCRYPTION_SECRET | Represents the secret while decrypting the user cookie. | YES | - |
ENABLE_SWAGGER | Represents the enabling or disabling the swagger. | NO | - |
USER_IDENTITY_SERVICE_URL | Represents the identity service url to get user identity info. | NO | - |
ENABLE_ID_TOKEN | Represents the enabling or disabling id_token generation by getting user identity infor from user identity service. | NO | NO |
ERROR_PAGE_URL | Represents the page url to redirect on authorize error | YES | NO |
mvn spring-boot:start
mvn spring-boot:stop
You can run the server in Docker environment with below commands:
First, you need to build the image:
docker build . -t oauth-server
Then, you can run the image with following command:
docker run -d -p 8080:8080 -e DB_HOST=<database_host> -e DB_NAME=<database_name> -e DB_USER=<database_username> -e DB_PASSWORD=<database_password> oauth-server -e LOGIN_SIGNUP_ENDPOINT=<login_signup_endpoint>
You can run the tests with below command:
mvn test
OAuth Server is MIT licensed.