-
Notifications
You must be signed in to change notification settings - Fork 0
Add cache #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Add cache #11
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
3ae568e
Add authentication, security, and JWT functionality
NourAlPha 86d51d2
Add authentication, security, and JWT functionality
NourAlPha c7a6772
Update src/main/java/com/podzilla/auth/model/User.java
NourAlPha 96bcc51
fix test error
NourAlPha bf83761
Merge branch 'Add-auth' of https://github.com/Podzilla/authentication…
NourAlPha 920aad0
Create tmp
NourAlPha aeb7cf1
Fix authApplication
NourAlPha 71785a1
Add refresh token
NourAlPha c4f7560
Add refresh token to the cookie instead of returning it back to the f…
NourAlPha 8f9f175
Add admin role get all users api
NourAlPha f8f9b21
Update src/main/java/com/podzilla/auth/controller/AuthenticationContr…
NourAlPha 0ce8b9c
Update src/main/java/com/podzilla/auth/controller/AuthenticationContr…
NourAlPha 837add8
Update .github/workflows/ci-cd.yml
NourAlPha 7235218
Rename signup endpoint to register and enhance refresh token management
NourAlPha a702c83
Add Swagger annotations for API documentation and implement custom ex…
NourAlPha e86ada4
Add Swagger annotations for API documentation and implement custom ex…
NourAlPha cd51b0e
Configure SpringDoc OpenAPI settings and permit access to Swagger UI …
NourAlPha 251dc5b
Refactor API endpoints and rename JWTService to TokenService
NourAlPha fa225f6
Set server context path to /api in application properties
NourAlPha deb3870
Add Redis caching support and update Docker configuration for Redis s…
NourAlPha 5068d72
Update Docker images for PostgreSQL, Grafana, Loki, Promtail, Redis, …
NourAlPha af4eecb
Refactor API endpoints and rename JWTService to TokenService
NourAlPha f5300fb
Set server context path to /api in application properties
NourAlPha 4d13b40
Add Redis caching support and update Docker configuration for Redis s…
NourAlPha 20c7ad4
Update Docker images for PostgreSQL, Grafana, Loki, Promtail, Redis, …
NourAlPha 15eb1ee
Merge branch 'add-cache' of https://github.com/Podzilla/authenticatio…
NourAlPha 715f235
Enhance global exception handling and logging for authentication erro…
NourAlPha 2796156
Refactor authentication and token management: use builder pattern for…
NourAlPha 6853011
Update security configuration to permit access to refresh token endpoint
NourAlPha 0d6d721
Implement custom user details and enhance authentication: add CustomU…
NourAlPha 274eb06
Create tmp
NourAlPha 8d93c55
Fix authApplication
NourAlPha 9c942a0
Add refresh token
NourAlPha b177e81
Add refresh token to the cookie instead of returning it back to the f…
NourAlPha 70e0cef
Rename signup endpoint to register and enhance refresh token management
NourAlPha 35b27e7
Add Swagger annotations for API documentation and implement custom ex…
NourAlPha aa71af9
Refactor API endpoints and rename JWTService to TokenService
NourAlPha b4f9750
Add Redis caching support and update Docker configuration for Redis s…
NourAlPha 4efc873
Update Docker images for PostgreSQL, Grafana, Loki, Promtail, Redis, …
NourAlPha 2df2cb3
Enhance global exception handling and logging for authentication erro…
NourAlPha 18b0a65
Refactor authentication and token management: use builder pattern for…
NourAlPha 6ca3a55
Update security configuration to permit access to refresh token endpoint
NourAlPha 78f2eb6
Implement custom user details and enhance authentication: add CustomU…
NourAlPha dbee902
Merge branch 'add-cache' of https://github.com/Podzilla/authenticatio…
NourAlPha 8a08f1d
test
NourAlPha 6a182ce
tst2
NourAlPha 5158aa4
Remove debug logging from login method in AuthenticationService
NourAlPha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/podzilla/auth/dto/CustomUserDetails.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.podzilla.auth.dto; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import org.springframework.security.core.GrantedAuthority; | ||
| import org.springframework.security.core.userdetails.UserDetails; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.Set; | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class CustomUserDetails implements UserDetails { | ||
|
|
||
| private String username; | ||
| private String password; | ||
| private Set<GrantedAuthority> authorities; | ||
|
|
||
| public CustomUserDetails() { | ||
| // No-arg constructor required by Jackson | ||
| } | ||
|
|
||
| public CustomUserDetails(final String username, final String password, | ||
| final Set<GrantedAuthority> authorities) { | ||
| this.username = username; | ||
| this.password = password; | ||
| this.authorities = authorities; | ||
| } | ||
|
|
||
| @Override | ||
| public String getUsername() { | ||
| return username; | ||
| } | ||
|
|
||
| @Override | ||
| public String getPassword() { | ||
| return password; | ||
| } | ||
|
|
||
| @Override | ||
| public Collection<? extends GrantedAuthority> getAuthorities() { | ||
| return authorities; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/podzilla/auth/redis/RedisCacheConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package com.podzilla.auth.redis; | ||
|
|
||
| import com.podzilla.auth.dto.CustomUserDetails; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.data.redis.cache.RedisCacheConfiguration; | ||
| import org.springframework.data.redis.cache.RedisCacheManager; | ||
| import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
| import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | ||
| import org.springframework.data.redis.serializer.RedisSerializationContext; | ||
|
|
||
| import java.time.Duration; | ||
|
|
||
| @Configuration | ||
| public class RedisCacheConfig { | ||
|
|
||
| private static final int CACHE_TTL = 60 * 60; | ||
|
|
||
| @Bean | ||
| public RedisCacheManager cacheManager( | ||
| final RedisConnectionFactory redisConnectionFactory) { | ||
|
|
||
| RedisCacheConfiguration defaultConfig = RedisCacheConfiguration | ||
| .defaultCacheConfig() | ||
| .entryTtl(Duration.ofMinutes(CACHE_TTL)) | ||
| .disableCachingNullValues() | ||
| .serializeValuesWith( | ||
| RedisSerializationContext. | ||
| SerializationPair. | ||
| fromSerializer( | ||
| new Jackson2JsonRedisSerializer<>( | ||
| CustomUserDetails.class))); | ||
|
|
||
| return RedisCacheManager.builder(redisConnectionFactory) | ||
| .cacheDefaults(defaultConfig) | ||
| .build(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
src/main/java/com/podzilla/auth/security/RestAuthenticationEntryPoint.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.