@@ -37,14 +37,14 @@ public class UserAuthController { | |||||
private final ObjectMapper objectMapper; | private final ObjectMapper objectMapper; | ||||
@PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) | @PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) | ||||
@ApiOperation(value = "账号密码的登陆方式") | |||||
@ApiOperation(value = "登陆") | |||||
@ApiImplicitParams({ | @ApiImplicitParams({ | ||||
@ApiImplicitParam(name = "identifier", value = "用户名", required = true, paramType = "form", dataType = "String"), | |||||
@ApiImplicitParam(name = "identifier", value = "账号", required = true, paramType = "form", dataType = "String"), | |||||
@ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), | @ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"), | ||||
@ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆" | @ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆" | ||||
, required = true, paramType = "form", dataType = "String")}) | , required = true, paramType = "form", dataType = "String")}) | ||||
public void loginByUsernameAndPassword(@RequestParam("username") String username, | |||||
@RequestParam("credential") String credential, | |||||
public void loginByUsernameAndPassword(@RequestParam(value = "identifier",required = false) String identifier, | |||||
@RequestParam(value = "credential",required = false) String credential, | |||||
@RequestParam("loginType") String loginType) { | @RequestParam("loginType") String loginType) { | ||||
// 不实现任何内容,只是为了出api文档 | // 不实现任何内容,只是为了出api文档 | ||||
} | } | ||||
@@ -40,7 +40,7 @@ public class CredentialAuthProvider implements AuthenticationProvider { | |||||
case DING_QR_LOGIN: { | case DING_QR_LOGIN: { | ||||
String code = (String) authenticationToken.getCredentials(); | String code = (String) authenticationToken.getCredentials(); | ||||
GenericResult<String> accountResult = zwddAuthClient.getAccountId(code); | GenericResult<String> accountResult = zwddAuthClient.getAccountId(code); | ||||
if (accountResult.isSuccess()) { | |||||
if (!accountResult.isSuccess()) { | |||||
throw new BadCredentialsException("login fail! 浙政钉校验失败"); | throw new BadCredentialsException("login fail! 浙政钉校验失败"); | ||||
} | } | ||||
String accountId = accountResult.getData(); | String accountId = accountResult.getData(); | ||||
@@ -1,42 +0,0 @@ | |||||
package com.ningdatech.pmapi.user.security.auth.credential; | |||||
import com.ningdatech.pmapi.user.manage.UserAuthLoginManage; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | |||||
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.security.core.userdetails.UserDetailsService; | |||||
import org.springframework.security.core.userdetails.UsernameNotFoundException; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.Objects; | |||||
/** | |||||
* @author LiuXinXin | |||||
* @date 2022/9/30 上午9:49 | |||||
*/ | |||||
@Service("phoneNoLoginUserDetailService") | |||||
@RequiredArgsConstructor | |||||
public class PhoneNoLoginUserDetailService implements UserDetailsService { | |||||
private final UserAuthLoginManage userAuthLoginManage; | |||||
@Override | |||||
public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { | |||||
UserFullInfoDTO userFullInfoDTO = userAuthLoginManage.queryUserInfoInPhoneNoAuth(username); | |||||
if (Objects.isNull(userFullInfoDTO)) { | |||||
throw new UsernameNotFoundException(String.format("%s user not exist", username)); | |||||
} | |||||
UserInfoDetails userInfoDetails = new UserInfoDetails(); | |||||
userInfoDetails.setUserId(userFullInfoDTO.getUserId()); | |||||
userInfoDetails.setUsername(userFullInfoDTO.getUsername()); | |||||
userInfoDetails.setRealName(userFullInfoDTO.getRealName()); | |||||
userInfoDetails.setRole(userFullInfoDTO.getRole()); | |||||
userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode()); | |||||
userInfoDetails.setCompanyId(userFullInfoDTO.getCompanyId()); | |||||
userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier()); | |||||
userInfoDetails.setPassword(userFullInfoDTO.getCredential()); | |||||
return userInfoDetails; | |||||
} | |||||
} |
@@ -1,6 +1,6 @@ | |||||
#专有钉钉 | #专有钉钉 | ||||
integration: | integration: | ||||
zzd: | |||||
zwdd: | |||||
#扫码 | #扫码 | ||||
app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z | app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z | ||||
app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P | app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P | ||||
@@ -1,11 +1,12 @@ | |||||
#专有钉钉 | #专有钉钉 | ||||
ding: | |||||
#扫码 | |||||
app-auth-key: expert-base_dingoa-c5nnefYVnie | |||||
app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L | |||||
# #免登/获取信息 | |||||
app-key: file-manage-4Mjx9358wuxjyYFjY3 | |||||
app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O | |||||
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 | |||||
tenantId: 31141 | |||||
domain: openplatform.dg-work.cn | |||||
integration: | |||||
zwdd: | |||||
#扫码 | |||||
app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z | |||||
app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P | |||||
#免登/获取信息 | |||||
app-key: ls_rebuild-10c8n5X0707yFV7jURr | |||||
app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6 | |||||
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729 | |||||
tenantId: 31141 | |||||
domain: openplatform.dg-work.cn |
@@ -2,7 +2,7 @@ security: | |||||
auth: | auth: | ||||
auth-require-url: /api/v1/user/auth/auth-require | auth-require-url: /api/v1/user/auth/auth-require | ||||
invalid-session-url: /api/v1/user/auth/invalid-session | invalid-session-url: /api/v1/user/auth/invalid-session | ||||
password-login-url: /api/v1/user/auth/login/password | |||||
password-login-url: /api/v1/user/auth/login | |||||
logout-url: /api/v1/user/auth/logout | logout-url: /api/v1/user/auth/logout | ||||
ignore-auth-urls: | ignore-auth-urls: | ||||
- /v2/api-docs | - /v2/api-docs | ||||
@@ -2,7 +2,7 @@ security: | |||||
auth: | auth: | ||||
auth-require-url: /api/v1/user/auth/auth-require | auth-require-url: /api/v1/user/auth/auth-require | ||||
invalid-session-url: /api/v1/user/auth/invalid-session | invalid-session-url: /api/v1/user/auth/invalid-session | ||||
password-login-url: /api/v1/user/auth/login/password | |||||
password-login-url: /api/v1/user/auth/login | |||||
logout-url: /api/v1/user/auth/logout | logout-url: /api/v1/user/auth/logout | ||||
ignore-auth-urls: | ignore-auth-urls: | ||||
- /v2/api-docs | - /v2/api-docs | ||||