-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#82 fix : Jwt PasswordEncoder Bean 등록
- Loading branch information
Showing
6 changed files
with
42 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
src/main/java/com/seoultech/synergybe/domain/common/CustomPasswordEncoder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package com.seoultech.synergybe.domain.common; | ||
|
||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
import org.springframework.stereotype.Component; | ||
public interface CustomPasswordEncoder{ | ||
String encodePassword(String rawPassword); | ||
|
||
@Component | ||
public class CustomPasswordEncoder extends BCryptPasswordEncoder { | ||
boolean matchesPassword(String rawPassword, String encodedPassword); | ||
|
||
boolean noneMatchesPassword(String rawPassword, String encodedPassword); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/com/seoultech/synergybe/system/security/BCryptCustomPasswordEncoder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.seoultech.synergybe.system.security; | ||
|
||
import com.seoultech.synergybe.domain.common.CustomPasswordEncoder; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
|
||
@RequiredArgsConstructor | ||
public class BCryptCustomPasswordEncoder implements CustomPasswordEncoder { | ||
|
||
private final BCryptPasswordEncoder passwordEncoder; | ||
|
||
@Override | ||
public String encodePassword(String rawPassword) { | ||
return passwordEncoder.encode(rawPassword); | ||
} | ||
|
||
@Override | ||
public boolean matchesPassword(String rawPassword, String encodedPassword) { | ||
return passwordEncoder.matches(rawPassword, encodedPassword); | ||
} | ||
|
||
@Override | ||
public boolean noneMatchesPassword(String rawPassword, String encodedPassword) { | ||
return !matchesPassword(rawPassword, encodedPassword); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters