Ignore:
Timestamp:
01/04/23 02:49:26 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
ab952ab
Parents:
6832924
Message:

Configured spring security, changed spring version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/model/User.java

    r6832924 rae042f4  
    11package com.example.autopartz.model;
    22
    3 import jakarta.persistence.*;
    4 import lombok.*;
     3import lombok.Getter;
     4import lombok.RequiredArgsConstructor;
     5import lombok.Setter;
     6import lombok.ToString;
    57import org.hibernate.Hibernate;
     8import org.springframework.security.core.GrantedAuthority;
     9import org.springframework.security.core.userdetails.UserDetails;
    610
     11import javax.persistence.*;
    712import java.time.LocalDateTime;
     13import java.util.Collection;
     14import java.util.Collections;
    815import java.util.Objects;
    916
     
    1522@Table(name = "users_table")
    1623@Inheritance(strategy = InheritanceType.JOINED)
    17 public class User {
     24public class User implements UserDetails {
    1825    @Id
    19     Long ID_user;
     26    Integer ID_user;
    2027    String username;
    2128    String email;
     
    5057        return getClass().hashCode();
    5158    }
     59
     60
     61    @Override
     62    public Collection<? extends GrantedAuthority> getAuthorities() {
     63        return Collections.singletonList(Role.ROLE_USER);
     64    }
     65
     66    @Override
     67    public boolean isAccountNonExpired() {
     68        return true;
     69    }
     70
     71    @Override
     72    public boolean isAccountNonLocked() {
     73        return true;
     74    }
     75
     76    @Override
     77    public boolean isCredentialsNonExpired() {
     78        return true;
     79    }
     80
     81    @Override
     82    public boolean isEnabled() {
     83        return true;
     84    }
    5285}
Note: See TracChangeset for help on using the changeset viewer.