-
Notifications
You must be signed in to change notification settings - Fork 30
jwt api implementation #48
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
Changes from all commits
fbe6878
54236e3
ba5afd4
fd0eb9a
0ca92ba
4c392fe
45d7218
7f5fa76
597cc12
cbd4e72
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 |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| package com.iemr.ecd.dao; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.sql.Timestamp; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.google.gson.annotations.Expose; | ||
|
|
||
| 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; | ||
|
|
||
| @Data | ||
| @Entity | ||
| @Table(name = "m_user") | ||
|
Comment on lines
+17
to
+19
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 constraints The entity lacks input validation annotations for critical fields. Add appropriate validations: @Data
@Entity
@Table(name = "m_user")
+@EntityListeners(AuditingEntityListener.class)
public class Users {Example field validations: + @NotBlank(message = "Username is required")
+ @Size(min = 3, max = 50)
private String userName;
+ @Email(message = "Invalid email format")
private String emailID;
+ @Pattern(regexp = "^[0-9]{12}$", message = "Invalid Aadhaar format")
private String aadhaarNo;
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class Users implements Serializable { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Expose | ||
| @Column(name = "UserID") | ||
| private Long userID; | ||
| @Expose | ||
| @Column(name = "TitleID") private Short titleID; | ||
| @Expose | ||
| @Column(name = "FirstName") | ||
| private String firstName; | ||
| @Expose | ||
| @Column(name = "MiddleName") | ||
| private String middleName; | ||
| @Expose | ||
| @Column(name = "lastName") | ||
| private String lastName; | ||
| @Expose | ||
| @Column(name = "GenderID") | ||
| private Short genderID; | ||
| @Expose | ||
| @Column(name = "MaritalStatusID") | ||
| private Short maritalStatusID; | ||
| @Expose | ||
| @Column(name = "AadhaarNo") | ||
| private String aadhaarNo; | ||
| @Expose | ||
| @Column(name = "PAN") | ||
| private String pan; | ||
|
Comment on lines
+45
to
+49
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. Critical: PII data protection required Aadhaar and PAN are sensitive PII (Personally Identifiable Information) that require special handling:
Recommendations:
|
||
| @Expose | ||
| @Column(name = "DOB") | ||
| private Timestamp dob; | ||
| @Expose | ||
| @Column(name = "DOJ") | ||
| private Timestamp doj; | ||
| @Expose | ||
| @Column(name = "QualificationID") | ||
| private Integer qualificationID; | ||
| @Expose | ||
| @Column(name = "UserName") | ||
| private String userName; | ||
| @Expose | ||
| @Column(name = "Password") | ||
| private String password; | ||
|
Comment on lines
+63
to
+64
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. Critical: Secure password handling required The password field lacks proper security measures:
Add password hashing and remove @expose: - @Expose
@Column(name = "Password")
private String password;Consider using:
|
||
| @Expose | ||
| @Column(name = "AgentID") | ||
| private String agentID; | ||
| @Expose | ||
| @Column(name = "AgentPassword") | ||
| private String agentPassword; | ||
| @Expose | ||
| @Column(name = "EmailID") | ||
| private String emailID; | ||
| @Expose | ||
| @Column(name = "StatusID") | ||
| private Short statusID; | ||
| @Expose | ||
| @Column(name = "EmergencyContactPerson") | ||
| private String emergencyContactPerson; | ||
| @Expose | ||
| @Column(name = "EmergencyContactNo") | ||
| private String emergencyContactNo; | ||
| @Expose | ||
| @Column(name = "IsSupervisor") | ||
| private Boolean isSupervisor; | ||
| @Expose | ||
| @Column(name = "Deleted") | ||
| private Boolean deleted; | ||
| @Expose | ||
| @Column(name = "CreatedBy") | ||
| private String createdBy; | ||
| @Expose | ||
| @Column(name = "CreatedDate") | ||
| private Timestamp createdDate; | ||
| @Expose | ||
| @Column(name = "ModifiedBy") | ||
| private String modifiedBy; | ||
| @Expose | ||
| @Column(name = "LastModDate") | ||
| private Timestamp lastModDate; | ||
|
|
||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.iemr.ecd.repository.ecd; | ||
|
|
||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.data.repository.CrudRepository; | ||
| import org.springframework.data.repository.query.Param; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import com.iemr.ecd.dao.Users; | ||
|
|
||
| @Repository | ||
| public interface UserLoginRepo extends CrudRepository<Users, Long> { | ||
|
|
||
| @Query(" SELECT u FROM Users u WHERE u.userID = :userID AND u.deleted = false ") | ||
| public Users getUserByUserID(@Param("userID") Long userID); | ||
|
|
||
| } |
Uh oh!
There was an error while loading. Please reload this page.