Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kedarkamthe/spring-authentication-by-example
This project explores various methods of implementing authentication using Spring Security.
https://github.com/kedarkamthe/spring-authentication-by-example
basic-authentication jwt-authentication oauth2 spring-boot spring-security
Last synced: about 9 hours ago
JSON representation
This project explores various methods of implementing authentication using Spring Security.
- Host: GitHub
- URL: https://github.com/kedarkamthe/spring-authentication-by-example
- Owner: kedarkamthe
- Created: 2024-08-14T07:03:50.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-19T05:13:29.000Z (3 months ago)
- Last Synced: 2024-08-19T06:28:32.694Z (3 months ago)
- Topics: basic-authentication, jwt-authentication, oauth2, spring-boot, spring-security
- Language: Java
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Understanding spring security By example
* [Understanding spring security By example](#understanding-spring-security-by-example)
* [Learning](#learning-)
* [Data Setup](#data-setup-)## Learning
1. By default, when we add spring security to our project,
It adds a user with username as `user` and password would be printed as **default password** in console when application starts
**Note**: to see the default password on console you need to set log level in application.yaml
for below spring package`logging.level.org.springframework.security: INFO`
2. Add username and password to `application.yml` and add `.httpBasic(Customizer.withDefaults())` in `SecurityFilterChain` bean.
With this change you will be able to `login` with `username/password` provided in `application.yml`
3. Added `oAuth2 client` support with `Keycloak` using reference [here](https://developers.redhat.com/articles/2023/07/24/how-integrate-spring-boot-3-spring-security-and-keycloak)
4. Added `Jwt based authentication`g for `/greet` api present in Postman collection using `KeyCloak` as resource server used reference [here](https://www.baeldung.com/spring-boot-keycloak)## Data Setup
1. Import realm in `/setup` folder in keycloak
2. Create user in realm imported in step-1