mirror of https://gitee.com/maxjhandsome/pig
【新增】 新增admin公共模块,提供用户、角色、权限管理
This commit is contained in:
parent
3deeab77c9
commit
a123034e01
|
@ -4,12 +4,12 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.github.pig</groupId>
|
<groupId>com.github.pig</groupId>
|
||||||
<artifactId>pig-demo-service</artifactId>
|
<artifactId>pig-admin-service</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>pig-demo-service</name>
|
<name>pig-admin-service</name>
|
||||||
<description>demo service</description>
|
<description>pig-admin-service</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.github</groupId>
|
<groupId>com.github</groupId>
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ server:
|
||||||
port: 4000
|
port: 4000
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: pig-demo-service
|
name: pig-admin-service
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
|
@ -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.AuthorizationServerConfigurerAdapter;
|
||||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
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.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.JwtAccessTokenConverter;
|
||||||
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
|
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,17 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lengleng
|
* @author lengleng
|
||||||
* @date 2017/10/26
|
* @date 2017/10/26
|
||||||
|
* <p>
|
||||||
|
* TODO 通过调用 admin模块
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service("userDetailService")
|
||||||
public class UserDetailServiceImpl implements UserDetailsService, Serializable {
|
public class UserDetailServiceImpl implements UserDetailsService, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
2
pom.xml
2
pom.xml
|
@ -49,7 +49,7 @@
|
||||||
<module>pig-config</module>
|
<module>pig-config</module>
|
||||||
<module>pig-gateway</module>
|
<module>pig-gateway</module>
|
||||||
<module>pig-auth-service</module>
|
<module>pig-auth-service</module>
|
||||||
<module>pig-demo-service</module>
|
<module>pig-admin-service</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
Loading…
Reference in New Issue