Skip to content

Commit

Permalink
Added simple role-based URL permission intercept.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Aug 23, 2019
1 parent 163eb9b commit bcaa630
Show file tree
Hide file tree
Showing 60 changed files with 383 additions and 244 deletions.
2 changes: 1 addition & 1 deletion devops/docker/dew-devops/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get install -y nodejs

# ----------------- Add maven agent
ARG MAVEN_AGENT_URL=https://oss.sonatype.org/content/repositories/public/ms/dew/dew-maven-agent/2.0.0-beta2/dew-maven-agent-2.0.0-beta2.jar
ARG MAVEN_AGENT_URL=https://oss.sonatype.org/content/repositories/public/ms/dew/dew-maven-agent/2.0.0-SNAPSHOT/dew-maven-agent-2.0.0-SNAPSHOT.jar

RUN mkdir -p /opt/maven/ \
&& mkdir -p /opt/jar/ \
Expand Down
13 changes: 7 additions & 6 deletions devops/it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<artifactId>devops-it</artifactId>
<name>2.2 Dew Devops Integration Tests Build</name>
<packaging>jar</packaging>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>

<properties>
<java.version>1.8</java.version>
Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>ms.dew</groupId>
<artifactId>dew-maven-plugin</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.consol.citrus</groupId>
Expand Down Expand Up @@ -93,12 +93,13 @@
</dependency>
</dependencies>

<!-- <modules>
<modules>
<!--<module>src/it/helloworld-library</module>
<module>src/it/helloworld-backend</module>
<module>src/it/helloworld-frontend</module>
<module>src/it/helloworld-library</module>
<module>src/it/todo</module>
</modules>-->
<module>src/it/multi-ports-demo</module>
<module>src/it/todo</module>-->
</modules>

<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/helloworld-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>ms.dew.devops.it</groupId>
Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/helloworld-frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>ms.dew.devops.it</groupId>
Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/helloworld-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>ms.dew.devops.it</groupId>
Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/todo/backend/libraries/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-parent</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/todo/backend/services/compute/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-parent</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/todo/backend/services/kernel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-parent</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/todo/backend/services/notifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-parent</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion devops/it/src/it/todo/frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>ms.dew.devops.it</groupId>
Expand Down
6 changes: 3 additions & 3 deletions devops/it/src/it/todo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>

