Examples of CsrfFilter


Examples of hirondelle.web4j.security.CsrfFilter

    HttpSession session = getRequestParser().getRequest().getSession(DO_NOT_CREATE);
    if( session == null ) {
      fLogger.fine("No session exists. Creating new session, outside of regular login.");
      session = getRequestParser().getRequest().getSession(CREATE_IF_MISSING);
      fLogger.fine("Adding CSRF token to the new session, to defend against CSRF attacks.");
      CsrfFilter csrfFilter = new CsrfFilter();
      try {
        csrfFilter.addCsrfToken(getRequestParser().getRequest());
      }
      catch (ServletException ex){
        throw new RuntimeException(ex);
      }
    }
View Full Code Here

Examples of org.springframework.security.web.csrf.CsrfFilter

    }

    @SuppressWarnings("unchecked")
    @Override
    public void configure(H http) throws Exception {
        CsrfFilter filter = new CsrfFilter(csrfTokenRepository);
        if(requireCsrfProtectionMatcher != null) {
            filter.setRequireCsrfProtectionMatcher(requireCsrfProtectionMatcher);
        }
        AccessDeniedHandler accessDeniedHandler = createAccessDeniedHandler(http);
        if(accessDeniedHandler != null) {
            filter.setAccessDeniedHandler(accessDeniedHandler);
        }
        LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
        if(logoutConfigurer != null) {
            logoutConfigurer.addLogoutHandler(new CsrfLogoutHandler(csrfTokenRepository));
        }
View Full Code Here

Examples of org.springframework.security.web.csrf.CsrfFilter

     *            {@link CsrfTokenRepository}
     * @return the {@link CsrfTokenRepository} for the specified
     *         {@link HttpServletRequest}
     */
    public static CsrfTokenRepository getCsrfTokenRepository(HttpServletRequest request) {
        CsrfFilter filter = findFilter(request, CsrfFilter.class);
        if(filter == null) {
            return DEFAULT_TOKEN_REPO;
        }
        return (CsrfTokenRepository) ReflectionTestUtils.getField(filter, "tokenRepository");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.