From a123034e01a371fb2cae17b37cd326f7a0217142 Mon Sep 17 00:00:00 2001 From: "wangiegie@gmail.com" Date: Sat, 28 Oct 2017 19:02:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9Eadmin=E5=85=AC=E5=85=B1=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E4=BE=9B=E7=94=A8=E6=88=B7=E3=80=81=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E3=80=81=E6=9D=83=E9=99=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 6 ++-- .../github/pig/admin/AdminApplication.java | 18 ++++++++++ .../pig/admin/controller/UserController.java | 15 ++++++++ .../src/main/resources/bootstrap.yml | 2 +- .../auth/config/PigAuthorizationConfig.java | 1 - .../auth/serivce/UserDetailServiceImpl.java | 8 +++-- .../pig/common/DemoResourceApplication.java | 34 ------------------- pom.xml | 2 +- 8 files changed, 44 insertions(+), 42 deletions(-) rename {pig-demo-service => pig-admin-service}/pom.xml (87%) create mode 100644 pig-admin-service/src/main/java/com/github/pig/admin/AdminApplication.java create mode 100644 pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java rename {pig-demo-service => pig-admin-service}/src/main/resources/bootstrap.yml (85%) delete mode 100644 pig-demo-service/src/main/java/com/github/pig/common/DemoResourceApplication.java diff --git a/pig-demo-service/pom.xml b/pig-admin-service/pom.xml similarity index 87% rename from pig-demo-service/pom.xml rename to pig-admin-service/pom.xml index e068f0d7..a494af04 100644 --- a/pig-demo-service/pom.xml +++ b/pig-admin-service/pom.xml @@ -4,12 +4,12 @@ 4.0.0 com.github.pig - pig-demo-service + pig-admin-service 0.0.1-SNAPSHOT jar - pig-demo-service - demo service + pig-admin-service + pig-admin-service com.github diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/AdminApplication.java b/pig-admin-service/src/main/java/com/github/pig/admin/AdminApplication.java new file mode 100644 index 00000000..79b84972 --- /dev/null +++ b/pig-admin-service/src/main/java/com/github/pig/admin/AdminApplication.java @@ -0,0 +1,18 @@ +package com.github.pig.admin; + +import com.github.pig.common.web.BaseController; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +/** + * @author lengleng + * @date 2017年10月27日13:59:05 + */ +@SpringBootApplication +@EnableDiscoveryClient +public class AdminApplication extends BaseController { + public static void main(String[] args) { + SpringApplication.run(AdminApplication.class, args); + } +} \ No newline at end of file diff --git a/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java new file mode 100644 index 00000000..da584020 --- /dev/null +++ b/pig-admin-service/src/main/java/com/github/pig/admin/controller/UserController.java @@ -0,0 +1,15 @@ +package com.github.pig.admin.controller; + +import com.github.pig.common.web.BaseController; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author lengleng + * @date 2017/10/28 + */ +@RestController +@RequestMapping("/user") +public class UserController extends BaseController { + +} diff --git a/pig-demo-service/src/main/resources/bootstrap.yml b/pig-admin-service/src/main/resources/bootstrap.yml similarity index 85% rename from pig-demo-service/src/main/resources/bootstrap.yml rename to pig-admin-service/src/main/resources/bootstrap.yml index 58234efc..9d039105 100644 --- a/pig-demo-service/src/main/resources/bootstrap.yml +++ b/pig-admin-service/src/main/resources/bootstrap.yml @@ -2,7 +2,7 @@ server: port: 4000 spring: application: - name: pig-demo-service + name: pig-admin-service eureka: instance: diff --git a/pig-auth-service/src/main/java/com/github/pig/auth/config/PigAuthorizationConfig.java b/pig-auth-service/src/main/java/com/github/pig/auth/config/PigAuthorizationConfig.java index 6ede3b01..9b8b3359 100644 --- a/pig-auth-service/src/main/java/com/github/pig/auth/config/PigAuthorizationConfig.java +++ b/pig-auth-service/src/main/java/com/github/pig/auth/config/PigAuthorizationConfig.java @@ -10,7 +10,6 @@ import org.springframework.security.oauth2.config.annotation.configurers.ClientD import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore; diff --git a/pig-auth-service/src/main/java/com/github/pig/auth/serivce/UserDetailServiceImpl.java b/pig-auth-service/src/main/java/com/github/pig/auth/serivce/UserDetailServiceImpl.java index badd3cea..881019fb 100644 --- a/pig-auth-service/src/main/java/com/github/pig/auth/serivce/UserDetailServiceImpl.java +++ b/pig-auth-service/src/main/java/com/github/pig/auth/serivce/UserDetailServiceImpl.java @@ -7,13 +7,17 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; /** * @author lengleng * @date 2017/10/26 + *

+ * TODO 通过调用 admin模块 */ -@Service +@Service("userDetailService") public class UserDetailServiceImpl implements UserDetailsService, Serializable { @Override public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException { diff --git a/pig-demo-service/src/main/java/com/github/pig/common/DemoResourceApplication.java b/pig-demo-service/src/main/java/com/github/pig/common/DemoResourceApplication.java deleted file mode 100644 index 6d6cd248..00000000 --- a/pig-demo-service/src/main/java/com/github/pig/common/DemoResourceApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.github.pig.common; - -import com.github.pig.common.web.BaseController; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.security.Principal; - -/** - * @author lengleng - * @date 2017年10月27日13:59:05 - */ -@SpringBootApplication -@EnableDiscoveryClient -@RestController -public class DemoResourceApplication extends BaseController { - @GetMapping("/demo") - public String demo() { - return getUser(); - } - - @RequestMapping("/user") - public Principal user(Principal principal) { - return principal; - } - - public static void main(String[] args) { - SpringApplication.run(DemoResourceApplication.class, args); - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index a2c557cc..424d8fc6 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ pig-config pig-gateway pig-auth-service - pig-demo-service + pig-admin-service