Add JWT authorization
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
package com.faf223.expensetrackerfaf.security;
|
||||
|
||||
import com.faf223.expensetrackerfaf.model.Role;
|
||||
import com.faf223.expensetrackerfaf.model.User;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor(force = true)
|
||||
@AllArgsConstructor
|
||||
public class PersonDetails implements UserDetails {
|
||||
|
||||
private final User user;
|
||||
@@ -34,7 +42,7 @@ public class PersonDetails implements UserDetails {
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return user.getUsername();
|
||||
return user.getEmail();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user