Package club.zhcs.lina.auth.service
Class HttpServletAuthService
java.lang.Object
club.zhcs.lina.auth.service.HttpServletAuthService
- All Implemented Interfaces:
AuthService
- Direct Known Subclasses:
DefaultAuthService
- Author:
- Kerbores(kerbores@riemann.tech)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid添加cookiebooleanauthentication(List<String> withoutAuthenticationUrlRegulars) 鉴权认证头keyabstract CookieSettingscookie 设置abstract jakarta.servlet.http.HttpServletRequestabstract jakarta.servlet.http.HttpServletResponseabstract JWTDecoderabstract JWTEncoder用户登录voidlogout()登出尝试获取当前用户boolean获取 refresh tokenrefreshToken(String subject) 生成refreshTokenrefresh token key ,可以接受从header/cookie和请求参数传入booleanskip()根据token获取subject信息token()获取token生成tokentokenKey()token key ,可以接受从header/cookie和请求参数传入tryRefreshToken(String refreshToken) user()获取当前登录用户abstract UserDetailServiceuserName()获取用户名Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface club.zhcs.lina.auth.service.AuthService
permissions, roles
-
Field Details
-
TOKEN_EXPIRED
- See Also:
-
-
Constructor Details
-
HttpServletAuthService
public HttpServletAuthService()
-
-
Method Details
-
getRequest
public abstract jakarta.servlet.http.HttpServletRequest getRequest() -
getResponse
public abstract jakarta.servlet.http.HttpServletResponse getResponse() -
userDetailService
-
jwtEncoder
-
jwtDecoder
-
cookieSettings
cookie 设置- Returns:
-
subject
Description copied from interface:AuthService根据token获取subject信息- Specified by:
subjectin interfaceAuthService- Parameters:
token-- Returns:
- See Also:
-
token
Description copied from interface:AuthService生成token- Specified by:
tokenin interfaceAuthService- Parameters:
subject-- Returns:
- See Also:
-
refreshToken
Description copied from interface:AuthService生成refreshToken- Specified by:
refreshTokenin interfaceAuthService- Parameters:
subject-- Returns:
- See Also:
-
login
Description copied from interface:AuthService用户登录- Specified by:
loginin interfaceAuthService- Parameters:
user-- Returns:
- See Also:
-
logout
public void logout()Description copied from interface:AuthService登出- Specified by:
logoutin interfaceAuthService- See Also:
-
user
Description copied from interface:AuthService获取当前登录用户- Specified by:
userin interfaceAuthService- Returns:
- See Also:
-
userName
Description copied from interface:AuthService获取用户名- Specified by:
userNamein interfaceAuthService- Returns:
- See Also:
-
tryRefreshToken
- Parameters:
refreshToken-- Returns:
-
addCookie
添加cookie- Parameters:
name- 名称value- 值age- 有效期(分钟)
-
authentication
Description copied from interface:AuthService鉴权- Specified by:
authenticationin interfaceAuthService- Parameters:
withoutAuthenticationUrlRegulars-- Returns:
- See Also:
-
pass
- Parameters:
uri-withoutAuthenticationUrlRegulars-- Returns:
-
skip
public boolean skip()- Returns:
-
authorizationHeaderKey
认证头key- Returns:
-
tokenKey
token key ,可以接受从header/cookie和请求参数传入- Returns:
-
refreshTokenKey
refresh token key ,可以接受从header/cookie和请求参数传入- Returns:
-
token
Description copied from interface:AuthService获取token- Specified by:
tokenin interfaceAuthService- Returns:
- See Also:
-
refreshToken
Description copied from interface:AuthService获取 refresh token- Specified by:
refreshTokenin interfaceAuthService- Returns:
- See Also:
-
optionalUser
Description copied from interface:AuthService尝试获取当前用户- Specified by:
optionalUserin interfaceAuthService- Returns:
- See Also:
-