Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : PasswordEncoder providing error #38

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading