Skip to content

Commit

Permalink
Merge pull request #38 from wwan13/feature/refactor
Browse files Browse the repository at this point in the history
fix : PasswordEncoder providing error
  • Loading branch information
wwan13 authored Jun 26, 2024
2 parents c2451f2 + 2040bac commit 001a995
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
import io.wwan13.wintersecurity.auth.provider.HttpRequestAccessManager;
import io.wwan13.wintersecurity.jwt.TokenDecoder;
import io.wwan13.wintersecurity.jwt.provider.JwtTokenDecoder;
import io.wwan13.wintersecurity.passwordencoder.PasswordEncoder;
import io.wwan13.wintersecurity.secretkey.SecretKey;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class AuthConfiguration {

Expand Down Expand Up @@ -63,6 +64,6 @@ public AbstractInterceptorAuthProcessor authProcessor(

@Bean
public PasswordEncoder passwordEncoder() {
return new io.wwan13.wintersecurity.passwordencoder.PasswordEncoder();
return new PasswordEncoder(new BCryptPasswordEncoder());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,23 @@

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class PasswordEncoder extends BCryptPasswordEncoder {
public class PasswordEncoder {

private final BCryptPasswordEncoder bCryptPasswordEncoder;

public PasswordEncoder(BCryptPasswordEncoder bCryptPasswordEncoder) {
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}

public String encode(CharSequence rawPassword) {
return bCryptPasswordEncoder.encode(rawPassword);
}

public boolean matches(CharSequence rawPassword, String encodedPassword) {
return bCryptPasswordEncoder.matches(rawPassword, encodedPassword);
}

public boolean upgradeEncoding(String encodedPassword) {
return bCryptPasswordEncoder.upgradeEncoding(encodedPassword);
}
}

0 comments on commit 001a995

Please sign in to comment.