在wso2身份服务器5.9.0中,是否可以将SP身份验证限制为单个用户存储



我已经在OEL 7.6上安装了wso2身份服务器5.9.0和jdk 11.0.6。我已经为基于OpenID Connect的身份验证配置了一个SP——客户端是Oracle HTTP服务器,mod_auth_oidc将请求代理到weblogic服务器上的应用程序。我已经为SP的用户专门创建了一个辅助用户存储,我想仅使用该辅助用户存储来限制SP身份验证(不使用登录用户名的域前缀(,但找不到任何专门用于此的选项/信息。我也会为其他SP应用程序提供更多的辅助用户存储,它们可能有相同用户名的用户。我看到过一篇关于使用XACML来实现用户存储或角色受限授权策略的帖子——这是针对此类需求的推荐方法吗,还是有其他更简单/更好的方法来实现这一点?

您也可以使用XACML策略。但是在5.9.0中,您可以使用自适应身份验证脚本来控制对特定用户存储的访问。

如果用户来自特定的用户商店,则以上链接的场景将升级。在您的情况下,您不需要。如果用户来自其他用户商店,您可以使用sendError函数。

这是一个示例脚本

var allowedUserstores = ['EMPLOYEES', 'CONTRACTORS'];
var onLoginRequest = function(context) {
executeStep(1, {
onSuccess: function (context) {
// Extracting user store domain of authenticated subject from the first step
var userStoreDomain = context.currentKnownSubject.userStoreDomain;
if (userStoresToStepUp.indexOf(userStoreDomain) < 0) {
sendError('http://www.example.com/error',{'errorcode':'000403','errorMsg':'You are not allowed to login to this app.'});
}
}
});
};

您可以使用XACML进行细粒度访问控制。对于身份验证流程,

  • 通过管理角色发布XACML策略,该策略可以验证用户属性和用户存储,并返回用户是否可以通过身份验证访问资源
  • 您可以按照本文档为服务提供商配置访问控制策略

下面给出了一个基于用户存储对用户进行身份验证的示例XACML策略

<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"  PolicyId="authn_dynamic_userstore_based_policy_template" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" Version="1.0">
<Description>This policy template provides ability to authorize users to a given service provider(defined by SP_NAME) in the authentication flow based on the userstore of the user. Users who are in the userstore,will be allowed any others will be denied.</Description>
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">travelocity.com</AttributeValue>
<AttributeDesignator AttributeId="http://wso2.org/identity/sp/sp-name" Category="http://wso2.org/identity/sp" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
</Match>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">authenticate</AttributeValue>
<AttributeDesignator AttributeId="http://wso2.org/identity/identity-action/action-name" Category="http://wso2.org/identity/identity-action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
</Match>
</AllOf>
</AnyOf>
</Target>
<Rule Effect="Permit" RuleId="permit_by_userstore">
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PRIMARY</AttributeValue>
<AttributeDesignator AttributeId="http://wso2.org/identity/user/user-store-domain" Category="http://wso2.org/identity/user" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">carbon.super</AttributeValue>
<AttributeDesignator AttributeId="http://wso2.org/identity/user/user-tenant-domain" Category="http://wso2.org/identity/user" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
</Apply>
</Apply>
</Condition>
</Rule>
<Rule Effect="Deny" RuleId="deny_others"></Rule>
</Policy>    

相关内容

最新更新