Package com.bytedesk.core.rbac.auth
Class AuthService
java.lang.Object
com.bytedesk.core.rbac.auth.AuthService
https://www.baeldung.com/get-user-in-spring-security
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BytedeskPropertiesprivate final org.modelmapper.ModelMapperprivate final org.springframework.security.crypto.bcrypt.BCryptPasswordEncoderprivate final TokenRepositoryprivate final UidUtilsprivate final UserDetailsServiceImpl -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.security.core.AuthenticationauthenticateWithPassword(UserDetailsImpl userDetails, String password, String username) 通用的密码验证逻辑org.springframework.security.core.AuthenticationauthenticateWithPasswordHash(AuthRequest authRequest) 密码哈希登录 - 支持AES解密 前端使用AES加密密码,后端解密后验证org.springframework.security.core.AuthenticationauthenticateWithPlainPassword(AuthRequest authRequest) 明文密码登录 - 直接验证明文密码 参考 authenticateWithPasswordHash 逻辑,去掉AES解密过程authenticationWithEmailAndPlatform(String email, String platform, String client, String device) authenticationWithMobileAndPlatform(String mobile, String platform, String client, String device) formatResponse(AuthRequest authRequest, org.springframework.security.core.Authentication authentication) org.springframework.security.authentication.UsernamePasswordAuthenticationTokengetAuthentication(jakarta.servlet.http.HttpServletRequest request, String subject) getUser()
-
Field Details
-
userDetailsService
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
tokenRepository
-
passwordEncoder
private final org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder passwordEncoder -
bytedeskProperties
-
-
Constructor Details
-
AuthService
public AuthService()
-
-
Method Details
-
getUser
-
getCurrentUser
-
getAuthentication
public org.springframework.security.authentication.UsernamePasswordAuthenticationToken getAuthentication(@NonNull jakarta.servlet.http.HttpServletRequest request, String subject) -
authenticationWithMobileAndPlatform
-
authenticationWithEmailAndPlatform
-
formatResponse
public AuthResponse formatResponse(AuthRequest authRequest, org.springframework.security.core.Authentication authentication) -
authenticateWithPassword
private org.springframework.security.core.Authentication authenticateWithPassword(UserDetailsImpl userDetails, String password, String username) 通用的密码验证逻辑 -
authenticateWithPlainPassword
public org.springframework.security.core.Authentication authenticateWithPlainPassword(AuthRequest authRequest) 明文密码登录 - 直接验证明文密码 参考 authenticateWithPasswordHash 逻辑,去掉AES解密过程 -
authenticateWithPasswordHash
public org.springframework.security.core.Authentication authenticateWithPasswordHash(AuthRequest authRequest) 密码哈希登录 - 支持AES解密 前端使用AES加密密码,后端解密后验证
-