From 700bcda604761a0fa51044ca8f0c945df3354fc4 Mon Sep 17 00:00:00 2001 From: wwan13 Date: Wed, 26 Jun 2024 00:04:58 +0900 Subject: [PATCH 1/2] fix : enable overriding tokenDecoder as bean --- .../java/io/wwan13/wintersecurity/config/JwtConfiguration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/wwan13/wintersecurity/config/JwtConfiguration.java b/src/main/java/io/wwan13/wintersecurity/config/JwtConfiguration.java index 045a239..b81fa55 100644 --- a/src/main/java/io/wwan13/wintersecurity/config/JwtConfiguration.java +++ b/src/main/java/io/wwan13/wintersecurity/config/JwtConfiguration.java @@ -29,6 +29,7 @@ import io.wwan13.wintersecurity.jwt.provider.JwtTokenDecoder; import io.wwan13.wintersecurity.jwt.provider.JwtTokenGenerator; import io.wwan13.wintersecurity.secretkey.SecretKey; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; public class JwtConfiguration { @@ -43,6 +44,7 @@ public TokenGenerator tokenGenerator( } @Bean + @ConditionalOnMissingBean(TokenDecoder.class) public TokenDecoder tokenDecoder(SecretKey secretKey) { return new JwtTokenDecoder(secretKey); } From a06679b47895f1c7b60c577ec94092455b4ee762 Mon Sep 17 00:00:00 2001 From: wwan13 Date: Wed, 26 Jun 2024 00:08:30 +0900 Subject: [PATCH 2/2] feat : Provide passwordEncoder as bean --- .../config/AuthConfiguration.java | 3 +-- .../passwordencoder/PasswordEncoder.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 src/main/java/io/wwan13/wintersecurity/passwordencoder/PasswordEncoder.java diff --git a/src/main/java/io/wwan13/wintersecurity/config/AuthConfiguration.java b/src/main/java/io/wwan13/wintersecurity/config/AuthConfiguration.java index 502682e..275ead8 100644 --- a/src/main/java/io/wwan13/wintersecurity/config/AuthConfiguration.java +++ b/src/main/java/io/wwan13/wintersecurity/config/AuthConfiguration.java @@ -28,7 +28,6 @@ import io.wwan13.wintersecurity.secretkey.SecretKey; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; public class AuthConfiguration { @@ -64,6 +63,6 @@ public AbstractInterceptorAuthProcessor authProcessor( @Bean public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); + return new io.wwan13.wintersecurity.passwordencoder.PasswordEncoder(); } } diff --git a/src/main/java/io/wwan13/wintersecurity/passwordencoder/PasswordEncoder.java b/src/main/java/io/wwan13/wintersecurity/passwordencoder/PasswordEncoder.java new file mode 100644 index 0000000..346095a --- /dev/null +++ b/src/main/java/io/wwan13/wintersecurity/passwordencoder/PasswordEncoder.java @@ -0,0 +1,22 @@ +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.wwan13.wintersecurity.passwordencoder; + +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +public class PasswordEncoder extends BCryptPasswordEncoder { +}