File tree 18 files changed +36
-34
lines changed
main/java/org/springframework/security/config/annotation
authentication/configuration
test/java/org/springframework/security/config/annotation/web
main/java/org/springframework/security/authentication
test/java/org/springframework/security/authentication
main/java/org/springframework/security/web/authentication/password
test/java/org/springframework/security/web/authentication/password
18 files changed +36
-34
lines changed Original file line number Diff line number Diff line change 20
20
import org .springframework .core .Ordered ;
21
21
import org .springframework .core .annotation .Order ;
22
22
import org .springframework .security .authentication .dao .DaoAuthenticationProvider ;
23
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
23
24
import org .springframework .security .config .annotation .authentication .builders .AuthenticationManagerBuilder ;
24
- import org .springframework .security .core .password .CompromisedPasswordChecker ;
25
25
import org .springframework .security .core .userdetails .UserDetailsPasswordService ;
26
26
import org .springframework .security .core .userdetails .UserDetailsService ;
27
27
import org .springframework .security .crypto .password .PasswordEncoder ;
Original file line number Diff line number Diff line change 32
32
import org .springframework .security .authentication .ObservationReactiveAuthenticationManager ;
33
33
import org .springframework .security .authentication .ReactiveAuthenticationManager ;
34
34
import org .springframework .security .authentication .UserDetailsRepositoryReactiveAuthenticationManager ;
35
+ import org .springframework .security .authentication .password .ReactiveCompromisedPasswordChecker ;
35
36
import org .springframework .security .config .web .server .ServerHttpSecurity ;
36
- import org .springframework .security .core .password .ReactiveCompromisedPasswordChecker ;
37
37
import org .springframework .security .core .userdetails .ReactiveUserDetailsPasswordService ;
38
38
import org .springframework .security .core .userdetails .ReactiveUserDetailsService ;
39
39
import org .springframework .security .crypto .password .PasswordEncoder ;
Original file line number Diff line number Diff line change 47
47
import org .springframework .security .authentication .event .AbstractAuthenticationEvent ;
48
48
import org .springframework .security .authentication .event .AbstractAuthenticationFailureEvent ;
49
49
import org .springframework .security .authentication .event .AuthenticationSuccessEvent ;
50
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
51
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
52
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
50
53
import org .springframework .security .config .Customizer ;
51
54
import org .springframework .security .config .annotation .SecurityContextChangedListenerConfig ;
52
55
import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
58
61
import org .springframework .security .core .Authentication ;
59
62
import org .springframework .security .core .AuthenticationException ;
60
63
import org .springframework .security .core .context .SecurityContextHolderStrategy ;
61
- import org .springframework .security .core .password .CompromisedPasswordCheckResult ;
62
- import org .springframework .security .core .password .CompromisedPasswordChecker ;
63
- import org .springframework .security .core .password .CompromisedPasswordException ;
64
64
import org .springframework .security .core .userdetails .User ;
65
65
import org .springframework .security .core .userdetails .UserDetails ;
66
66
import org .springframework .security .provisioning .InMemoryUserDetailsManager ;
Original file line number Diff line number Diff line change 26
26
import org .springframework .context .ApplicationContext ;
27
27
import org .springframework .context .annotation .Bean ;
28
28
import org .springframework .context .annotation .Configuration ;
29
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
30
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
31
+ import org .springframework .security .authentication .password .ReactiveCompromisedPasswordChecker ;
29
32
import org .springframework .security .config .Customizer ;
30
33
import org .springframework .security .config .test .SpringTestContext ;
31
34
import org .springframework .security .config .test .SpringTestContextExtension ;
32
35
import org .springframework .security .config .users .ReactiveAuthenticationTestConfiguration ;
33
36
import org .springframework .security .config .web .server .ServerHttpSecurity ;
34
- import org .springframework .security .core .password .CompromisedPasswordCheckResult ;
35
- import org .springframework .security .core .password .CompromisedPasswordException ;
36
- import org .springframework .security .core .password .ReactiveCompromisedPasswordChecker ;
37
37
import org .springframework .security .core .userdetails .MapReactiveUserDetailsService ;
38
38
import org .springframework .security .core .userdetails .PasswordEncodedUser ;
39
39
import org .springframework .security .core .userdetails .User ;
Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ dependencies {
18
18
optional ' org.aspectj:aspectjrt'
19
19
optional ' org.springframework:spring-jdbc'
20
20
optional ' org.springframework:spring-tx'
21
- optional ' org.springframework:spring-web'
22
- optional ' org.springframework:spring-webflux'
23
21
optional ' org.jetbrains.kotlinx:kotlinx-coroutines-reactor'
24
22
25
23
testImplementation ' commons-collections:commons-collections'
@@ -33,7 +31,6 @@ dependencies {
33
31
testImplementation " org.springframework:spring-test"
34
32
testImplementation ' org.skyscreamer:jsonassert'
35
33
testImplementation ' org.springframework:spring-test'
36
- testImplementation ' com.squareup.okhttp3:mockwebserver'
37
34
38
35
testRuntimeOnly ' org.hsqldb:hsqldb'
39
36
}
Original file line number Diff line number Diff line change 25
25
import org .springframework .context .MessageSource ;
26
26
import org .springframework .context .MessageSourceAware ;
27
27
import org .springframework .context .support .MessageSourceAccessor ;
28
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
29
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
30
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
31
+ import org .springframework .security .authentication .password .ReactiveCompromisedPasswordChecker ;
28
32
import org .springframework .security .core .Authentication ;
29
33
import org .springframework .security .core .SpringSecurityMessageSource ;
30
- import org .springframework .security .core .password .CompromisedPasswordCheckResult ;
31
- import org .springframework .security .core .password .CompromisedPasswordChecker ;
32
- import org .springframework .security .core .password .CompromisedPasswordException ;
33
- import org .springframework .security .core .password .ReactiveCompromisedPasswordChecker ;
34
34
import org .springframework .security .core .userdetails .ReactiveUserDetailsPasswordService ;
35
35
import org .springframework .security .core .userdetails .UserDetails ;
36
36
import org .springframework .security .core .userdetails .UserDetailsChecker ;
Original file line number Diff line number Diff line change 20
20
import org .springframework .security .authentication .BadCredentialsException ;
21
21
import org .springframework .security .authentication .InternalAuthenticationServiceException ;
22
22
import org .springframework .security .authentication .UsernamePasswordAuthenticationToken ;
23
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
24
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
23
25
import org .springframework .security .core .Authentication ;
24
26
import org .springframework .security .core .AuthenticationException ;
25
- import org .springframework .security .core .password .CompromisedPasswordChecker ;
26
- import org .springframework .security .core .password .CompromisedPasswordException ;
27
27
import org .springframework .security .core .userdetails .UserDetails ;
28
28
import org .springframework .security .core .userdetails .UserDetailsPasswordService ;
29
29
import org .springframework .security .core .userdetails .UserDetailsService ;
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .authentication .password ;
18
18
19
19
public class CompromisedPasswordCheckResult {
20
20
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .authentication .password ;
18
18
19
19
import org .springframework .lang .NonNull ;
20
20
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .authentication .password ;
18
18
19
19
import org .springframework .security .core .AuthenticationException ;
20
20
23
23
*
24
24
* @author Marcus da Coregio
25
25
* @since 6.3
26
- * @see HaveIBeenPwnedRestApiPasswordChecker
27
26
*/
28
27
public class CompromisedPasswordException extends AuthenticationException {
29
28
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .authentication .password ;
18
18
19
19
import reactor .core .publisher .Mono ;
20
20
Original file line number Diff line number Diff line change 27
27
import reactor .test .StepVerifier ;
28
28
29
29
import org .springframework .context .MessageSource ;
30
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
31
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
32
+ import org .springframework .security .authentication .password .ReactiveCompromisedPasswordChecker ;
30
33
import org .springframework .security .core .Authentication ;
31
- import org .springframework .security .core .password .CompromisedPasswordCheckResult ;
32
- import org .springframework .security .core .password .CompromisedPasswordException ;
33
- import org .springframework .security .core .password .ReactiveCompromisedPasswordChecker ;
34
34
import org .springframework .security .core .userdetails .ReactiveUserDetailsPasswordService ;
35
35
import org .springframework .security .core .userdetails .ReactiveUserDetailsService ;
36
36
import org .springframework .security .core .userdetails .User ;
Original file line number Diff line number Diff line change 33
33
import org .springframework .security .authentication .LockedException ;
34
34
import org .springframework .security .authentication .TestingAuthenticationToken ;
35
35
import org .springframework .security .authentication .UsernamePasswordAuthenticationToken ;
36
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
37
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
38
+ import org .springframework .security .authentication .password .CompromisedPasswordException ;
36
39
import org .springframework .security .core .Authentication ;
37
40
import org .springframework .security .core .GrantedAuthority ;
38
41
import org .springframework .security .core .authority .AuthorityUtils ;
39
- import org .springframework .security .core .password .CompromisedPasswordCheckResult ;
40
- import org .springframework .security .core .password .CompromisedPasswordChecker ;
41
- import org .springframework .security .core .password .CompromisedPasswordException ;
42
42
import org .springframework .security .core .userdetails .PasswordEncodedUser ;
43
43
import org .springframework .security .core .userdetails .User ;
44
44
import org .springframework .security .core .userdetails .UserDetails ;
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ dependencies {
36
36
testImplementation " org.mockito:mockito-core"
37
37
testImplementation " org.mockito:mockito-junit-jupiter"
38
38
testImplementation " org.springframework:spring-test"
39
+ testImplementation ' com.squareup.okhttp3:mockwebserver'
39
40
40
41
testRuntimeOnly ' org.hsqldb:hsqldb'
41
42
}
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .web . authentication .password ;
18
18
19
19
import java .nio .charset .StandardCharsets ;
20
20
import java .security .MessageDigest ;
24
24
25
25
import org .apache .commons .logging .Log ;
26
26
import org .apache .commons .logging .LogFactory ;
27
- import org .jetbrains .annotations .NotNull ;
28
27
28
+ import org .springframework .lang .NonNull ;
29
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
30
+ import org .springframework .security .authentication .password .CompromisedPasswordChecker ;
29
31
import org .springframework .security .crypto .codec .Hex ;
30
32
import org .springframework .util .Assert ;
31
33
import org .springframework .util .StringUtils ;
@@ -58,7 +60,7 @@ public HaveIBeenPwnedRestApiPasswordChecker() {
58
60
}
59
61
60
62
@ Override
61
- @ NotNull
63
+ @ NonNull
62
64
public CompromisedPasswordCheckResult check (String password ) {
63
65
byte [] hash = this .sha1Digest .digest (password .getBytes (StandardCharsets .UTF_8 ));
64
66
String encoded = new String (Hex .encode (hash )).toUpperCase ();
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .web . authentication .password ;
18
18
19
19
import java .nio .charset .StandardCharsets ;
20
20
import java .security .MessageDigest ;
26
26
import reactor .core .publisher .Mono ;
27
27
import reactor .core .scheduler .Schedulers ;
28
28
29
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
30
+ import org .springframework .security .authentication .password .ReactiveCompromisedPasswordChecker ;
29
31
import org .springframework .security .crypto .codec .Hex ;
30
32
import org .springframework .util .Assert ;
31
33
import org .springframework .util .StringUtils ;
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .web . authentication .password ;
18
18
19
19
import java .io .IOException ;
20
20
25
25
import org .junit .jupiter .api .BeforeEach ;
26
26
import org .junit .jupiter .api .Test ;
27
27
28
+ import org .springframework .security .authentication .password .CompromisedPasswordCheckResult ;
28
29
import org .springframework .web .client .RestClient ;
29
30
30
31
import static org .assertj .core .api .Assertions .assertThat ;
Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
17
- package org .springframework .security .core .password ;
17
+ package org .springframework .security .web . authentication .password ;
18
18
19
19
import java .io .IOException ;
20
20
You can’t perform that action at this time.
0 commit comments