我'm unable to persist custom claims VIA a custom authenticator using WSO2 API manager 1.9.0. For context, I'一直试图模仿custom twitter authenticator并使用JWT将声明传递给我们的后端 .
验证器看起来像这样:
@Override
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) {
String username = (String) request.getAttribute("userName");
//authenticate
//try to persist claims
context.setSubject(username);
Map<ClaimMapping, String> claims = new HashMap<ClaimMapping, String>();
claims.put(ClaimMapping.build("http://wso2.org/claims/myCustomClaim",
"http://wso2.org/claims/myCustomClaim", null, false), "some_value");
context.setSubjectAttributes(claims);
}
我还将 http://wso2.org/claims/myCustomClaim
添加到 http://wso2.org/claims
中找到的默认wso2声明中
检查数据库在 / repository / database / WSO2CARBON_DB和 / repository / database / WSO2AM_DB找到的两个h2数据库我无法找到持久存在的“some_value”(即使我只是grep 目录“SOME_VALUE” .
是否需要一些额外的配置才能使其工作?
1 回答
不确定是不是原因,但我发现以下有关索赔:https://wso2.org/jira/browse/IDENTITY-3016
“之前这是不可能的,因为我们需要从登录用户那里了解租户域 . 但是从IS 5.0开始,这是可能的,因为我们将租户域作为URL的一部分发送” .
可能是AM 1.9落后于IS 5.0?