|  | @ -116,6 +116,14 @@ public class WlyyTokenGranter implements TokenGranter {
 | 
	
		
			
				|  |  |                         requestFactory,
 | 
	
		
			
				|  |  |                         userDetailsService
 | 
	
		
			
				|  |  |                 ));
 | 
	
		
			
				|  |  |         tokenGranters.put(DingTalkTokenGranter.GRANT_TYPE,
 | 
	
		
			
				|  |  |                 new DingTalkTokenGranter(
 | 
	
		
			
				|  |  |                         authenticationManager,
 | 
	
		
			
				|  |  |                         tokenServices,
 | 
	
		
			
				|  |  |                         clientDetailsService,
 | 
	
		
			
				|  |  |                         requestFactory,
 | 
	
		
			
				|  |  |                         userDetailsService
 | 
	
		
			
				|  |  |                 ));
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public OAuth2AccessToken grant(String grantType, TokenRequest tokenRequest) {
 | 
	
	
		
			
				|  | @ -576,6 +584,56 @@ public class WlyyTokenGranter implements TokenGranter {
 | 
	
		
			
				|  |  |                 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 DingTalkTokenGranter extends AbstractTokenGranter {
 | 
	
		
			
				|  |  |         private static final String GRANT_TYPE = "dingTalk";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         private final AuthenticationManager authenticationManager;
 | 
	
		
			
				|  |  |         private final UserDetailsService userDetailsService;
 | 
	
		
			
				|  |  |         private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         public DingTalkTokenGranter(AuthenticationManager authenticationManager,
 | 
	
		
			
				|  |  |                                   AuthorizationServerTokenServices tokenServices,
 | 
	
		
			
				|  |  |                                   ClientDetailsService clientDetailsService,
 | 
	
		
			
				|  |  |                                   OAuth2RequestFactory requestFactory,
 | 
	
		
			
				|  |  |                                   UserDetailsService userDetailsService) {
 | 
	
		
			
				|  |  |             this(authenticationManager, tokenServices, clientDetailsService, requestFactory, userDetailsService, GRANT_TYPE);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         protected DingTalkTokenGranter(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 username = parameters.get("username");
 | 
	
		
			
				|  |  |             SaltUser userDetails = (SaltUser)userDetailsService.loadUserByUsername(username);
 | 
	
		
			
				|  |  |             if (!userDetails.isEnabled()) {
 | 
	
		
			
				|  |  |                 throw new InvalidGrantException("User is disabled");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if (!userDetails.isAccountNonLocked()) {
 | 
	
		
			
				|  |  |                 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);
 |