File tree Expand file tree Collapse file tree 2 files changed +13
-25
lines changed
core/src/main/java/org/springframework/security/core/userdetails
test/src/test/java/org/springframework/security/test/context/showcase Expand file tree Collapse file tree 2 files changed +13
-25
lines changed Original file line number Diff line number Diff line change @@ -67,28 +67,36 @@ public interface UserDetails extends Serializable {
67
67
* @return <code>true</code> if the user's account is valid (ie non-expired),
68
68
* <code>false</code> if no longer valid (ie expired)
69
69
*/
70
- boolean isAccountNonExpired ();
70
+ default boolean isAccountNonExpired () {
71
+ return true ;
72
+ }
71
73
72
74
/**
73
75
* Indicates whether the user is locked or unlocked. A locked user cannot be
74
76
* authenticated.
75
77
* @return <code>true</code> if the user is not locked, <code>false</code> otherwise
76
78
*/
77
- boolean isAccountNonLocked ();
79
+ default boolean isAccountNonLocked () {
80
+ return true ;
81
+ }
78
82
79
83
/**
80
84
* Indicates whether the user's credentials (password) has expired. Expired
81
85
* credentials prevent authentication.
82
86
* @return <code>true</code> if the user's credentials are valid (ie non-expired),
83
87
* <code>false</code> if no longer valid (ie expired)
84
88
*/
85
- boolean isCredentialsNonExpired ();
89
+ default boolean isCredentialsNonExpired () {
90
+ return true ;
91
+ }
86
92
87
93
/**
88
94
* Indicates whether the user is enabled or disabled. A disabled user cannot be
89
95
* authenticated.
90
96
* @return <code>true</code> if the user is enabled, <code>false</code> otherwise
91
97
*/
92
- boolean isEnabled ();
98
+ default boolean isEnabled () {
99
+ return true ;
100
+ }
93
101
94
102
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -54,26 +54,6 @@ public String getUsername() {
54
54
return this .username ;
55
55
}
56
56
57
- @ Override
58
- public boolean isAccountNonExpired () {
59
- return true ;
60
- }
61
-
62
- @ Override
63
- public boolean isAccountNonLocked () {
64
- return true ;
65
- }
66
-
67
- @ Override
68
- public boolean isCredentialsNonExpired () {
69
- return true ;
70
- }
71
-
72
- @ Override
73
- public boolean isEnabled () {
74
- return true ;
75
- }
76
-
77
57
@ Override
78
58
public String toString () {
79
59
return "CustomUserDetails{" + "username='" + this .username + '\'' + '}' ;
You can’t perform that action at this time.
0 commit comments