List of usage examples for org.springframework.security.web FilterInvocation getResponse
public HttpServletResponse getResponse()
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 . java 2s. c o 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 {/* www . j a v a 2 s . c o m*/ fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); } finally { super.afterInvocation(token, null); } }
From source file:grails.plugin.springsecurity.web.access.channel.HeaderCheckInsecureChannelProcessor.java
@Override public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException, ServletException { Assert.isTrue(invocation != null && config != null, "Nulls cannot be provided"); for (ConfigAttribute attribute : config) { if (supports(attribute)) { if (headerValue.equals(invocation.getHttpRequest().getHeader(headerName))) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); }/*from w w w. ja va 2 s .com*/ } } }
From source file:nanshen.service.impl.SpringSecureChannelProcessor.java
@Override public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException, ServletException { Assert.isTrue((invocation != null) && (config != null), "Nulls cannot be provided"); for (ConfigAttribute attribute : config) { if (supports(attribute)) { HttpServletRequest httpRequest = invocation.getHttpRequest(); if (!httpRequest.isSecure() && StringUtils.isBlank(httpRequest.getHeader("HTTPS"))) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); }//from w ww . j a v a2s . co m } } }
From source file:org.wallride.support.ProxySecureChannelProcessor.java
@Override public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException, ServletException { Assert.isTrue((invocation != null) && (config != null), "Nulls cannot be provided"); String forwardedProto = invocation.getHttpRequest().getHeader("X-Forwarded-Proto"); for (ConfigAttribute attribute : config) { if (supports(attribute)) { if (forwardedProto != null) { if (!forwardedProto.equals("https")) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); }//from w w w . j a v a2 s.com } else { if (!invocation.getHttpRequest().isSecure()) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); } } } } }
From source file:org.wallride.support.ProxyInsecureChannelProcessor.java
@Override public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException, ServletException { if ((invocation == null) || (config == null)) { throw new IllegalArgumentException("Nulls cannot be provided"); }/*from w w w .j a v a2 s. c o m*/ String forwardedProto = invocation.getHttpRequest().getHeader("X-Forwarded-Proto"); for (ConfigAttribute attribute : config) { if (supports(attribute)) { if (forwardedProto != null) { if (forwardedProto.equals("https")) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); } } else { if (invocation.getHttpRequest().isSecure()) { getEntryPoint().commence(invocation.getRequest(), invocation.getResponse()); } } } } }
From source file:cn.net.withub.demo.bootsec.hello.security.CustomSecurityFilter.java
private void invoke(FilterInvocation fi) throws IOException, ServletException { // objectFilterInvocation //1.????// w w w . j a va2 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 */// w w w . j ava 2 s.com 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()); } }
From source file:org.springframework.security.saml.metadata.MetadataDisplayFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { FilterInvocation fi = new FilterInvocation(request, response, chain); if (!processFilter(fi.getRequest())) { chain.doFilter(request, response); return;/* w ww . j a va2 s . c om*/ } processMetadataDisplay(fi.getRequest(), fi.getResponse()); }