Merge branch 'leng_dev' into greenwich

# Conflicts:
#	pigx-auth/pom.xml
#	pigx-common/pigx-common-core/pom.xml
#	pigx-common/pigx-common-data/pom.xml
#	pigx-common/pigx-common-gateway/pom.xml
#	pigx-common/pigx-common-job/pom.xml
#	pigx-common/pigx-common-log/pom.xml
#	pigx-common/pigx-common-minio/pom.xml
#	pigx-common/pigx-common-security/pom.xml
#	pigx-common/pigx-common-swagger/pom.xml
#	pigx-common/pigx-common-transaction/pom.xml
#	pigx-common/pom.xml
#	pigx-config/pom.xml
#	pigx-config/src/main/resources/config/pigx-upms-biz-dev.yml
#	pigx-eureka/pom.xml
#	pigx-gateway/pom.xml
#	pigx-upms/pigx-upms-api/pom.xml
#	pigx-upms/pigx-upms-biz/pom.xml
#	pigx-upms/pom.xml
#	pigx-visual/pigx-activiti/pom.xml
#	pigx-visual/pigx-codegen/pom.xml
#	pigx-visual/pigx-daemon/pom.xml
#	pigx-visual/pigx-monitor/pom.xml
#	pigx-visual/pigx-sso-client-demo/pom.xml
#	pigx-visual/pigx-tx-manager/pom.xml
#	pigx-visual/pom.xml
#	pom.xml
This commit is contained in:
冷冷 committed 2019-01-23 18:31:50 +08:00
commit 2b2507a068
85 files changed
+1423 -629

No files matched your search

@@ -26,6 +26,7 @@ import com.pig4cloud.pigx.common.security.service.PigxClientDetailsService;
import com.pig4cloud.pigx.common.security.service.PigxUser;
import com.pig4cloud.pigx.common.security.service.PigxUserDetailsService;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
@@ -62,7 +63,8 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
private final RedisConnectionFactory redisConnectionFactory;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
@SneakyThrows
public void configure(ClientDetailsServiceConfigurer clients) {
PigxClientDetailsService clientDetailsService = new PigxClientDetailsService(dataSource);
clientDetailsService.setSelectClientDetailsSql(SecurityConstants.DEFAULT_SELECT_STATEMENT);
clientDetailsService.setFindClientDetailsSql(SecurityConstants.DEFAULT_FIND_STATEMENT);
@@ -102,9 +104,19 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
return tokenStore;
}
/**
* token增强,客户端模式不增强。
*
* @return TokenEnhancer
*/
@Bean
public TokenEnhancer tokenEnhancer() {
return (accessToken, authentication) -> {
if (SecurityConstants.CLIENT_CREDENTIALS
.equals(authentication.getOAuth2Request().getGrantType())) {
return accessToken;
}
final Map<String, Object> additionalInfo = new HashMap<>(8);
PigxUser pigxUser = (PigxUser) authentication.getUserAuthentication().getPrincipal();
additionalInfo.put("user_id", pigxUser.getId());
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.pig4cloud.pigx.common.security.handler.MobileLoginSuccessHandler;
import com.pig4cloud.pigx.common.security.mobile.MobileSecurityConfigurer;
import com.pig4cloud.pigx.common.security.service.PigxUserDetailsService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -59,7 +60,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
private AuthorizationServerTokenServices defaultAuthorizationServerTokenServices;
@Override
protected void configure(HttpSecurity http) throws Exception {
@SneakyThrows
protected void configure(HttpSecurity http) {
http
.formLogin()
.loginPage("/token/login")
@@ -87,7 +89,8 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
@SneakyThrows
public AuthenticationManager authenticationManagerBean() {
return super.authenticationManagerBean();
}