17 changed files with 656 additions and 12 deletions
@ -0,0 +1,66 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.common.core.utils.SpringUtils; |
|||
import com.bnyer.common.security.service.CreatorTokenService; |
|||
import com.bnyer.common.security.service.TiktokUserTokenService; |
|||
import com.bnyer.img.api.model.LoginCreator; |
|||
import com.bnyer.img.api.model.LoginTiktokUser; |
|||
|
|||
/** |
|||
* 艺术家Token 权限验证,逻辑实现类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class CreatorAuthLogic |
|||
{ |
|||
|
|||
public CreatorTokenService tokenService = SpringUtils.getBean(CreatorTokenService.class); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
*/ |
|||
public void logoutByToken(String token) |
|||
{ |
|||
tokenService.delLoginCreator(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前用户缓存信息, 如果未登录,则抛出异常 |
|||
* |
|||
* @param token 前端传递的认证信息 |
|||
* @return 用户缓存信息 |
|||
*/ |
|||
public LoginCreator getLoginUser(String token) |
|||
{ |
|||
return tokenService.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
|||
* |
|||
* @param loginCreator 当前用户信息 |
|||
*/ |
|||
public void verifyLoginUserExpire(LoginCreator loginCreator) |
|||
{ |
|||
tokenService.verifyToken(loginCreator); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.img.api.model.LoginCreator; |
|||
|
|||
/** |
|||
* 抖音Token 权限验证工具类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class CreatorAuthUtil |
|||
{ |
|||
/** |
|||
* 底层的 AuthLogic 对象 |
|||
*/ |
|||
public static CreatorAuthLogic authLogic = new CreatorAuthLogic(); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
* |
|||
* @param token 指定token |
|||
*/ |
|||
public static void logoutByToken(String token) |
|||
{ |
|||
authLogic.logoutByToken(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前登录用户信息 |
|||
*/ |
|||
public static LoginCreator getLoginUser(String token) |
|||
{ |
|||
return authLogic.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期 |
|||
*/ |
|||
public static void verifyLoginUserExpire(LoginCreator loginCreator) |
|||
{ |
|||
authLogic.verifyLoginUserExpire(loginCreator); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.common.core.utils.SpringUtils; |
|||
import com.bnyer.common.security.service.FhUserTokenService; |
|||
import com.bnyer.img.api.model.LoginFhUser; |
|||
|
|||
/** |
|||
* 快手Token 权限验证,逻辑实现类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class FhAuthLogic |
|||
{ |
|||
|
|||
public FhUserTokenService tokenService = SpringUtils.getBean(FhUserTokenService.class); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
*/ |
|||
public void logoutByToken(String token) |
|||
{ |
|||
tokenService.delLoginFhUser(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前用户缓存信息, 如果未登录,则抛出异常 |
|||
* |
|||
* @param token 前端传递的认证信息 |
|||
* @return 用户缓存信息 |
|||
*/ |
|||
public LoginFhUser getLoginUser(String token) |
|||
{ |
|||
return tokenService.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
|||
* |
|||
* @param loginFhUser 当前用户信息 |
|||
*/ |
|||
public void verifyLoginUserExpire(LoginFhUser loginFhUser) |
|||
{ |
|||
tokenService.verifyToken(loginFhUser); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.img.api.model.LoginFhUser; |
|||
|
|||
/** |
|||
* 快手Token 权限验证工具类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class FhAuthUtil |
|||
{ |
|||
/** |
|||
* 底层的 AuthLogic 对象 |
|||
*/ |
|||
public static FhAuthLogic authLogic = new FhAuthLogic(); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
* |
|||
* @param token 指定token |
|||
*/ |
|||
public static void logoutByToken(String token) |
|||
{ |
|||
authLogic.logoutByToken(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前登录用户信息 |
|||
*/ |
|||
public static LoginFhUser getLoginUser(String token) |
|||
{ |
|||
return authLogic.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期 |
|||
*/ |
|||
public static void verifyLoginUserExpire(LoginFhUser loginFhUser) |
|||
{ |
|||
authLogic.verifyLoginUserExpire(loginFhUser); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.common.core.utils.SpringUtils; |
|||
import com.bnyer.common.security.service.TiktokUserTokenService; |
|||
import com.bnyer.img.api.model.LoginTiktokUser; |
|||
|
|||
/** |
|||
* 抖音Token 权限验证,逻辑实现类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class TiktokAuthLogic |
|||
{ |
|||
|
|||
public TiktokUserTokenService tokenService = SpringUtils.getBean(TiktokUserTokenService.class); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
*/ |
|||
public void logoutByToken(String token) |
|||
{ |
|||
tokenService.delLoginTiktokUser(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前用户缓存信息, 如果未登录,则抛出异常 |
|||
* |
|||
* @param token 前端传递的认证信息 |
|||
* @return 用户缓存信息 |
|||
*/ |
|||
public LoginTiktokUser getLoginUser(String token) |
|||
{ |
|||
return tokenService.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
|||
* |
|||
* @param loginTiktokUser 当前用户信息 |
|||
*/ |
|||
public void verifyLoginUserExpire(LoginTiktokUser loginTiktokUser) |
|||
{ |
|||
tokenService.verifyToken(loginTiktokUser); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.img.api.model.LoginTiktokUser; |
|||
|
|||
/** |
|||
* 抖音Token 权限验证工具类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class TiktokAuthUtil |
|||
{ |
|||
/** |
|||
* 底层的 AuthLogic 对象 |
|||
*/ |
|||
public static TiktokAuthLogic authLogic = new TiktokAuthLogic(); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
* |
|||
* @param token 指定token |
|||
*/ |
|||
public static void logoutByToken(String token) |
|||
{ |
|||
authLogic.logoutByToken(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前登录用户信息 |
|||
*/ |
|||
public static LoginTiktokUser getLoginUser(String token) |
|||
{ |
|||
return authLogic.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期 |
|||
*/ |
|||
public static void verifyLoginUserExpire(LoginTiktokUser loginTiktokUser) |
|||
{ |
|||
authLogic.verifyLoginUserExpire(loginTiktokUser); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.common.core.utils.SpringUtils; |
|||
import com.bnyer.common.security.service.TiktokUserTokenService; |
|||
import com.bnyer.common.security.service.WxUserTokenService; |
|||
import com.bnyer.img.api.model.LoginTiktokUser; |
|||
import com.bnyer.img.api.model.LoginWechatUser; |
|||
|
|||
/** |
|||
* 微信Token 权限验证,逻辑实现类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class WechatAuthLogic |
|||
{ |
|||
|
|||
public WxUserTokenService tokenService = SpringUtils.getBean(WxUserTokenService.class); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
*/ |
|||
public void logoutByToken(String token) |
|||
{ |
|||
tokenService.delLoginWechatUser(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前用户缓存信息, 如果未登录,则抛出异常 |
|||
* |
|||
* @param token 前端传递的认证信息 |
|||
* @return 用户缓存信息 |
|||
*/ |
|||
public LoginWechatUser getLoginUser(String token) |
|||
{ |
|||
return tokenService.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期, 如果相差不足120分钟,自动刷新缓存 |
|||
* |
|||
* @param loginWechatUser 当前用户信息 |
|||
*/ |
|||
public void verifyLoginUserExpire(LoginWechatUser loginWechatUser) |
|||
{ |
|||
tokenService.verifyToken(loginWechatUser); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.bnyer.common.security.auth; |
|||
|
|||
import com.bnyer.img.api.model.LoginWechatUser; |
|||
|
|||
/** |
|||
* 微信Token 权限验证工具类 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
public class WechatAuthUtil |
|||
{ |
|||
/** |
|||
* 底层的 AuthLogic 对象 |
|||
*/ |
|||
public static WechatAuthLogic authLogic = new WechatAuthLogic(); |
|||
|
|||
|
|||
/** |
|||
* 会话注销,根据指定Token |
|||
* |
|||
* @param token 指定token |
|||
*/ |
|||
public static void logoutByToken(String token) |
|||
{ |
|||
authLogic.logoutByToken(token); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取当前登录用户信息 |
|||
*/ |
|||
public static LoginWechatUser getLoginUser(String token) |
|||
{ |
|||
return authLogic.getLoginUser(token); |
|||
} |
|||
|
|||
/** |
|||
* 验证当前用户有效期 |
|||
*/ |
|||
public static void verifyLoginUserExpire(LoginWechatUser loginWechatUser) |
|||
{ |
|||
authLogic.verifyLoginUserExpire(loginWechatUser); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue