-
Notifications
You must be signed in to change notification settings - Fork 24
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
jwt implementation changes #53
base: develop
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,5 @@ logging.level.com.iemr=DEBUG | |
logging.level.org.springframework=INFO | ||
|
||
#ELK logging file name | ||
[email protected]_API_LOGGING_FILE_NAME@ | ||
[email protected]_API_LOGGING_FILE_NAME@ | ||
[email protected]_SECRET_KEY@ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.wipro.fhir.config; | ||
|
||
import org.springframework.cache.annotation.EnableCaching; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.redis.connection.RedisConnectionFactory; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; | ||
import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
import org.springframework.session.data.redis.config.ConfigureRedisAction; | ||
|
||
import com.wipro.fhir.data.users.User; | ||
|
||
@Configuration | ||
@EnableCaching | ||
public class RedisConfig { | ||
|
||
@Bean | ||
public ConfigureRedisAction configureRedisAction() { | ||
return ConfigureRedisAction.NO_OP; | ||
} | ||
|
||
@Bean | ||
public RedisTemplate<String, User> redisTemplate(RedisConnectionFactory factory) { | ||
RedisTemplate<String, User> template = new RedisTemplate<>(); | ||
template.setConnectionFactory(factory); | ||
|
||
// Use StringRedisSerializer for keys (userId) | ||
template.setKeySerializer(new StringRedisSerializer()); | ||
|
||
// Use Jackson2JsonRedisSerializer for values (Users objects) | ||
Jackson2JsonRedisSerializer<User> serializer = new Jackson2JsonRedisSerializer<>(User.class); | ||
template.setValueSerializer(serializer); | ||
|
||
return template; | ||
} | ||
|
||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.wipro.fhir.data.users; | ||
|
||
import java.io.Serializable; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.Data; | ||
|
||
@Entity | ||
@Table(name = "m_user") | ||
@Data | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class User implements Serializable { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "UserID") | ||
private Long userID; | ||
@Column(name = "userName") | ||
private String userName; | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Add validation and uniqueness constraints |
||
@Column(name = "Deleted", insertable = false, updatable = true) | ||
private Boolean deleted; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π οΈ Refactor suggestion
Standardize column naming convention and add constraints
The column naming is inconsistent (
UserID
vsuserName
). Also, theuserName
field lacks necessary constraints for a authentication-related field.