问题描述
我正在使用 Wso2 IS 5.11.0
,我需要通过调用基于 Web 服务来获取用户属性。
public class CustomPIPAttributeFinder extends AbstractPIPAttributeFinder {
private static final String PIP_NAME = "CustomPIPAttributeFinder";
private static final Set<String> SUPPORTED_ATTRIBUTES;
private static final Log log = LogFactory.getLog(CustomPIPAttributeFinder.class);
static {
SUPPORTED_ATTRIBUTES = new HashSet<String>();
SUPPORTED_ATTRIBUTES.add(CustomPIPConstants.SAMPLE_ATTRIBUTE_ID);
SUPPORTED_ATTRIBUTES.add(CustomPIPConstants.SAMPLE_ATTRIBUTE_NAME);
SUPPORTED_ATTRIBUTES.add(CustomPIPConstants.SAMPLE_CATEGORY);
}
@Override
public Set<String> getAttributeValues(URI attributeType,URI attributeId,URI category,String issuer,EvaluationCtx evaluationCtx) throws Exception {
//code
}
private String retrieveSampleName(String accesstoken) {
String sampleName = null;
// Todo: Get the value of the sample name from the sampleID from the datasource
return sampleName;
}
/**
* Since we override the {@link #getAttributeValues(URI,URI,String,EvaluationCtx)} this won't be called.
*/
@Override
public Set<String> getAttributeValues(String subject,String resource,String action,String environment,String attributeId,String issuer) throws Exception {
throw new UnsupportedOperationException("Method unsupported in the context");
}
public void init(Properties properties) throws Exception {
}
public String getModuleName() {
return PIP_NAME;
}
public Set<String> getSupportedAttributes() {
return SUPPORTED_ATTRIBUTES;
}
}
在示例代码中,我们每个请求只能获取一个属性。但是我们如何在执行策略之前返回多个属性或从自定义属性查找器的一个请求中获取多个属性。有什么办法可以实现这个流程。
根据上面示例中的请求属性 find(returns only one
) 代码,它会增加开销,因为我们每次调用 web-service 的每个属性查找都会增加开销。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)