Java Spring安全/授权级别

Java Spring安全/授权级别,java,spring,jsp,spring-mvc,spring-security,Java,Spring,Jsp,Spring Mvc,Spring Security,我在我的web应用程序中使用Spring security,我使用两个标准授权级别“角色用户”和“角色管理员”。是否有可能添加其他级别?只需将它们添加到您的拦截url标记中即可。例如,我有以下配置: <security:http auto-config="false" use-expressions="true" access-denied-page="/denied.do" entry-point-ref="authenticationEntryPo

我在我的web应用程序中使用Spring security,我使用两个标准授权级别“角色用户”和“角色管理员”。是否有可能添加其他级别?

只需将它们添加到您的拦截url标记中即可。例如,我有以下配置:

<security:http auto-config="false" use-expressions="true" access-denied-page="/denied.do"
                   entry-point-ref="authenticationEntryPoint">
    <security:intercept-url pattern="/index.do" access="hasAnyRole('PROGRAM_VIEW', 'PROGRAM_ADMIN')"/>
    <security:intercept-url pattern="/**" access="hasAnyRole('PROGRAM_VIEW', 'PROGRAM_ADMIN)"/>

    <security:custom-filter ref="authenticationFilter" position="FORM_LOGIN_FILTER"/>

    <security:logout invalidate-session="true" logout-success-url="/" logout-url="/logout.do"/>
</security:http>

我的其他角色是PROGRAM_VIEW和PROGRAM_ADMIN(我没有使用ROLE_ADMIN和ROLE_USER)


这些额外的角色来自数据库。

是的,但如何定义自定义角色?好的,太好了!例如,如果我想使用标签,会发生什么?我可以用我的cutom角色替换角色\u ADMIN吗?可以。此处示例:(此处自定义角色为“主管”)。或者看一下