Shrio : This subject is anonymous - it does not have any identifying principals and
2016-11-24 11:23
966 查看
使用shrio,集成到springmvc后,访问带有@RequirePermission注解的方法,This subject is anonymous - it does not have any identifying principals and authorization operations require an identity
to check against. A Subject instance will acquire these identifying principals automatically after a successful login is performed ..
未登录的情况下,访问需要登陆后才能使用的链接回抛出如上异常。解决方法是,在springmvc.xml中添加全局异常捕获,捕获异常类:org.apache.shiro.authz.UnauthenticatedException。
<prop key="org.apache.shiro.authz.UnauthenticatedException">error/403</prop><!-- 其他 -->
<prop key="java.lang.Throwable">error/500</prop>
</props>
</property>
</bean>
to check against. A Subject instance will acquire these identifying principals automatically after a successful login is performed ..
未登录的情况下,访问需要登陆后才能使用的链接回抛出如上异常。解决方法是,在springmvc.xml中添加全局异常捕获,捕获异常类:org.apache.shiro.authz.UnauthenticatedException。
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props>
<!-- 未登录验证异常 --><prop key="org.apache.shiro.authz.UnauthorizedException">error/403</prop><!-- 未授权使用的异常 -->
<prop key="org.apache.shiro.authz.UnauthenticatedException">error/403</prop><!-- 其他 -->
<prop key="java.lang.Throwable">error/500</prop>
</props>
</property>
</bean>
相关文章推荐
- AWS S3对象无法下载——This XML file does not appear to have any style information associated with it
- SVN :This XML file does not appear to have any style information associated with it.
- Device 'xilinx-keypad' does not have a release() function, it is broken and must be fixed.
- The disk cannot be added to Cluster Shared Volumes because it does not have any suitable partitions
- 警告: Scene is unreachable due to lack of entry points and does not have an identifier for runtime acc
- Android 4.2 Feature Highlight: So, What Is This Miracast Thing And How Does It Work, Anyway?
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not have permission.
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier解决办法
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access
- [Java]The project 'XXX' does not have any GWT SDK's on its build path
- /dev/hdX does not have any corresponding BIOS drive and Solution问题的处理
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access
- 使用Storyboard时出现以下警告:Scene is unreachable due to lack of entry points and does not have an identifier
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access
- Scene is unreachable due to lack of entry points and does not have an identifier for runtime access
- Swift: 消除警告-Scene is unreachable due to lack of entry points and does not have an identifier for
- Cannot find ./catalina.sh The file is absent or does not have execute permission This file is nee
- Cannot find ./catalina.sh The file is absent or does not have execute permission This file is nee
- Database diagram support objects cannot be installed because this database does not have a valid owner.