|
@ -1,36 +1,30 @@
|
|
package com.yihu.jw.service;
|
|
package com.yihu.jw.service;
|
|
|
|
|
|
import com.yihu.base.security.rbas.ClientServiceProvider;
|
|
import com.yihu.base.security.rbas.ClientServiceProvider;
|
|
import com.yihu.jw.dao.SaasDao;
|
|
|
|
import com.yihu.jw.model.SaasDO;
|
|
import com.yihu.jw.model.SaasDO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
|
|
|
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
|
|
|
|
import org.springframework.security.oauth2.provider.ClientDetails;
|
|
import org.springframework.security.oauth2.provider.ClientDetails;
|
|
import org.springframework.security.oauth2.provider.ClientDetailsService;
|
|
|
|
import org.springframework.security.oauth2.provider.ClientRegistrationException;
|
|
import org.springframework.security.oauth2.provider.ClientRegistrationException;
|
|
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by chenweida on 2017/12/1.
|
|
* Created by chenweida on 2017/12/1.
|
|
*/
|
|
*/
|
|
@Component("baseClientDetailsService")
|
|
@Component("baseClientDetailsService")
|
|
public class ClientService implements ClientServiceProvider {
|
|
public class ClientService implements ClientServiceProvider {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据自己的业务查询表 返回相关的平台用户信息
|
|
|
|
* @param clientId
|
|
|
|
* @return
|
|
|
|
* @throws ClientRegistrationException
|
|
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
|
|
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
|
|
// SaasDO saasDO = saasDao.findByAppId(clientId);
|
|
// SaasDO saasDO = saasDao.findByAppId(clientId);
|
|
// if (saasDO == null) {
|
|
// if (saasDO == null) {
|
|
// throw new ClientRegistrationException("用户没有注册");
|
|
// throw new ClientRegistrationException("用户没有注册");
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
SaasDO baseClientDetails = new SaasDO();
|
|
SaasDO baseClientDetails = new SaasDO();
|
|
baseClientDetails.setAppId("cwd");
|
|
baseClientDetails.setAppId("cwd");
|
|
baseClientDetails.setAppSecret("cwd");
|
|
baseClientDetails.setAppSecret("cwd");
|
|
@ -38,6 +32,4 @@ public class ClientService implements ClientServiceProvider {
|
|
baseClientDetails.getAuthorizedGrantTypes();
|
|
baseClientDetails.getAuthorizedGrantTypes();
|
|
return baseClientDetails;
|
|
return baseClientDetails;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|