mirror of
https://gitee.com/wangkang/udf.git
synced 2026-11-02 08:03:43 +00:00
添加auth模块
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
<module>udf-starter-datasource</module>
|
||||
<module>udf-starter-connection-pool-druid</module>
|
||||
<module>udf-starter-qrcode</module>
|
||||
<module>udf-starter-auth</module>
|
||||
</modules>
|
||||
<!-- 依赖管理 -->
|
||||
<dependencyManagement>
|
||||
@@ -132,6 +133,12 @@
|
||||
<artifactId>udf-starter-qrcode</artifactId>
|
||||
<version>${udf-starter.version}</version>
|
||||
</dependency>
|
||||
<!-- udf-starter-auth -->
|
||||
<dependency>
|
||||
<groupId>org.itkk.udf</groupId>
|
||||
<artifactId>udf-starter-auth</artifactId>
|
||||
<version>${udf-starter.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<!-- 构建 -->
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="true">
|
||||
<fileset name="all" enabled="true" check-config-name="itkk.org" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
||||
@@ -0,0 +1,4 @@
|
||||
/target/
|
||||
/bin/
|
||||
/.classpath
|
||||
/.project
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<!-- maven坐标 -->
|
||||
<artifactId>udf-starter-auth</artifactId>
|
||||
<name>udf-starter-auth</name>
|
||||
<packaging>jar</packaging>
|
||||
<url>http://itkk.org:81</url>
|
||||
<!-- 父依赖 -->
|
||||
<parent>
|
||||
<groupId>org.itkk.udf</groupId>
|
||||
<artifactId>udf-starter</artifactId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
<!-- 依赖 -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.itkk.udf</groupId>
|
||||
<artifactId>udf-starter-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.itkk.udf</groupId>
|
||||
<artifactId>udf-starter-rms</artifactId>
|
||||
</dependency>
|
||||
<!-- zuul-core -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.zuul</groupId>
|
||||
<artifactId>zuul-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.itkk.udf.auth;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* AuthConfig
|
||||
*/
|
||||
@Configuration
|
||||
public class AuthConfig {
|
||||
|
||||
}
|
||||
+6
-2
@@ -1,13 +1,16 @@
|
||||
package org.itkk.udf.rms;
|
||||
package org.itkk.udf.auth;
|
||||
|
||||
import com.netflix.zuul.ZuulFilter;
|
||||
import com.netflix.zuul.context.RequestContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.itkk.udf.core.exception.AuthException;
|
||||
import org.itkk.udf.rms.Constant;
|
||||
import org.itkk.udf.rms.RmsProperties;
|
||||
import org.itkk.udf.rms.meta.ApplicationMeta;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -16,6 +19,7 @@ import static com.netflix.zuul.context.RequestContext.getCurrentContext;
|
||||
/**
|
||||
* RmsFilter
|
||||
*/
|
||||
@Component
|
||||
public class RmsFilter extends ZuulFilter {
|
||||
|
||||
/**
|
||||
@@ -33,7 +37,7 @@ public class RmsFilter extends ZuulFilter {
|
||||
@Override
|
||||
public Object run() {
|
||||
//获得request
|
||||
RequestContext ctx = RequestContext.getCurrentContext();
|
||||
RequestContext ctx = getCurrentContext();
|
||||
//获得应用元数据
|
||||
ApplicationMeta applicationMeta = rmsProperties.getApplication().get(springApplicationName);
|
||||
//判空
|
||||
@@ -20,10 +20,5 @@
|
||||
<groupId>org.itkk.udf</groupId>
|
||||
<artifactId>udf-starter-core</artifactId>
|
||||
</dependency>
|
||||
<!-- zuul-core -->
|
||||
<dependency>
|
||||
<groupId>com.netflix.zuul</groupId>
|
||||
<artifactId>zuul-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
package org.itkk.udf.rms;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -39,17 +38,6 @@ public class RmsConfig {
|
||||
@NotNull
|
||||
private String rmsPathPatterns;
|
||||
|
||||
/**
|
||||
* rmsFilter
|
||||
*
|
||||
* @return RmsFilter
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnBean(name = "zuulServlet")
|
||||
public RmsFilter rmsFilter() {
|
||||
return new RmsFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述 : restTemplate
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user