forked from ZipCodeCore/FinalGroupProjects-Java
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLogin.java
More file actions
102 lines (80 loc) · 2.13 KB
/
Login.java
File metadata and controls
102 lines (80 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package runner.entities;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import runner.views.Views;
import javax.persistence.*;
import java.util.Collection;
@Entity
public class Login implements UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@JsonView(Views.Profile.class)
@Column(nullable = false)
private String username;
@Column(nullable = false)
private String password;
@JsonBackReference(value = "customer")
@OneToOne
@PrimaryKeyJoinColumn
private Customer customer;
public Login(){
}
public Login(User user) {
this.username = user.getUsername();
this.password = user.getPassword();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Customer getUser() {
return customer;
}
public void setUser(Customer customer) {
this.customer = customer;
}
//is user account expired
@Override
public boolean isAccountNonExpired() {
return true;
}
//is user account locked
@Override
public boolean isAccountNonLocked() {
return true;
}
//is user credential expired
@Override
public boolean isCredentialsNonExpired() {
return true;
}
//is user enabled
@Override
public boolean isEnabled() {
return true;
}
//ignore this, not using authorities
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
}