身份验证扩展

扩展说明

参数验证扩展点。

扩展端口

org.apache.dubbo.validation.Validation

扩展配置

<dubbo:service validation="xxx,yyy" />
<!-- The default value setting, when <dubbo:service> does not configure the authentication attribute, use this configuration -->
<dubbo:provider validation="xxx,yyy" />

已知扩展

org.apache.dubbo.validation.support.jvalidation.JValidation

扩展示例

Maven 项目结构

src
 |-main
    |-java
        |-com
            |-xxx
                |-XxxValidation.java (implement Validation interface)
    |-resources
        |-META-INF
            |-dubbo
                |-org.apache.dubbo.validation.Validation (plain text file, content: xxx=com.xxx.XxxValidation)

XxxValidation.java

package com.xxx;
 
import org.apache.dubbo.validation.Validation;
 
public class XxxValidation implements Validation {
    public Object getValidator(URL url) {
        //...
    }
}

XxxValidator.java

package com.xxx;
 
import org.apache.dubbo.validation.Validator;
 
public class XxxValidator implements Validator {
    public XxxValidator(URL url) {
        //...
    }
    public void validate(Invocation invocation) throws Exception {
        //...
    }
}

META-INF/dubbo/org.apache.dubbo.validation.Validation

xxx=com.xxx.XxxValidation

上次修改时间:2023 年 1 月 2 日: 增强英文文档 (#1798) (95a9f4f6c1c)