Example usage for org.springframework.security.web FilterInvocation getChain

List of usage examples for org.springframework.security.web FilterInvocation getChain

Introduction

In this page you can find the example usage for org.springframework.security.web FilterInvocation getChain.

Prototype

public FilterChain getChain() 

Source Link

Usage

From source file:org.trustedanalytics.user.invite.MockedSecurityInterceptor.java

@Override
public void invoke(FilterInvocation fi) throws IOException, ServletException {
    if ((fi.getRequest() != null)) {
        fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
    }/*from   w  w  w. j  a v a  2s.co m*/
}

From source file:com.gcrm.security.SecurityFilter.java

private void invoke(FilterInvocation fi) throws IOException, ServletException {
    InterceptorStatusToken token = null;

    token = super.beforeInvocation(fi);

    try {//w ww.java2  s  .  c o  m
        fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
    } finally {
        super.afterInvocation(token, null);
    }
}

From source file:cn.net.withub.demo.bootsec.hello.security.CustomSecurityFilter.java

private void invoke(FilterInvocation fi) throws IOException, ServletException {
    // objectFilterInvocation
    //1.????//from w w w. ja v  a  2 s.c  o m
    //Collection<ConfigAttribute> attributes = SecurityMetadataSource.getAttributes(object);
    //2.???
    //???UserDetails
    //1) UserDetails
    // Authentication authenticated = authenticateIfRequired();
    //this.accessDecisionManager.decide(authenticated, object, attributes);
    //??
    //2) GrantedAuthority
    //Collection<GrantedAuthority> authenticated.getAuthorities()
    System.out.println("??? ");
    InterceptorStatusToken token = null;

    token = super.beforeInvocation(fi);

    try {
        fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
    } finally {
        super.afterInvocation(token, null);
    }
}

From source file:org.anyframe.iam.core.intercept.web.RestrictedTimesFilterSecurityInterceptor.java

/**
 * Main method of filter to check restricted times
 *///from   www  .j a v a 2  s .c o  m
public void invoke(FilterInvocation fi) throws IOException, ServletException {

    if ((fi.getRequest() != null) && (fi.getRequest().getAttribute(FILTER_APPLIED) != null)
            && isObserveOncePerRequest()) {

        fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
    } else {

        if (fi.getRequest() != null) {
            fi.getRequest().setAttribute(FILTER_APPLIED, Boolean.TRUE);
        }

        // Role ? Resource ?  (Voter ? ACCESS/DENIED ? )
        // FilterInvocation ? wrapping 
        FilterInvocationWrapper fiWrapper = new FilterInvocationWrapper(fi);

        // alwaysTimeRoleCheck
        if (logger.isDebugEnabled())
            logger.debug("== alwaysTimeRoleCheck started ==");
        RestrictedResourceHolder.setPresentResource(RestrictedResourceHolder.RESTRICTED_RESOURCE_TYPE[0]);
        super.beforeInvocation(fiWrapper);

        // dailyFilteredTimeRoleCheck
        if (logger.isDebugEnabled())
            logger.debug("== dailyFilteredTimeRoleCheck started ==");
        RestrictedResourceHolder.setPresentResource(RestrictedResourceHolder.RESTRICTED_RESOURCE_TYPE[1]);
        super.beforeInvocation(fiWrapper);

        // alwaysTimeResourceCheck
        if (logger.isDebugEnabled())
            logger.debug("== alwaysTimeResourceCheck started ==");
        RestrictedResourceHolder.setPresentResource(RestrictedResourceHolder.RESTRICTED_RESOURCE_TYPE[2]);
        super.beforeInvocation(fi);

        // dailyFilteredTimeResourceCheck
        if (logger.isDebugEnabled())
            logger.debug("== dailyFilteredTimeResourceCheck started ==");
        RestrictedResourceHolder.setPresentResource(RestrictedResourceHolder.RESTRICTED_RESOURCE_TYPE[3]);
        super.beforeInvocation(fi);

        fi.getChain().doFilter(fi.getRequest(), fi.getResponse());

    }
}