搭建 yudao-user-server 项目
parent
930cdfe2b2
commit
c81c275a97
|
@ -149,6 +149,7 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
|
||||||
.antMatchers("/druid/**").anonymous()
|
.antMatchers("/druid/**").anonymous()
|
||||||
// 短信回调 API TODO 芋艿:需要抽象出去
|
// 短信回调 API TODO 芋艿:需要抽象出去
|
||||||
.antMatchers(api("/system/sms/callback/**")).anonymous()
|
.antMatchers(api("/system/sms/callback/**")).anonymous()
|
||||||
|
.antMatchers(api("/user/**")).anonymous()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package cn.iocoder.yudao.userserver;
|
package cn.iocoder.yudao.userserver;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.dict.config.YudaoDictAutoConfiguration;
|
||||||
|
import cn.iocoder.yudao.framework.security.config.YudaoSecurityAutoConfiguration;
|
||||||
|
import cn.iocoder.yudao.framework.security.config.YudaoWebSecurityConfigurerAdapter;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication(exclude = {
|
||||||
|
YudaoDictAutoConfiguration.class,
|
||||||
|
})
|
||||||
public class UserServerApplication {
|
public class UserServerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.controller;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author weir
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class HelloController {
|
||||||
|
|
||||||
|
@RequestMapping("/user/hello")
|
||||||
|
public String hello(String hello) {
|
||||||
|
return "echo + " + hello;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.auth;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.core.service.SecurityAuthFrameworkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 认证 Service 接口
|
||||||
|
*
|
||||||
|
* 提供用户的账号密码登陆、token 的校验等认证相关的功能
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface SysAuthService extends SecurityAuthFrameworkService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.auth.impl;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
|
import cn.iocoder.yudao.userserver.modules.infra.service.auth.SysAuthService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auth Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class SysAuthServiceImpl implements SysAuthService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoginUser verifyTokenAndRefresh(String token) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoginUser mockLogin(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void logout(String token) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.logger;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 访问日志 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface InfApiAccessLogService extends ApiAccessLogFrameworkService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.logger;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 错误日志 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface InfApiErrorLogService extends ApiErrorLogFrameworkService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.logger.impl;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateDTO;
|
||||||
|
import cn.iocoder.yudao.userserver.modules.infra.service.logger.InfApiAccessLogService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.AsyncResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 访问日志 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class InfApiAccessLogServiceImpl implements InfApiAccessLogService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Future<Boolean> createApiAccessLogAsync(ApiAccessLogCreateDTO createDTO) {
|
||||||
|
log.debug("{}", createDTO);
|
||||||
|
return new AsyncResult<>(true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package cn.iocoder.yudao.userserver.modules.infra.service.logger.impl;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateDTO;
|
||||||
|
import cn.iocoder.yudao.userserver.modules.infra.service.logger.InfApiErrorLogService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.AsyncResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 错误日志 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
public class InfApiErrorLogServiceImpl implements InfApiErrorLogService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Future<Boolean> createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) {
|
||||||
|
log.debug("{}", createDTO);
|
||||||
|
return new AsyncResult<>(true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue