-
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.
🔨 fix(captcha): corrected method calls in CaptchaController and Captc…
…haFilter
- Loading branch information
Showing
3 changed files
with
15 additions
and
22 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
30 changes: 12 additions & 18 deletions
30
boot/platform/src/main/java/com/platform/boot/security/core/captcha/CaptchaToken.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,28 +1,22 @@ | ||
package com.platform.boot.security.core.captcha; | ||
|
||
import lombok.Data; | ||
import org.springframework.util.Assert; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* captcha token entity class | ||
* | ||
* @param headerName http captcha header name | ||
* @param parameterName http captcha parameter name | ||
* @param captcha captcha | ||
* @author <a href="https://github.com/vnobo">Alex bob</a> | ||
*/ | ||
@Data(staticConstructor = "of") | ||
public class CaptchaToken implements Serializable { | ||
/** | ||
* http captcha header name | ||
*/ | ||
private final String headerName; | ||
public record CaptchaToken(String headerName, String parameterName, String captcha) implements Serializable { | ||
public static CaptchaToken of(String headerName, String parameterName, String captcha) { | ||
return new CaptchaToken(headerName, parameterName, captcha); | ||
} | ||
|
||
/** | ||
* http captcha parameter name | ||
*/ | ||
private final String parameterName; | ||
|
||
/** | ||
* captcha | ||
*/ | ||
private final String captcha; | ||
public Boolean validate(String code) { | ||
Assert.notNull(code, "captcha code must not be null"); | ||
return this.captcha.equalsIgnoreCase(code); | ||
} | ||
} |
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