正在显示
6 个修改的文件
包含
30 行增加
和
11 行删除
| @@ -159,3 +159,7 @@ jwt: | @@ -159,3 +159,7 @@ jwt: | ||
| 159 | info: | 159 | info: |
| 160 | version: 2.0 | 160 | version: 2.0 |
| 161 | description: "具有公司及部门管理级别的用户管理中心" | 161 | description: "具有公司及部门管理级别的用户管理中心" |
| 162 | +ger: | ||
| 163 | + req-url: "http://10.5.14.103:27080/sso/p3/serviceValidate?format=json&service=" | ||
| 164 | + res-url: "http://10.50.3.73:8880/%23/ssologin" | ||
| 165 | +# res-url: "http://10.50.7.70:9909/%23/ssologin" |
| @@ -43,6 +43,12 @@ public class AnonymousController { | @@ -43,6 +43,12 @@ public class AnonymousController { | ||
| 43 | @Value("${jwt.max-alive}") | 43 | @Value("${jwt.max-alive}") |
| 44 | protected Integer jwtMaxAlive; | 44 | protected Integer jwtMaxAlive; |
| 45 | 45 | ||
| 46 | + @Value("${ger.req-url}") | ||
| 47 | + private String requestUrl; | ||
| 48 | + | ||
| 49 | + @Value("${ger.res-url}") | ||
| 50 | + private String responseUrl; | ||
| 51 | + | ||
| 46 | @Autowired | 52 | @Autowired |
| 47 | RoleService roleService; | 53 | RoleService roleService; |
| 48 | 54 | ||
| @@ -131,7 +137,7 @@ public class AnonymousController { | @@ -131,7 +137,7 @@ public class AnonymousController { | ||
| 131 | log.info("票据接受:{}", ticket); | 137 | log.info("票据接受:{}", ticket); |
| 132 | if (!StringUtils.isEmpty(ticket)){ | 138 | if (!StringUtils.isEmpty(ticket)){ |
| 133 | log.info("开始验证票据"); | 139 | log.info("开始验证票据"); |
| 134 | - String result = HttpClientUtil.httpGet("http://10.5.14.103:27080/sso/p3/serviceValidate?format=json&service="+"http://10.50.7.70:9909/%23/ssologin"+"&ticket="+ticket, "UTF-8"); | 140 | + String result = HttpClientUtil.httpGet(requestUrl+responseUrl+"&ticket="+ticket, "UTF-8"); |
| 135 | log.info("验证票据返回值:{}", result); | 141 | log.info("验证票据返回值:{}", result); |
| 136 | Map<String, Object> userInfo = resolveUserInfo(result); | 142 | Map<String, Object> userInfo = resolveUserInfo(result); |
| 137 | if (userInfo != null){ | 143 | if (userInfo != null){ |
| @@ -139,6 +145,7 @@ public class AnonymousController { | @@ -139,6 +145,7 @@ public class AnonymousController { | ||
| 139 | // KakoUser user = kakoUserMapper.findLonginName(userInfo.get("loginName").toString(), userInfo.get("userId").toString()); | 145 | // KakoUser user = kakoUserMapper.findLonginName(userInfo.get("loginName").toString(), userInfo.get("userId").toString()); |
| 140 | KakoUser user = kakoUserService.loadByUsername(userInfo.get("loginName").toString()); | 146 | KakoUser user = kakoUserService.loadByUsername(userInfo.get("loginName").toString()); |
| 141 | log.info("查询用户信息:{}", user); | 147 | log.info("查询用户信息:{}", user); |
| 148 | + if (user != null){ | ||
| 142 | //返回前端登陆成功后的用户信息 | 149 | //返回前端登陆成功后的用户信息 |
| 143 | KakoUser loginedUser = new KakoUser(); | 150 | KakoUser loginedUser = new KakoUser(); |
| 144 | loginedUser.setLoginName(user.getUsername()); | 151 | loginedUser.setLoginName(user.getUsername()); |
| @@ -158,6 +165,8 @@ public class AnonymousController { | @@ -158,6 +165,8 @@ public class AnonymousController { | ||
| 158 | return new AuthSuccessResponse(loginedUser,menuMap); | 165 | return new AuthSuccessResponse(loginedUser,menuMap); |
| 159 | } | 166 | } |
| 160 | return null; | 167 | return null; |
| 168 | + } | ||
| 169 | + return null; | ||
| 161 | }else { | 170 | }else { |
| 162 | return null; | 171 | return null; |
| 163 | } | 172 | } |
src/main/java/com/tianbo/warehouse/security/handel/kakologin/MyLoginAuthenticationProcessFilter.java
| @@ -65,12 +65,16 @@ public class MyLoginAuthenticationProcessFilter extends AbstractAuthenticationPr | @@ -65,12 +65,16 @@ public class MyLoginAuthenticationProcessFilter extends AbstractAuthenticationPr | ||
| 65 | authRequest = new UsernamePasswordAuthenticationToken(loginUserName,loginUserPass, null); | 65 | authRequest = new UsernamePasswordAuthenticationToken(loginUserName,loginUserPass, null); |
| 66 | authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); | 66 | authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); |
| 67 | }else { | 67 | }else { |
| 68 | + redisUtils.del("verifyToken_"+ verifyToken); | ||
| 68 | throw new BadCredentialsException("验证码错误!"); | 69 | throw new BadCredentialsException("验证码错误!"); |
| 69 | } | 70 | } |
| 70 | } catch (BadCredentialsException e){ | 71 | } catch (BadCredentialsException e){ |
| 72 | + e.printStackTrace(); | ||
| 71 | throw new PreAuthenticatedCredentialsNotFoundException(e.getMessage()); | 73 | throw new PreAuthenticatedCredentialsNotFoundException(e.getMessage()); |
| 72 | }catch (Exception e) { | 74 | }catch (Exception e) { |
| 75 | + e.printStackTrace(); | ||
| 73 | throw new AuthenticationServiceException(e.getMessage()); | 76 | throw new AuthenticationServiceException(e.getMessage()); |
| 77 | + | ||
| 74 | } | 78 | } |
| 75 | return this.getAuthenticationManager().authenticate(authRequest); | 79 | return this.getAuthenticationManager().authenticate(authRequest); |
| 76 | } | 80 | } |
| @@ -37,15 +37,15 @@ public class SM3EncryptUtil { | @@ -37,15 +37,15 @@ public class SM3EncryptUtil { | ||
| 37 | return str.toLowerCase(); | 37 | return str.toLowerCase(); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | -// public static void main(String[] args) { | ||
| 41 | -// Security.addProvider(new BouncyCastleProvider()); | ||
| 42 | -// try { | ||
| 43 | -// String pwdDigest = passwordSm3("vmvnv1v2VV."); | ||
| 44 | -// System.out.println(pwdDigest); | ||
| 45 | -// } catch (Exception e) { | ||
| 46 | -// e.printStackTrace(); | ||
| 47 | -// } | ||
| 48 | -// } | 40 | + public static void main(String[] args) { |
| 41 | + Security.addProvider(new BouncyCastleProvider()); | ||
| 42 | + try { | ||
| 43 | + String pwdDigest = passwordSm3("vmvnv1v2VV."); | ||
| 44 | + System.out.println(pwdDigest); | ||
| 45 | + } catch (Exception e) { | ||
| 46 | + e.printStackTrace(); | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | * 密码SM3加密 | 51 | * 密码SM3加密 |
| @@ -213,6 +213,9 @@ | @@ -213,6 +213,9 @@ | ||
| 213 | <if test="delFlag != null" > | 213 | <if test="delFlag != null" > |
| 214 | #{delFlag,jdbcType=CHAR}, | 214 | #{delFlag,jdbcType=CHAR}, |
| 215 | </if> | 215 | </if> |
| 216 | + <if test="userSyncId != null" > | ||
| 217 | + #{userSyncId,jdbcType=VARCHAR}, | ||
| 218 | + </if> | ||
| 216 | </trim> | 219 | </trim> |
| 217 | </insert> | 220 | </insert> |
| 218 | <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.KakoUser" > | 221 | <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.KakoUser" > |
-
请 注册 或 登录 后发表评论