Security 使用keydape通过角色保护web资源

Security 使用keydape通过角色保护web资源,security,wildfly-10,keycloak,Security,Wildfly 10,Keycloak,我目前正在检查keydape示例:servlet authz。并了解到它通过web.xml保护了web资源: <security-constraint> <web-resource-collection> <web-resource-name>All Resources</web-resource-name> <url-pattern>/*</url-pattern> <

我目前正在检查keydape示例:servlet authz。并了解到它通过web.xml保护了web资源:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>All Resources</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>user</role-name>
        <role-name>admin</role-name>
        <role-name>user_premium</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>servlet-authz</realm-name>
</login-config>

<security-role>
    <role-name>admin</role-name>
</security-role>

<security-role>
    <role-name>user</role-name>
</security-role>

<security-role>
    <role-name>user_premium</role-name>
</security-role>

所有资源
/*
用户
管理
用户付费
钥匙斗篷
servlet身份验证
管理
用户
用户付费

我的问题是,它能动态实现吗?不使用web.xml?例如,我有一个新角色role\u guest,只能访问/guest/*url。如何配置它?我检查了所有的示例,但到目前为止没有一个这样做。

如果要动态加载所有角色,您必须在
auth约束
安全角色
中都包含带有通配符(*)的web.xml(不幸的是)

允许的所有角色web.xml片段:

...
<security-constraint>
    <web-resource-collection>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>*</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>servlet-authz</realm-name>
</login-config>

<security-role>
    <role-name>*</role-name>
</security-role>
...
。。。
/*
*
钥匙斗篷
servlet身份验证
*
...
我不知道是否有一种方法可以自动将包含角色名称的
url模式附加到每个角色


使用KeyClope适配器版本4.4.0在Wildfly 11上进行了流量测试。最终版。

如果要动态加载所有角色,必须在
身份验证约束
安全角色
中都包含带有通配符(*)的web.xml(不幸)

允许的所有角色web.xml片段:

...
<security-constraint>
    <web-resource-collection>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>*</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>servlet-authz</realm-name>
</login-config>

<security-role>
    <role-name>*</role-name>
</security-role>
...
。。。
/*
*
钥匙斗篷
servlet身份验证
*
...
我不知道是否有一种方法可以自动将包含角色名称的
url模式附加到每个角色


在Wildfly 11上使用Key斗篷适配器版本4.4.0进行了流量测试。最终。

是否要使用Key斗篷Java客户端对Java部件执行此检查?我想知道两者。但现在通过Keyclope应该没问题。我有同样的问题。我正在寻找一个例子或任何没有任何运气的答复。如果您发现了什么,请告诉我…您想使用KeyClope Java客户端对Java部件执行此检查吗?我想知道两者。但现在通过Keyclope应该没问题。我有同样的问题。我正在寻找一个例子或任何没有任何运气的答复。如果你发现了什么请告诉我。。。