Package tech.riemann.etp.auth.service
Class HttpServletAuthService
java.lang.Object
tech.riemann.etp.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) 认证检查认证头keycookie 设置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 tech.riemann.etp.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:
-
token
Description copied from interface:AuthService生成token- Specified by:
tokenin interfaceAuthService- Parameters:
subject-- Returns:
-
refreshToken
Description copied from interface:AuthService生成refreshToken- Specified by:
refreshTokenin interfaceAuthService- Parameters:
subject-- Returns:
-
login
用户登录- Specified by:
loginin interfaceAuthService- Parameters:
user-
-
logout
public void logout()登出- Specified by:
logoutin interfaceAuthService
-
user
获取当前登录用户- Specified by:
userin interfaceAuthService- Returns:
-
userName
Description copied from interface:AuthService获取用户名- Specified by:
userNamein interfaceAuthService- Returns:
-
tryRefreshToken
- Parameters:
refreshToken-- Returns:
-
addCookie
添加cookie- Parameters:
name- 名称value- 值age- 有效期(分钟)
-
authentication
认证检查- Specified by:
authenticationin interfaceAuthService- Parameters:
withoutAuthenticationUrlRegulars- 不需要检查的url正则表达式- Returns:
- 认证检查通过状态
-
pass
- Parameters:
uri- 请求地址withoutAuthenticationUrlRegulars- 放行url正则- Returns:
- 是否放行
-
skip
public boolean skip()是否跳过检查- Returns:
-
authorizationHeaderKey
认证头key- Returns:
-
tokenKey
token key ,可以接受从header/cookie和请求参数传入- Returns:
-
refreshTokenKey
refresh token key ,可以接受从header/cookie和请求参数传入- Returns:
-
token
获取token- Specified by:
tokenin interfaceAuthService- Returns:
-
refreshToken
获取 refresh token- Specified by:
refreshTokenin interfaceAuthService- Returns:
-
optionalUser
Description copied from interface:AuthService尝试获取当前用户- Specified by:
optionalUserin interfaceAuthService- Returns:
- See Also:
-