Example usage for org.apache.shiro.web.filter.authz AuthorizationFilter getUnauthorizedUrl

List of usage examples for org.apache.shiro.web.filter.authz AuthorizationFilter getUnauthorizedUrl

Introduction

In this page you can find the example usage for org.apache.shiro.web.filter.authz AuthorizationFilter getUnauthorizedUrl.

Prototype

public String getUnauthorizedUrl() 

Source Link

Document

Returns the URL to which users should be redirected if they are denied access to an underlying path or resource, or null if a raw HttpServletResponse#SC_UNAUTHORIZED response should be issued (401 Unauthorized).

Usage

From source file:com.centfor.frame.shiro.FrameShiroFilterFactoryBean.java

License:Apache License

private void applyUnauthorizedUrlIfNecessary(Filter filter) {
    String unauthorizedUrl = getUnauthorizedUrl();
    if (StringUtils.hasText(unauthorizedUrl) && (filter instanceof AuthorizationFilter)) {
        AuthorizationFilter authzFilter = (AuthorizationFilter) filter;
        //only apply the unauthorizedUrl if they haven't explicitly configured one already:
        String existingUnauthorizedUrl = authzFilter.getUnauthorizedUrl();
        if (existingUnauthorizedUrl == null) {
            authzFilter.setUnauthorizedUrl(unauthorizedUrl);
        }// w w w.ja  v  a2  s . com
    }
}