搭建 yudao-user-server 项目

pull/2/head
weir 2021-08-29 16:44:06 +08:00
parent 930cdfe2b2
commit c81c275a97
9 changed files with 155 additions and 1 deletions

View File

@ -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()

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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 {
}

View File

@ -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;
}
}

View File

@ -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 {
}

View File

@ -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 {
}

View File

@ -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);
}
}

View File

@ -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);
}
}