Example usage for org.apache.shiro.web.util WebUtils getPathWithinApplication

List of usage examples for org.apache.shiro.web.util WebUtils getPathWithinApplication

Introduction

In this page you can find the example usage for org.apache.shiro.web.util WebUtils getPathWithinApplication.

Prototype

public static String getPathWithinApplication(HttpServletRequest request) 

Source Link

Document

Return the path within the web application for the given request.

Usage

From source file:cn.dreampie.common.plugin.shiro.plugin.ShiroKit.java

License:Apache License

static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) {
    /*//from   w w  w .  jav  a  2  s . c  o m
    if(authzMaps.containsKey(controllerClassName)){
         return true;
      }*/
    List<AuthzHandler> result = new ArrayList<AuthzHandler>();
    String url = WebUtils.getPathWithinApplication(request);
    for (String key : authzJdbcMaps.keySet()) {
        if (antPathMatcher.match(key, url)) {
            result.add(authzJdbcMaps.get(key));
        }
    }
    return result;
}

From source file:cn.dreampie.shiro.core.ShiroKit.java

License:Apache License

static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) {
    /*//from   ww w. j a v  a  2 s .  c  o  m
    if(authzMaps.containsKey(controllerClassName)){
         return true;
      }*/
    List<AuthzHandler> result = new ArrayList<AuthzHandler>();
    String url = WebUtils.getPathWithinApplication(request);
    for (String key : authzJdbcMaps.keySet()) {
        if (antPathMatcher.match(key, url)) {
            result.add(authzJdbcMaps.get(key));
            if (!and)
                break;
        }
    }
    return result;
}

From source file:com.dbumama.market.web.core.plugin.shiro.ShiroKit.java

License:Apache License

static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) {
    /*//from  w w w.ja v a  2s.  com
     * if(authzMaps.containsKey(controllerClassName)){ return true; }
     */
    List<AuthzHandler> result = new ArrayList<AuthzHandler>();
    String url = WebUtils.getPathWithinApplication(request);
    if (authzJdbcMaps != null) {
        for (String key : authzJdbcMaps.keySet()) {
            if (antPathMatcher.match(key, url)) {
                result.add(authzJdbcMaps.get(key));
                if (!and)
                    break;
            }
        }
    }
    return result;
}

From source file:com.ftww.basic.plugin.shiro.core.ShiroKit.java

License:Apache License

static List<AuthzHandler> getJdbcAuthzHandler(HttpServletRequest request) {
    /*/* w  w  w  . j a v  a2  s .c  o m*/
     * if(authzMaps.containsKey(controllerClassName)){ return true; }
     */
    List<AuthzHandler> result = new ArrayList<AuthzHandler>();
    String url = WebUtils.getPathWithinApplication(request);
    for (String key : authzJdbcMaps.keySet()) {
        if (antPathMatcher.match(key, url)) {
            result.add(authzJdbcMaps.get(key));
            if (!and) //andtrue???andfalse????
                break;
        }
    }
    return result;
}

From source file:com.yea.shiro.web.filter.authz.PermissionsAuthorizationFilter.java

License:Apache License

protected String getPathWithinApplication(ServletRequest request) {
    return WebUtils.getPathWithinApplication(WebUtils.toHttp(request));
}

From source file:com.yea.shiro.web.interceptor.ShiroInterceptor.java

License:Apache License

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    // TODO Auto-generated method stub
    Enumeration<String> names = request.getParameterNames();
    while (names.hasMoreElements()) {
        if (names.nextElement().equals("menu")) {
            Subject subject = SecurityUtils.getSubject();
            if (subject.isAuthenticated() || subject.isRemembered()) {
                String requestURI = WebUtils.getPathWithinApplication(request);
                SystemMenu menu = (SystemMenu) subject.getSession().getAttribute(ShiroConstants.SYSTEM_MENU);
                if (menu != null) {
                    menu.setCurrMenu(requestURI);
                }/* w  ww .j  a va  2 s . c om*/
            }
        }
    }
    return true;
}

From source file:io.github.howiefh.jeews.modules.sys.security.filter.StatelessAuthenticationFilter.java

License:Apache License

protected boolean canAccessPostRequest(ServletRequest request, ServletResponse response) {
    HttpServletRequest httpRequest = WebUtils.toHttp(request);
    String url = WebUtils.getPathWithinApplication(httpRequest);
    return (request instanceof HttpServletRequest) && httpRequest.getMethod().equalsIgnoreCase(POST_METHOD)
            && ignoreUrls.contains(url);
}

From source file:net.scran24.common.server.auth.ScranAuthFilter.java

private boolean isLoginPage(HttpServletRequest request) {
    String path = WebUtils.getPathWithinApplication(request);

    if (path.endsWith("/login/"))
        return true;
    else/*from  w  ww.  j  a  v a 2 s. c  o m*/
        return false;
}

From source file:net.scran24.common.server.auth.ScranAuthFilter.java

private Option<String> getLoginPage(HttpServletRequest request) {
    String path = WebUtils.getPathWithinApplication(request);

    if (path.equals("/admin/") || path.equals("/admin"))
        return Option.some("/admin/login/");
    else if (path.startsWith("/surveys/") && path.length() > 9) {
        String s = path.substring(9);
        if (!s.endsWith("/"))
            s += "/";
        String surveyId = s.substring(0, s.indexOf('/'));
        return Option.some("/surveys/" + surveyId + "/login/");
    } else//  w w  w.  j  a v a2 s  .c o m
        // trying to access an invalid page, send an error
        return Option.none();
}

From source file:net.scran24.common.server.auth.ScranAuthFilter.java

private boolean isUserPage(HttpServletRequest request, String surveyId) {
    String path = WebUtils.getPathWithinApplication(request);
    return path.equals("/surveys/" + surveyId + "/");
}