Example usage for org.springframework.security.web.authentication.www DigestAuthenticationEntryPoint setNonceValiditySeconds

List of usage examples for org.springframework.security.web.authentication.www DigestAuthenticationEntryPoint setNonceValiditySeconds

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication.www DigestAuthenticationEntryPoint setNonceValiditySeconds.

Prototype

public void setNonceValiditySeconds(int nonceValiditySeconds) 

Source Link

Usage

From source file:org.vaadin.spring.samples.mvp.security.config.DigestAuthConfig.java

@Bean
public DigestAuthenticationEntryPoint digestEntryPoint() {
    DigestAuthenticationEntryPoint digestAuthenticationEntryPoint = new DigestAuthenticationEntryPoint();
    digestAuthenticationEntryPoint.setKey(env.getProperty("app.security.digest.key", DEFAULT_DIGEST_KEY));
    digestAuthenticationEntryPoint/* w  w w.  j  a v a2s .c o  m*/
            .setRealmName(env.getProperty("app.security.digest.realm", DEFAULT_DIGEST_REALM));
    digestAuthenticationEntryPoint.setNonceValiditySeconds(
            Integer.valueOf(env.getProperty("app.security.digest.validity", DEFAULT_DIGEST_NONCE_VALIDITY)));
    return digestAuthenticationEntryPoint;
}

From source file:org.opendatakit.configuration.TestDigestSecurityConfiguration.java

@Bean
public DigestAuthenticationEntryPoint digestEntryPoint()
        throws ODKEntityNotFoundException, ODKOverQuotaException, ODKDatastoreException, PropertyVetoException {
    DigestAuthenticationEntryPoint entryPoint = new DigestAuthenticationEntryPoint();
    entryPoint.setRealmName(testUserServiceConfiguration.realm().getRealmString());
    entryPoint/*from w w  w. j  a  v  a 2s  .c om*/
            .setKey(ServerPreferencesPropertiesTable.getSiteKey(testUserServiceConfiguration.callingContext()));
    entryPoint.setNonceValiditySeconds(1800);
    return entryPoint;
}

From source file:org.opendatakit.configuration.SecurityConfiguration.java

@Bean
public DigestAuthenticationEntryPoint digestEntryPoint()
        throws ODKEntityNotFoundException, ODKOverQuotaException, ODKDatastoreException, PropertyVetoException {
    DigestAuthenticationEntryPoint entryPoint = new DigestAuthenticationEntryPoint();
    entryPoint.setRealmName(userServiceConfiguration.realm().getRealmString());
    entryPoint.setKey(ServerPreferencesPropertiesTable.getSiteKey(userServiceConfiguration.callingContext()));
    entryPoint.setNonceValiditySeconds(1800);
    return entryPoint;
}

From source file:org.springframework.security.web.authentication.www.DigestAuthenticationEntryPointTests.java

@Test
public void testDetectsMissingRealmName() throws Exception {
    DigestAuthenticationEntryPoint ep = new DigestAuthenticationEntryPoint();
    ep.setKey("dcdc");
    ep.setNonceValiditySeconds(12);

    try {/*  www.  jav a2 s .co m*/
        ep.afterPropertiesSet();
        fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
        assertThat(expected.getMessage()).isEqualTo("realmName must be specified");
    }
}

From source file:org.springframework.security.web.authentication.www.DigestAuthenticationEntryPointTests.java

@Test
public void testGettersSetters() {
    DigestAuthenticationEntryPoint ep = new DigestAuthenticationEntryPoint();
    assertThat(ep.getNonceValiditySeconds()).isEqualTo(300); // 5 mins default
    ep.setRealmName("realm");
    assertThat(ep.getRealmName()).isEqualTo("realm");
    ep.setKey("dcdc");
    assertThat(ep.getKey()).isEqualTo("dcdc");
    ep.setNonceValiditySeconds(12);
    assertThat(ep.getNonceValiditySeconds()).isEqualTo(12);
}