mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
refactor:调整生成环境的命名空间
This commit is contained in:
parent
026b064b66
commit
c653b63c32
@ -152,13 +152,13 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||||
<!--<execution>
|
<execution>
|
||||||
<id>build-image</id>
|
<id>build-image</id>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>build</goal>
|
<goal>build</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>-->
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
|
@ -8,9 +8,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: http://c.youlai.store:8848
|
server-addr: http://c.youlai.store:8848
|
||||||
|
namespace: prod_namespace_id
|
||||||
config:
|
config:
|
||||||
# docker启动nacos-server需要配置
|
# docker启动nacos-server需要配置
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
group: DEFAULT_GROUP
|
|
||||||
prefix: ${spring.application.name}
|
prefix: ${spring.application.name}
|
||||||
|
namespace: prod_namespace_id
|
||||||
|
@ -72,12 +72,6 @@
|
|||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
|
||||||
<version>2.1.3.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
@ -93,7 +87,13 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
<!--执行mvn package,即执行 mvn clean package docker:build-->
|
||||||
|
<execution>
|
||||||
|
<id>build-image</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
|
@ -35,6 +35,8 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<AuthorizationDecision> check(Mono<Authentication> mono, AuthorizationContext authorizationContext) {
|
public Mono<AuthorizationDecision> check(Mono<Authentication> mono, AuthorizationContext authorizationContext) {
|
||||||
|
|
||||||
|
|
||||||
ServerHttpRequest request = authorizationContext.getExchange().getRequest();
|
ServerHttpRequest request = authorizationContext.getExchange().getRequest();
|
||||||
String path = request.getMethodValue() + "_" + request.getURI().getPath();
|
String path = request.getMethodValue() + "_" + request.getURI().getPath();
|
||||||
PathMatcher pathMatcher = new AntPathMatcher();
|
PathMatcher pathMatcher = new AntPathMatcher();
|
||||||
@ -48,11 +50,14 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
|
|||||||
return Mono.just(new AuthorizationDecision(true));
|
return Mono.just(new AuthorizationDecision(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// token为空拒绝访问
|
// token为空拒绝访问
|
||||||
String token = request.getHeaders().getFirst(AuthConstants.JWT_TOKEN_HEADER);
|
String token = request.getHeaders().getFirst(AuthConstants.JWT_TOKEN_HEADER);
|
||||||
if (StrUtil.isBlank(token)) {
|
if (StrUtil.isBlank(token)) {
|
||||||
return Mono.just(new AuthorizationDecision(false));
|
return Mono.just(new AuthorizationDecision(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 从缓存取资源权限角色关系列表
|
// 从缓存取资源权限角色关系列表
|
||||||
Map<Object, Object> permissionRoles = redisTemplate.opsForHash().entries(AuthConstants.PERMISSION_ROLES_KEY);
|
Map<Object, Object> permissionRoles = redisTemplate.opsForHash().entries(AuthConstants.PERMISSION_ROLES_KEY);
|
||||||
Iterator<Object> iterator = permissionRoles.keySet().iterator();
|
Iterator<Object> iterator = permissionRoles.keySet().iterator();
|
||||||
@ -64,6 +69,8 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
|
|||||||
authorities.addAll(Convert.toList(String.class, permissionRoles.get(pattern)));
|
authorities.addAll(Convert.toList(String.class, permissionRoles.get(pattern)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("require authorities:{}", authorities);
|
||||||
|
|
||||||
Mono<AuthorizationDecision> authorizationDecisionMono = mono
|
Mono<AuthorizationDecision> authorizationDecisionMono = mono
|
||||||
.filter(Authentication::isAuthenticated)
|
.filter(Authentication::isAuthenticated)
|
||||||
.flatMapIterable(Authentication::getAuthorities)
|
.flatMapIterable(Authentication::getAuthorities)
|
||||||
|
@ -10,6 +10,8 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: http://c.youlai.store:8848
|
server-addr: http://c.youlai.store:8848
|
||||||
|
namespace: prod_namespace_id
|
||||||
config:
|
config:
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
|
namespace: prod_namespace_id
|
||||||
|
Loading…
Reference in New Issue
Block a user