public class PortalAuthPlugin
extends org.apache.shenyu.plugin.base.AbstractShenyuPlugin
1. AES/ECB/PKCS5Padding decryption: reads request body, extracts "portalReq" field, decrypts it with the configured AES key, and replaces the body with decrypted content. Supports both JSON body ({"portalReq":"..."}) and form-urlencoded body (portalReq=...). 2. Menu permission check: reads "activeName" header, gets userId from CAS-injected header "X-mUserId", and calls HSF generic invocation to verify menu access permission.
Form-urlencoded support is used for /rest/transfer/** transparent proxy routes. The old gateway decrypts portalReq (AES) from form params, splits into key=value pairs, re-encodes with URLEncoder, and forwards as form body. This plugin replicates that behavior. Note: CAS plugin (order=1035) calls exchange.getFormData() for POST requests, which consumes the body for form-urlencoded content-type. So we use the cached formData instead of raw body.
| 构造器和说明 |
|---|
PortalAuthPlugin(java.util.List<org.springframework.http.codec.HttpMessageReader<?>> messageReaders)
Instantiates a new Portal auth plugin.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected reactor.core.publisher.Mono<java.lang.Void> |
doExecute(org.springframework.web.server.ServerWebExchange exchange,
org.apache.shenyu.plugin.api.ShenyuPluginChain chain,
org.apache.shenyu.common.dto.SelectorData selector,
org.apache.shenyu.common.dto.RuleData rule) |
int |
getOrder() |
java.lang.String |
named() |
execute, handleRuleIfNull, handleSelectorIfNullpublic PortalAuthPlugin(java.util.List<org.springframework.http.codec.HttpMessageReader<?>> messageReaders)
messageReaders - the message readers for body parsingprotected reactor.core.publisher.Mono<java.lang.Void> doExecute(org.springframework.web.server.ServerWebExchange exchange,
org.apache.shenyu.plugin.api.ShenyuPluginChain chain,
org.apache.shenyu.common.dto.SelectorData selector,
org.apache.shenyu.common.dto.RuleData rule)
doExecute 在类中 org.apache.shenyu.plugin.base.AbstractShenyuPluginpublic int getOrder()
public java.lang.String named()
Copyright © 2026 The Apache Software Foundation. All rights reserved.