{"id":22945346,"url":"https://github.com/sesaquecruz/java-auth-api","last_synced_at":"2025-07-23T21:34:58.718Z","repository":{"id":180815982,"uuid":"663113953","full_name":"sesaquecruz/java-auth-api","owner":"sesaquecruz","description":"An Auth API with Spring Security and JWT. ","archived":false,"fork":false,"pushed_at":"2023-07-16T23:03:52.000Z","size":173,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-07T14:26:08.517Z","etag":null,"topics":["api","clean-architecture","java","jwt","rest-api","rsa","spring-security","spring-web"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sesaquecruz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-06T15:23:11.000Z","updated_at":"2023-07-14T06:33:28.000Z","dependencies_parsed_at":"2024-12-14T14:43:19.688Z","dependency_job_id":null,"html_url":"https://github.com/sesaquecruz/java-auth-api","commit_stats":null,"previous_names":["sesaquecruz/java-auth-api"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesaquecruz%2Fjava-auth-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesaquecruz%2Fjava-auth-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesaquecruz%2Fjava-auth-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sesaquecruz%2Fjava-auth-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sesaquecruz","download_url":"https://codeload.github.com/sesaquecruz/java-auth-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246717056,"owners_count":20822557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","clean-architecture","java","jwt","rest-api","rsa","spring-security","spring-web"],"created_at":"2024-12-14T14:31:47.432Z","updated_at":"2025-04-01T21:44:28.032Z","avatar_url":"https://github.com/sesaquecruz.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# An Auth API with Spring Security and JWT\n\nThis project is a REST API for user authentication and authorization that provides a set of endpoints to manage user registration, login, and user-related operations. It was built using Java, Spring Web and Spring Security, and following SOLID principles and Clean Architecture.\n\n## Endpoints\n\n| Endpoint              | Method | Protected | Description                              |\n|-----------------------| ------ |-----------|------------------------------------------|\n| `/api/v1/users/new`   | POST   | NO        | Create an user                           |\n| `/api/v1/users/login` | POST   | NO        | Authenticate user and return a JWT token |\n| `/api/v1/users`       | GET    | YES       | Return user data                         |\n| `/api/v1/users`       | PUT    | YES       | Update user data                         |\n| `/api/v1/users`       | DELETE | YES       | Delete user                              |\n| `/api/v1/swagger-ui/` | GET    | NO        | API Documentation                        |\n\n## Security\n\n- After login, the user authentication and authorization is handled using JWT (JSON Web Token).\n- The user's ID is embedded within the JWT token, allowing identification of the user accessing the API.\n- RSA encryption is used for JWT token generation, this enables other systems to verify the authenticity and integrity of the JWT tokens only by using a public key.\n\n## Requirements\n\nTo run this program, you will need:\n\n- Docker\n- Docker Compose\n\n## Installation\n\nThe docker images of this project can be found on [Docker Hub](https://hub.docker.com/r/sesaquecruz/java-auth-api).\n\n1. Clone this repository:\n\n```\ngit clone https://github.com/sesaquecruz/java-auth-api\n```\n\n2. Enter the project directory:\n\n```\ncd java-auth-api\n```\n\n3. Start the MySQL container:\n\n```\ndocker compose --profile db up -d\n```\n\n4. Run the migrations:\n\n```\n./gradlew flywayMigrate\n```\n\n5. Build the API jar:\n\n```\n./gradlew bootJar\n```\n\n6. Start the API container:\n\n```\ndocker compose --profile app up -d --build\n```\n\n7. To stop all containers, use:\n\n```\ndocker compose --profile db --profile app down\n```\n\nThe MySQL container can take some seconds to start up.\n\n## Usage\n\n### API Documentation\n\n1. Access the Swagger UI:\n\n```\nhttp://localhost:8080/api/v1/swagger-ui/index.html\n```\n\nTo access protected endpoints, a valid JWT token is required, which can be obtained upon successful user login.\n\n## Troubleshooting\n\nSee [docker-compose.yml](./docker-compose.yml) to verify or change services, ports, and environment variables.\n\n## Contributing\n\nContributions are welcome! If you find a bug or would like to suggest an enhancement, please make a fork, create a new branch with the bugfix or feature, and submit a pull request.\n\nThis project follows the [GitFlow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) and adheres to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). For CI/CD, it has [GitHub Actions](https://github.com/features/actions) to run [tests](.github/workflows/ci.yml), determine the version, and [deploy](.github/workflows/ci-cd.yml) a docker image before merging into some branches.\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE](./LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsesaquecruz%2Fjava-auth-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsesaquecruz%2Fjava-auth-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsesaquecruz%2Fjava-auth-api/lists"}