Search in sources :

Example 6 with ExitStatus

use of org.springframework.boot.cli.command.status.ExitStatus in project spring-boot by spring-projects.

the class EncodePasswordCommandTests method encodeWithPbkdf2ShouldUsePbkdf2.

@Test
void encodeWithPbkdf2ShouldUsePbkdf2() throws Exception {
    EncodePasswordCommand command = new EncodePasswordCommand();
    ExitStatus status = command.run("-a", "pbkdf2", "boot");
    then(this.log).should().info(this.message.capture());
    assertThat(this.message.getValue()).doesNotStartWith("{");
    assertThat(new Pbkdf2PasswordEncoder().matches("boot", this.message.getValue())).isTrue();
    assertThat(status).isEqualTo(ExitStatus.OK);
}
Also used : ExitStatus(org.springframework.boot.cli.command.status.ExitStatus) Pbkdf2PasswordEncoder(org.springframework.security.crypto.password.Pbkdf2PasswordEncoder) Test(org.junit.jupiter.api.Test)

Aggregations

ExitStatus (org.springframework.boot.cli.command.status.ExitStatus)6 Test (org.junit.jupiter.api.Test)4 RunProcess (org.springframework.boot.loader.tools.RunProcess)1 BCryptPasswordEncoder (org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder)1 Pbkdf2PasswordEncoder (org.springframework.security.crypto.password.Pbkdf2PasswordEncoder)1