<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-parent</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
Expand All @@ -53,7 +53,7 @@
<dependency>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-common</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class HelloWorldLibraryVerify extends BasicProcessor implements Verify {
@Override
public void doVerify(String buildPath, String expectedResPath) throws Exception {
loadConfig();
String metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/helloworld-library/2.0.0-beta2/maven-metadata.xml");
String metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/helloworld-library/2.0.0-SNAPSHOT/maven-metadata.xml");
Document doc = JOOX.builder().parse(new ByteArrayInputStream(metaData.getBytes()));
String lastUpdateTime = JOOX.$(doc).find("lastUpdated").get(0).getTextContent();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void doVerify(String buildPath, String expectedResPath) throws Exception
loadConfig();

// verify parent
String metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/todo-parent/2.0.0-beta2/maven-metadata.xml");
String metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/todo-parent/2.0.0-SNAPSHOT/maven-metadata.xml");
Document doc = JOOX.builder().parse(new ByteArrayInputStream(metaData.getBytes()));
String lastUpdateTime = JOOX.$(doc).find("lastUpdated").get(0).getTextContent();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Expand All @@ -48,7 +48,7 @@ public void doVerify(String buildPath, String expectedResPath) throws Exception
Assert.assertTrue("parent | last deploy time check", offsetMinutes < 5);

// verify common
metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/todo-common/2.0.0-beta2/maven-metadata.xml");
metaData = $.http.get(itSnapshotRepositoryUrl + "ms/dew/devops/it/todo-common/2.0.0-SNAPSHOT/maven-metadata.xml");
doc = JOOX.builder().parse(new ByteArrayInputStream(metaData.getBytes()));
lastUpdateTime = JOOX.$(doc).find("lastUpdated").get(0).getTextContent();
sdf = new SimpleDateFormat("yyyyMMddHHmmss");
Expand Down
4 changes: 2 additions & 2 deletions devops/maven/dew-maven-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../../framework/modules/parent-starter</relativePath>
</parent>

<artifactId>dew-maven-agent</artifactId>
<packaging>jar</packaging>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<name>2.1 Dew DevOps Maven Agent</name>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion devops/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<artifactId>build-devops</artifactId>
<name>2 Dew Devops Build</name>
<packaging>pom</packaging>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>

<properties>
<maven.install.skip>true</maven.install.skip>
Expand Down
2 changes: 1 addition & 1 deletion devops/sh/dew-devops.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MINIO_BUCKET_NAME=dew
GITLAB_URL=http://gitlab.dew.ms
GITLAB_RUNNER_NAMESPACE=devops
GITLAB_RUNNER_NAME=dew-runner
GITLAB_RUNNER_IMAGE=dewms/devops:2.0.0-beta2
GITLAB_RUNNER_IMAGE=dewms/devops:2.0.0-SNAPSHOT
GITLAB_RUNNER_REG_TOKEN=3mezus8cX9qAjkrNY4B
GITLAB_RUNNER_PROFILE=test

Expand Down
4 changes: 2 additions & 2 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../framework/modules/parent-starter</relativePath>
</parent>

<artifactId>docs</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>4 Dew Docs</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
</parent>
<groupId>ms.dew.devops.it</groupId>
<artifactId>todo-frontend</artifactId>
Expand Down
5 changes: 4 additions & 1 deletion docs/src/main/asciidoc/_chapter/framework/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ dew: # Dew 参数key前缀
router: # 路由功能
enabled: false # 是否启用
black-uri: # URL黑名单,支持ant风格
<Http Method>: [<URLs>] # URL黑名单列表
<Http Method>: [<URLs>] # URL黑名单列表,Method = all 表示所有方法
role-auth: # 角色认证
<Role Code>: # 角色编码
<Http Method>: [<URLs>] # 只有该角色才能访问的URL,支持ant风格,Method = all 表示所有方法
token-kinds: # Token类型,可为不同的Token类型设置不同的过期时间、保留的版本
<Kind>: # Token类型名称,比如 PC/Android/... ,默认会创建名为 DEFAULT 的类型
expire-sec: 86400 # Token 过期时间(秒)
Expand Down
16 changes: 14 additions & 2 deletions docs/src/main/asciidoc/_chapter/framework/user-manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,10 @@ dew:
router: # 路由功能
enabled: false # 是否启用
black-uri: # URL黑名单,支持ant风格
<Http Method>: [<URLs>] # URL黑名单列表
<Http Method>: [<URLs>] # URL黑名单列表,Method = all 表示所有方法
role-auth: # 角色认证
<Role Code>: # 角色编码
<Http Method>: [<URLs>] # 只有该角色才能访问的URL,支持ant风格,Method = all 表示所有方法
token-kinds: # Token类型,可为不同的Token类型设置不同的过期时间、保留的版本
<Kind>: # Token类型名称,比如 PC/Android/... ,默认会创建名为 DEFAULT 的类型
expire-sec: 86400 # Token 过期时间(秒)
Expand Down Expand Up @@ -848,7 +851,16 @@ public Resp<String> login(@RequestBody LoginDTO loginDTO) {
.setAccountCode($.field.createShortUUID())
.setToken(token)
.setName(user.getName())
.setMobile(user.getPhone()));
.setMobile(user.getPhone())
.setRoleInfo(new HashSet<OptInfo.RoleInfo>() {
{
add(new OptInfo.RoleInfo()
.setCode(userDTO.getRole())
.setName("..")
.setTenantCode("")
);
}
}));
return Resp.success(token);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/book.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Dew:一站式微服务解决方案 [2.x Building...]
v2.0.0-beta2
v2.0.0-SNAPSHOT
:doctype: book
:encoding: utf-8
:lang: zh-CN
Expand Down
2 changes: 1 addition & 1 deletion examples/auth-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/bone-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/cloud-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/cluster-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/hbase-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/idempotent-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<artifactId>build-example</artifactId>
<name>3 Dew Example Build</name>
<packaging>pom</packaging>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>

<properties>
<maven.install.skip>true</maven.install.skip>
Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-invoke1-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/tracing-invoke2-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion examples/web-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../framework/modules/parent-starter</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion framework/components/auth-sdk-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>ms.dew</groupId>
<artifactId>parent-starter</artifactId>
<version>2.0.0-beta2</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../modules/parent-starter/</relativePath>
</parent>

Expand Down
Loading

0 comments on commit bcaa630

Please sign in to comment.