This is an application made with Spring boot and Maven. This is used to execute a CRUD of candidates.
Ensure you have the following installed on your system:
- Java Development Kit (JDK 17)
- Maven
Run docker compose to start the external microservice that provides the candidate categories:
docker-compose up
Clone your Spring Boot API repository to your local machine:
git clone https://github.com/MaximilianoRodrigoSoria/candidate-api.git
cd candidate-api
Navigate to the root directory of your project and execute the following Maven command to build the project:
./mvnw clean install
Once the build is successful, you can run your Spring Boot application using the following command:
./mvnw spring-boot:run
Your Spring Boot API should now be accessible at the default port 8080. Open your web browser or a tool like Postman and access the following URL:
You can use the following Postman collection to test the API:
![Linkedin](/MaximilianoRodrigoSoria/candidate-api/raw/master/docs/img/postman-button.png)
- Enter the endpoint authorization server:
http://localhost:8080/candidate-api/.well-known/oauth-authorization-server
Copy authorization_endpoint
{
"issuer": "http://localhost:8080/candidate-api",
"authorization_endpoint": "http://localhost:8080/candidate-api/oauth2/authorize",
"token_endpoint": "http://localhost:8080/candidate-api/oauth2/token",
"token_endpoint_auth_methods_supported": [
"client_secret_basic",
"client_secret_post",
"client_secret_jwt",
"private_key_jwt"
],
"jwks_uri": "http://localhost:8080/candidate-api/oauth2/jwks",
"response_types_supported": [
"code"
],
"grant_types_supported": [
"authorization_code",
"client_credentials",
"refresh_token"
],
"revocation_endpoint": "http://localhost:8080/candidate-api/oauth2/revoke",
"revocation_endpoint_auth_methods_supported": [
"client_secret_basic",
"client_secret_post",
"client_secret_jwt",
"private_key_jwt"
],
"introspection_endpoint": "http://localhost:8080/candidate-api/oauth2/introspect",
"introspection_endpoint_auth_methods_supported": [
"client_secret_basic",
"client_secret_post",
"client_secret_jwt",
"private_key_jwt"
],
"code_challenge_methods_supported": [
"S256"
]
}
- Debugger authorization server:
Key | Value |
---|---|
app.client.id | client |
app.client.secret | secret |
app.client.scope.read | read |
app.client.scope.write | write |
app.client.redirect.debugger | https://oauthdebugger.com/debug |
app.client.redirect.spring.doc | https://springone.io/authorized |
The following configuration must be respected when changing the scope
Then the form information will be sent with the send button
Username and password are requested
List users
Username | Password Not Encrypted |
---|---|
read_laboratory | readonly |
admin_laboratory | admin |
write_laboratory | writeonly |
- Get Grant token
- Use the token to access the API
curl --location 'http://localhost:8080/candidate-api/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic Y2xpZW50OnNlY3JldA==' \
--header 'Cookie: JSESSIONID=8F3C03E633204CAA6ED7400E13A8C0D1; JSESSIONID=C3DE96EB791B37D99867D7BB692E5B07' \
--data-urlencode 'redirect_uri=https://oauthdebugger.com/debug' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=pDfLBO-aj7k6Tm5qVpxYYQ6FhjSlNQMGoShVpLH7FLISBZmX7glH9yAb4WtgWxCQCWWkklQM-3pcJ0k5Ga06kuANlRxVNSdFCrjagsx2cFejAB_AsQgsz6V7oPV_oMzL'
- Use basic authentication to access the API
Username: client
Password: secret
Copy token
Execute endpoints, use toke a barer token
💻 Name: Maximiliano Rodrigo Soria
📧 Email: MaximilianoRodrigoSoria@gmail.com
🏠 From: Florencio Varela, Alpino
💼 Linkedin: SoriaMaximilianoRodrigo
💬 Chat: Inicia un chat
📝 CV: Link