我可以定义要返回给服务提供商的静态声明吗?
Can I define static claims to be returned to a Service Provider?
我有一个用例,其中 SAML2 应用程序需要 SAML2 断言中的某些属性。这些不存在于用户属性中,但它们应该具有在该服务提供商的每个 SAML2 断言中返回的静态值。
有什么方法可以在 WSO2 IS 管理控制台中定义这样的静态 attributes/claims 吗?我知道我可以使用 Java 创建自定义索赔处理程序,但我首先寻找不需要自定义代码的解决方案。
此问题类似,但答案不适用于一般情况:wso2is any way to code claim to return static text
您可以为此使用自适应身份验证脚本。 (通过管理控制台支持的简单脚本)
示例:
function onLoginRequest(context) {
executeStep(1, {
onSuccess: function (context) {
var user = context.currentKnownSubject;
var countryClaim = 'http://wso2.org/claims/country';
var countryValue = user.localClaims[countryClaim];
if (countryValue == null){
Log.info('Updating the address - country claim for user.');
context.steps[1].subject.localClaims[countryClaim] = 'Canada';
}
Log.info('Testing of adding default claim value to user.');
}
});
}
文档
我有一个用例,其中 SAML2 应用程序需要 SAML2 断言中的某些属性。这些不存在于用户属性中,但它们应该具有在该服务提供商的每个 SAML2 断言中返回的静态值。
有什么方法可以在 WSO2 IS 管理控制台中定义这样的静态 attributes/claims 吗?我知道我可以使用 Java 创建自定义索赔处理程序,但我首先寻找不需要自定义代码的解决方案。
此问题类似,但答案不适用于一般情况:wso2is any way to code claim to return static text
您可以为此使用自适应身份验证脚本。 (通过管理控制台支持的简单脚本)
示例:
function onLoginRequest(context) {
executeStep(1, {
onSuccess: function (context) {
var user = context.currentKnownSubject;
var countryClaim = 'http://wso2.org/claims/country';
var countryValue = user.localClaims[countryClaim];
if (countryValue == null){
Log.info('Updating the address - country claim for user.');
context.steps[1].subject.localClaims[countryClaim] = 'Canada';
}
Log.info('Testing of adding default claim value to user.');
}
});
}
文档