| 
															
																@ -107,6 +107,14 @@ public class WlyyTokenGranter implements TokenGranter { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        requestFactory, 
															 | 
															
															 | 
															
																                        requestFactory, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                        userDetailsService 
															 | 
															
															 | 
															
																                        userDetailsService 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                )); 
															 | 
															
															 | 
															
																                )); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        tokenGranters.put(FamilyTokenGranter.GRANT_TYPE, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                new FamilyTokenGranter( 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        authenticationManager, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        tokenServices, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        clientDetailsService, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        requestFactory, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                        userDetailsService 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                )); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) { 
															 | 
															
															 | 
															
																    public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -511,6 +519,62 @@ public class WlyyTokenGranter implements TokenGranter { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                throw new InvalidGrantException("User account is locked"); 
															 | 
															
															 | 
															
																                throw new InvalidGrantException("User account is locked"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//            parameters.put("password",userDetails.getPassword()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            ((AbstractAuthenticationToken) userAuth).setDetails(parameters); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            OAuth2Request storedOAuth2Request = getRequestFactory().createOAuth2Request(client, tokenRequest); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return new OAuth2Authentication(storedOAuth2Request, userAuth); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 家人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    public static class FamilyTokenGranter extends AbstractTokenGranter { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        private static final String GRANT_TYPE = "family"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        private final AuthenticationManager authenticationManager; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        private final UserDetailsService userDetailsService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        public FamilyTokenGranter(AuthenticationManager authenticationManager, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                  AuthorizationServerTokenServices tokenServices, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                  ClientDetailsService clientDetailsService, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                  OAuth2RequestFactory requestFactory, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                  UserDetailsService userDetailsService) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            this(authenticationManager, tokenServices, clientDetailsService, requestFactory, userDetailsService, GRANT_TYPE); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        protected FamilyTokenGranter(AuthenticationManager authenticationManager, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                     AuthorizationServerTokenServices tokenServices, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                     ClientDetailsService clientDetailsService, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                     OAuth2RequestFactory requestFactory, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                     UserDetailsService userDetailsService, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                                     String grantType) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            super(tokenServices, clientDetailsService, requestFactory, grantType); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            this.authenticationManager = authenticationManager; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            this.userDetailsService = userDetailsService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        @Override 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        protected OAuth2Authentication getOAuth2Authentication(ClientDetails client, TokenRequest tokenRequest) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            Map<String, String> parameters = new LinkedHashMap<String, String>(tokenRequest.getRequestParameters()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String encdata = parameters.get("encdata"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            encdata = AES.decrypt(encdata); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //居民id 家人手机号/家人身份证 家人id 以冒号组合,如: 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //6e9d7cdb05b346a3a992739b9810319c:13559485277:3ae2673512154d5280d1dcf5ffa5626d 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String data[] = encdata.split(":"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String username = data[1]; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            SaltUser userDetails = (SaltUser)userDetailsService.loadUserByUsername(encdata); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (!userDetails.isEnabled()) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                throw new InvalidGrantException("User is disabled"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (!userDetails.isAccountNonLocked()) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                throw new InvalidGrantException("User account is locked"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            parameters.put("password",userDetails.getPassword()); 
															 | 
															
															 | 
															
																//            parameters.put("password",userDetails.getPassword()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities())); 
															 | 
															
															 | 
															
																            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities())); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            ((AbstractAuthenticationToken) userAuth).setDetails(parameters); 
															 | 
															
															 | 
															
																            ((AbstractAuthenticationToken) userAuth).setDetails(parameters); 
															 |