Package org.hdiv.config

Examples of org.hdiv.config.HDIVConfig


    };
  }

  @Test
  public void config() {
    HDIVConfig config = configuration.hdivConfig();
    assertNotNull(config);
   
    assertEquals(true, config.isDebugMode());
    assertEquals(false, config.getConfidentiality());
    assertEquals("/customErrorPage.html", config.getErrorPage());
    assertEquals(true, config.isRandomName());
    assertEquals(Strategy.CIPHER, config.getStrategy());
    assertEquals(false, config.isValidationInUrlsWithoutParamsActivated());
  }
View Full Code Here


    assertEquals(false, config.isValidationInUrlsWithoutParamsActivated());
  }
 
  @Test
  public void exclusions() {
    HDIVConfig config = configuration.hdivConfig();
    assertNotNull(config);
   
    assertEquals(true, config.isStartPage("/attacks/view.html", null));
    assertEquals(false, config.isStartPage("/j_spring_security_check", "GET"));
    assertEquals(true, config.isStartPage("/", "GET"));
   
    assertEquals(true, config.isParameterWithoutValidation("/attacks/home.html", "param1"));
    assertEquals(true, config.isParameterWithoutValidation("/attacks/home.html", "param1234"));
    assertEquals(true, config.isParameterWithoutValidation("/attacks/home.html", "param2"));
    assertEquals(false, config.isParameterWithoutValidation("/attacks/home.html", "param234"));
    assertEquals(false, config.isParameterWithoutValidation("/out/home.html", "param2"));
   
    assertEquals(true, config.isStartParameter("param3"));
    assertEquals(true, config.isStartParameter("param34"));
    assertEquals(true, config.isStartParameter("param4"));
    assertEquals(false, config.isStartParameter("param456"));
  }
View Full Code Here

    assertEquals(false, config.isStartParameter("param456"));
  }
 
  @Test
  public void longLivingPages(){
    HDIVConfig config = configuration.hdivConfig();
    assertNotNull(config);
   
    assertEquals("app", config.isLongLivingPages("/longLiving/sample.html"));
    assertEquals("user-session", config.isLongLivingPages("/longLivingPageApp.html"));
    assertEquals(null, config.isLongLivingPages("/noLongLiving.html"));
  }
View Full Code Here

      .cipher()
        .algorithm("algorithm").and()
      .sessionExpired()
        .loginPage("/login.html");

    HDIVConfig config = this.builder.build();
    assertNotNull(config);
    assertEquals(false, config.isCookiesConfidentialityActivated());
    assertEquals("state", config.getStateParameterName());
    assertEquals(true, config.isReuseExistingPageInAjaxRequest());
   
    assertEquals(23, this.builder.getMaxPagesPerSession());
    assertEquals("algorithm", this.builder.getCipherConfigure().getAlgorithm());
  }
View Full Code Here

  }

  public void testSchema() {

    HDIVConfig hdivConfig = this.context.getBean(HDIVConfig.class);
    assertNotNull(hdivConfig);
    assertFalse(hdivConfig.isDebugMode());

    HDIVValidations validations = this.context.getBean(HDIVValidations.class);
    assertNotNull(validations);
    System.out.println(validations.toString());
View Full Code Here

   * @return error page
   */
  private String getErrorPage(FacesContext facesContext) {

    ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
    HDIVConfig config = HDIVUtil.getHDIVConfig(servletContext);

    String errorPage = config.getErrorPage();
    return errorPage;

  }
View Full Code Here

  private SessionExpiredConfigure sessionExpiredConfigure = new SessionExpiredConfigure();

  private CipherConfigure cipherConfigure = new CipherConfigure();

  public SecurityConfigBuilder(PatternMatcherFactory patternMatcherFactory) {
    this.config = new HDIVConfig();
    this.config.setPatternMatcherFactory(patternMatcherFactory);
  }
View Full Code Here

   * @param servletContext {@link ServletContext} instance
   * @return {@link HDIVConfig} instance
   */
  public static HDIVConfig getHDIVConfig(ServletContext servletContext) {

    HDIVConfig hdivConfig = (HDIVConfig) servletContext.getAttribute(HDIVCONFIG_SERVLETCONTEXT_KEY);
    if (hdivConfig == null) {
      throw new HDIVException("HDIVConfig has not been initialized in servlet context");
    }

    return hdivConfig;
View Full Code Here

  public HDIVConfig hdivConfig() {

    SecurityConfigBuilder securityConfigBuilder = this.securityConfigBuilder();
    this.configure(securityConfigBuilder);

    HDIVConfig config = securityConfigBuilder.build();
    config.setValidations(securityValidations());

    // User configured exclusions
    ExclusionRegistry exclusionRegistry = new ExclusionRegistry(patternMatcherFactory());
    this.addExclusions(exclusionRegistry);
    // Start Pages
    List<StartPage> exclusions = exclusionRegistry.getUrlExclusions();
    config.setUserStartPages(exclusions);
    // StartParameters
    List<String> paramExclusions = exclusionRegistry.getParamExclusions();
    config.setUserStartParameters(paramExclusions);
    // ParamsWithoutValidation
    Map<String, List<String>> paramsWithoutValidation = exclusionRegistry.getParamExclusionsForUrl();
    config.setParamsWithoutValidation(paramsWithoutValidation);

    // Long living pages
    LongLivingPagesRegistry longLivingPagesRegistry = new LongLivingPagesRegistry();
    this.addLongLivingPages(longLivingPagesRegistry);
    Map<String, String> longLivingPages = longLivingPagesRegistry.getLongLivingPages();
    config.setLongLivingPages(longLivingPages);

    return config;
  }
View Full Code Here

    ExternalContext externalContext = context.getExternalContext();
    HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
    ServletContext servletContext = request.getSession().getServletContext();

    HDIVConfig config = HDIVUtil.getHDIVConfig(servletContext);

    if (Boolean.TRUE.equals(config.getConfidentiality())) {
      throw new HDIVException("Confidentiality is not implemented in HDIV for JSF, disable it in hdiv-config.xml");
    }

  }
View Full Code Here

TOP

Related Classes of org.hdiv.config.HDIVConfig

Copyright © 2018 www.massapicom. 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.