初始化
This commit is contained in:
24
ygxs-shop-security/ygsx-shop-security-admin/pom.xml
Normal file
24
ygxs-shop-security/ygsx-shop-security-admin/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.yami.shop</groupId>
|
||||
<artifactId>ygxs-shop-security</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ygsx-shop-security-admin</artifactId>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<description>商城安全模块后台管理部分</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yami.shop</groupId>
|
||||
<artifactId>ygsx-shop-security-common</artifactId>
|
||||
<version>${yami.shop.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yami.shop.security.admin.adapter;
|
||||
|
||||
import com.yami.shop.security.common.adapter.DefaultAuthConfigAdapter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 菠萝凤梨
|
||||
* @date 2022/3/28 14:57
|
||||
*/
|
||||
@Component("adminResourceServerAdapter")
|
||||
public class ResourceServerAdapter extends DefaultAuthConfigAdapter {
|
||||
public static final List<String> EXCLUDE_PATH = Arrays.asList(
|
||||
"/webjars/**",
|
||||
"/swagger/**",
|
||||
"/v3/api-docs/**",
|
||||
"/doc.html",
|
||||
"/swagger-ui.html",
|
||||
"/swagger-resources/**",
|
||||
"/captcha/**",
|
||||
"/adminLogin",
|
||||
"/p/user/getVipPackageList",
|
||||
"/mall4j/img/**");
|
||||
|
||||
@Override
|
||||
public List<String> excludePathPatterns() {
|
||||
return EXCLUDE_PATH;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yami.shop.security.admin.dto;
|
||||
|
||||
import com.yami.shop.security.common.dto.AuthenticationDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
* @author 菠萝凤梨
|
||||
* @date 2022/3/28 14:57
|
||||
*/
|
||||
@Data
|
||||
public class CaptchaAuthenticationDTO extends AuthenticationDTO {
|
||||
|
||||
@Schema(description = "验证码" , required = true)
|
||||
private String captchaVerification;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||
*
|
||||
* https://www.mall4j.com/
|
||||
*
|
||||
* 未经允许,不可做商业用途!
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
package com.yami.shop.security.admin.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户详细信息
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class YamiSysUser {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
private Set<String> authorities;
|
||||
|
||||
private String username;
|
||||
|
||||
private Long shopId;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||
*
|
||||
* https://www.mall4j.com/
|
||||
*
|
||||
* 未经允许,不可做商业用途!
|
||||
*
|
||||
* 版权所有,侵权必究!
|
||||
*/
|
||||
package com.yami.shop.security.admin.util;
|
||||
|
||||
import com.yami.shop.security.admin.model.YamiSysUser;
|
||||
import com.yami.shop.security.common.bo.UserInfoInTokenBO;
|
||||
import com.yami.shop.security.common.util.AuthUserContext;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LGH
|
||||
*/
|
||||
@UtilityClass
|
||||
public class SecurityUtils {
|
||||
/**
|
||||
* 获取用户
|
||||
*/
|
||||
public YamiSysUser getSysUser() {
|
||||
UserInfoInTokenBO userInfoInTokenBO = AuthUserContext.get();
|
||||
|
||||
YamiSysUser details = new YamiSysUser();
|
||||
details.setUserId(Long.valueOf(userInfoInTokenBO.getUserId()));
|
||||
details.setEnabled(userInfoInTokenBO.getEnabled());
|
||||
details.setUsername(userInfoInTokenBO.getNickName());
|
||||
details.setAuthorities(userInfoInTokenBO.getPerms());
|
||||
details.setShopId(userInfoInTokenBO.getShopId());
|
||||
return details;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user