|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2021 the original author or authors. |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -37,6 +37,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; |
|
|
|
* @author Rob Winch |
|
|
|
* @author Rob Winch |
|
|
|
* @author Michael Simons |
|
|
|
* @author Michael Simons |
|
|
|
* @author heowc |
|
|
|
* @author heowc |
|
|
|
|
|
|
|
* @author Jihoon Cha |
|
|
|
* @since 5.0 |
|
|
|
* @since 5.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
@ExtendWith(MockitoExtension.class) |
|
|
|
@ -119,9 +120,9 @@ public class DelegatingPasswordEncoderTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void constructorWhenIdContainsPrefixThenIllegalArgumentException() { |
|
|
|
public void constructorWhenIdContainsPrefixThenIllegalArgumentException() { |
|
|
|
this.delegates.put('$' + this.bcryptId, this.bcrypt); |
|
|
|
this.delegates.put('{' + this.bcryptId, this.bcrypt); |
|
|
|
assertThatIllegalArgumentException() |
|
|
|
assertThatIllegalArgumentException() |
|
|
|
.isThrownBy(() -> new DelegatingPasswordEncoder(this.bcryptId, this.delegates, "$", "$")); |
|
|
|
.isThrownBy(() -> new DelegatingPasswordEncoder(this.bcryptId, this.delegates)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@ -131,6 +132,12 @@ public class DelegatingPasswordEncoderTests { |
|
|
|
.isThrownBy(() -> new DelegatingPasswordEncoder(this.bcryptId, this.delegates, "", "$")); |
|
|
|
.isThrownBy(() -> new DelegatingPasswordEncoder(this.bcryptId, this.delegates, "", "$")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void constructorWhenPrefixContainsSuffixThenIllegalArgumentException() { |
|
|
|
|
|
|
|
assertThatIllegalArgumentException() |
|
|
|
|
|
|
|
.isThrownBy(() -> new DelegatingPasswordEncoder(this.bcryptId, this.delegates, "$", "$")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void setDefaultPasswordEncoderForMatchesWhenNullThenIllegalArgumentException() { |
|
|
|
public void setDefaultPasswordEncoderForMatchesWhenNullThenIllegalArgumentException() { |
|
|
|
assertThatIllegalArgumentException() |
|
|
|
assertThatIllegalArgumentException() |
|
|
|
|