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>
|
||||
|
||||
<groupId>com.github.pig</groupId>
|
||||
<artifactId>pig-demo-service</artifactId>
|
||||
<artifactId>pig-admin-service</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>pig-demo-service</name>
|
||||
<description>demo service</description>
|
||||
<name>pig-admin-service</name>
|
||||
<description>pig-admin-service</description>
|
||||
|
||||
<parent>
|
||||
<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
|
||||
spring:
|
||||
application:
|
||||
name: pig-demo-service
|
||||
name: pig-admin-service
|
||||
|
||||
eureka:
|
||||
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.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;
|
||||
|
||||
|
|
|
@ -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
|
||||
* <p>
|
||||
* TODO 通过调用 admin模块
|
||||
*/
|
||||
@Service
|
||||
@Service("userDetailService")
|
||||
public class UserDetailServiceImpl implements UserDetailsService, Serializable {
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue