Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/developer-guy/springboot-oauth2-sample
⁉️ This project is example of OAuth2 and SpringBoot .
https://github.com/developer-guy/springboot-oauth2-sample
oauth2 oauth2-client oauth2-server springboot
Last synced: 9 days ago
JSON representation
⁉️ This project is example of OAuth2 and SpringBoot .
- Host: GitHub
- URL: https://github.com/developer-guy/springboot-oauth2-sample
- Owner: developer-guy
- Created: 2017-11-07T11:20:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-07T12:07:29.000Z (over 7 years ago)
- Last Synced: 2024-12-13T05:25:18.796Z (2 months ago)
- Topics: oauth2, oauth2-client, oauth2-server, springboot
- Language: Shell
- Homepage:
- Size: 64.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Springboot OAuth2 Project
This project contains two applications.One of them oauth2-server and the other oauth2-client.Our oauth2-server project protects the oauth2-client Rest API's.If user want to send requesto to oauth2-client Rest APIs , the user must be authenticate to oauth2-server .
## Getting Started
Before you started you should read these articles because this project was developed by following articles, in these articles explain the OAuth2 and the JWT technologieis :
http://www.tinmegali.com/en/oauth2-using-spring/
http://stytex.de/blog/2016/02/01/spring-cloud-security-with-oauth2/## Running
Firstly , you must run oauth2-server to provide token to users.
Inside OAuth2ServerConfiguration.class you will see the client's credentials, so you can get token like this :* curl -XPOST "trusted-app:webapp@localhost:9091/oauth/token" -d "grant_type=password&username=user&passsword=passsword"
After you get the access token you can send the http request to oauth2-client:
* curl -X GET -H "Authorization: Bearer access_token" http://localhost:9090/api/hello --> This request will be work.
* curl -X GET -H "Authorization: Bearer access_token" http://localhost:9090/api/admin --> This request will return access_denied error , becuase this user doesn't have ROLE_ADMIN role.If you want to send request to /api/admin you should login with admin user.
* curl -XPOST "trusted-app:webapp@localhost:9091/oauth/token" -d "grant_type=password&username=admin&passsword=passsword"
## Built With
* [Maven](https://maven.apache.org/) - Dependency Management
## Authors
* **Batuhan Apaydın** - *Initial work* - [SAHABT](https://github.com/developer-guy)
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments
* Hat tip to anyone who's code was used
* Inspiration
* etc