You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arguments.of("user", "password", "Given that there is no default password encoder configured, each "
133
+
+ "password must have a password encoding prefix. Please either prefix this password with '{noop}' or set a default password encoder in `DelegatingPasswordEncoder`."),
134
+
Arguments.of("user", "bycrpt}password", "The name of the password encoder is improperly formatted or incomplete. The format should be '{ENCODER}password'."),
135
+
Arguments.of("user", "{bycrptpassword", "The name of the password encoder is improperly formatted or incomplete. The format should be '{ENCODER}password'."),
136
+
Arguments.of("user", "{ren&stimpy}password", "There is no password encoder mapped for the id 'ren&stimpy'. Check your configuration to ensure it matches one of the registered encoders.")
Copy file name to clipboardExpand all lines: crypto/src/main/java/org/springframework/security/crypto/password/DelegatingPasswordEncoder.java
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@
18
18
19
19
importjava.util.HashMap;
20
20
importjava.util.Map;
21
+
importorg.springframework.util.StringUtils;
21
22
22
23
/**
23
24
* A password encoder that delegates to another PasswordEncoder based upon a prefixed
@@ -129,9 +130,14 @@ public class DelegatingPasswordEncoder implements PasswordEncoder {
129
130
130
131
privatestaticfinalStringDEFAULT_ID_SUFFIX = "}";
131
132
132
-
publicstaticfinalStringNO_PASSWORD_ENCODER_MAPPED = "There is no PasswordEncoder mapped for the id \"%s\"";
133
+
privatestaticfinalStringNO_PASSWORD_ENCODER_MAPPED = "There is no password encoder mapped for the id '%s'. "
134
+
+ "Check your configuration to ensure it matches one of the registered encoders.";
133
135
134
-
publicstaticfinalStringNO_PASSWORD_ENCODER_PREFIX = "You have entered a password with no PasswordEncoder. If that is your intent, it should be prefixed with `{noop}`.";
136
+
privatestaticfinalStringNO_PASSWORD_ENCODER_PREFIX = "Given that there is no default password encoder configured, each password must have a password encoding prefix. "
137
+
+ "Please either prefix this password with '{noop}' or set a default password encoder in `DelegatingPasswordEncoder`.";
138
+
139
+
privatestaticfinalStringMALFORMED_PASSWORD_ENCODER_PREFIX = "The name of the password encoder is improperly "
140
+
+ "formatted or incomplete. The format should be '%sENCODER%spassword'.";
135
141
136
142
privatefinalStringidPrefix;
137
143
@@ -290,10 +296,17 @@ public String encode(CharSequence rawPassword) {
Copy file name to clipboardExpand all lines: crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java
+15-10Lines changed: 15 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,6 @@
43
43
@ExtendWith(MockitoExtension.class)
44
44
publicclassDelegatingPasswordEncoderTests {
45
45
46
-
publicstaticfinalStringNO_PASSWORD_ENCODER = "You have entered a password with no PasswordEncoder. If that is your intent, it should be prefixed with `{noop}`.";
47
-
48
46
@Mock
49
47
privatePasswordEncoderbcrypt;
50
48
@@ -70,6 +68,14 @@ public class DelegatingPasswordEncoderTests {
privatestaticfinalStringNO_PASSWORD_ENCODER_MAPPED = "There is no password encoder mapped for the id 'unmapped'. "
72
+
+ "Check your configuration to ensure it matches one of the registered encoders.";
73
+
74
+
privatestaticfinalStringNO_PASSWORD_ENCODER_PREFIX = "Given that there is no default password encoder configured, "
75
+
+ "each password must have a password encoding prefix. Please either prefix this password with '{noop}' or set a default password encoder in `DelegatingPasswordEncoder`.";
76
+
77
+
privatestaticfinalStringMALFORMED_PASSWORD_ENCODER_PREFIX = "The name of the password encoder is improperly formatted or incomplete. The format should be '{ENCODER}password'.";
78
+
73
79
@BeforeEach
74
80
publicvoidsetup() {
75
81
this.delegates = newHashMap<>();
@@ -195,31 +201,31 @@ public void matchesWhenNoopThenDelegatesToNoop() {
0 commit comments