parent
ad3717d51c
commit
4a57348a6d
@ -0,0 +1,16 @@
|
||||
package org.opsli.common.constants;
|
||||
|
||||
/**
|
||||
* @Author: 周鹏程
|
||||
* @CreateTime: 2020-09-16 17:42
|
||||
* @Description: Token类型
|
||||
*/
|
||||
public interface TokenTypeConstants {
|
||||
|
||||
/** 系统内部TOKEN */
|
||||
String TYPE_SYSTEM = "system";
|
||||
|
||||
/** 外部TOKEN */
|
||||
String TYPE_EXTERNAL = "external";
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package org.opsli.core.security.shiro.realm;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.opsli.common.exception.TokenException;
|
||||
import org.opsli.core.security.shiro.token.ExternalToken;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 对外接口 认证
|
||||
*
|
||||
* @author 周鹏程
|
||||
|
||||
* @date 2020-12-29 14:00
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ExternalRealm extends AuthorizingRealm implements FlagRealm {
|
||||
|
||||
/** 账号锁定状态 */
|
||||
public static final char LOCK_VAL = '1';
|
||||
|
||||
@Override
|
||||
public boolean supports(AuthenticationToken token) {
|
||||
return token instanceof ExternalToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* 授权(验证权限时调用)
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||
// TODO 待处理
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对外认证(登录时调用)
|
||||
*/
|
||||
@Override
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
|
||||
throws AuthenticationException, TokenException {
|
||||
// TODO 待处理
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.opsli.core.security.shiro.realm;
|
||||
|
||||
/**
|
||||
* @BelongsProject: think-bboss-parent
|
||||
* @BelongsPackage: com.think.bboss.core.shiro.realm
|
||||
* @Author: Parker
|
||||
* @CreateTime: 2020-12-29 20:10
|
||||
* @Description: Realm 识别类 勿删
|
||||
*/
|
||||
public interface FlagRealm {
|
||||
}
|
Loading…
Reference in new issue