8 changed files with 163 additions and 22 deletions
@ -0,0 +1,30 @@ |
|||
package com.zdxt.auth.framework.shiro.nopaddword; |
|||
|
|||
/** |
|||
* @Author: kylin |
|||
* @Date: 2024/4/28 10:51 上午 |
|||
* @Version: 1.0 |
|||
* @Desc: 登录类型枚举类 |
|||
*/ |
|||
public enum LoginType { |
|||
/** |
|||
* 密码登录 |
|||
*/ |
|||
PASSWORD("password"), |
|||
/** |
|||
* 免密码登录 |
|||
*/ |
|||
NOPASSWD("nopasswd"); |
|||
|
|||
private String desc; |
|||
|
|||
LoginType(String desc) |
|||
{ |
|||
this.desc = desc; |
|||
} |
|||
|
|||
public String getDesc() |
|||
{ |
|||
return desc; |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package com.zdxt.auth.framework.shiro.nopaddword; |
|||
|
|||
import org.apache.shiro.authc.UsernamePasswordToken; |
|||
|
|||
/** |
|||
* @Author: kylin |
|||
* @Date: 2024/4/28 10:52 上午 |
|||
* @Version: 1.0 |
|||
* @Desc: 自定义登录Token |
|||
*/ |
|||
public class UserToken extends UsernamePasswordToken |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private LoginType type; |
|||
|
|||
public UserToken() |
|||
{ |
|||
} |
|||
|
|||
public UserToken(String username, String password, LoginType type, boolean rememberMe) |
|||
{ |
|||
super(username, password, rememberMe); |
|||
this.type = type; |
|||
} |
|||
|
|||
public UserToken(String username, LoginType type) |
|||
{ |
|||
super(username, "", false, null); |
|||
this.type = type; |
|||
} |
|||
|
|||
public UserToken(String username, String password, LoginType type) |
|||
{ |
|||
super(username, password, false, null); |
|||
this.type = type; |
|||
} |
|||
|
|||
public LoginType getType() |
|||
{ |
|||
return type; |
|||
} |
|||
|
|||
public void setType(LoginType type) |
|||
{ |
|||
this.type = type; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue