public interface CodeProcessor
Modifier and Type | Method and Description |
---|---|
ValidateCode |
create(org.springframework.web.context.request.ServletWebRequest request,
CodeType codeType)
创建校验码并发送验证码
|
ValidateCode |
create(org.springframework.web.context.request.ServletWebRequest request,
String key,
CodeType codeType)
创建校验码并发送验证码
|
void |
validate(org.springframework.web.context.request.ServletWebRequest request,
CodeType codeType)
校验用户请求中携带的验证码是否正确
|
void |
validate(String key,
String codeInRequest)
根据验证码的唯一标识符判断给定的验证码是否正确
|
ValidateCode create(org.springframework.web.context.request.ServletWebRequest request, CodeType codeType) throws com.yishuifengxiao.common.tool.exception.ValidateException
request
- 用户请求codeType
- 验证码的类型com.yishuifengxiao.common.tool.exception.ValidateException
- 创建或发送验证码时出现问题ValidateCode create(org.springframework.web.context.request.ServletWebRequest request, String key, CodeType codeType) throws com.yishuifengxiao.common.tool.exception.ValidateException
创建校验码并发送验证码
生成验证码存储时的key的含义如下:request
- 用户请求key
- 验证码的发送目标codeType
- 验证码的类型com.yishuifengxiao.common.tool.exception.ValidateException
- 创建或发送验证码时出现问题void validate(org.springframework.web.context.request.ServletWebRequest request, CodeType codeType) throws com.yishuifengxiao.common.tool.exception.ValidateException
校验用户请求中携带的验证码是否正确
在验证码不匹配时会抛出异常,主要异常场景有:request
- 用户请求codeType
- 验证码类型com.yishuifengxiao.common.tool.exception.ValidateException
- 验证码不匹配或已过期等未通过验证时void validate(String key, String codeInRequest) throws com.yishuifengxiao.common.tool.exception.ValidateException
根据验证码的唯一标识符判断给定的验证码是否正确
在验证码不匹配时会抛出异常,主要异常场景有:key
- 验证码的唯一标识符codeInRequest
- 给定的验证码com.yishuifengxiao.common.tool.exception.ValidateException
- 验证码不匹配或已过期等未通过验证时Copyright © 2021. All rights reserved.