Search in sources :

Example 1 with RetryWithHttpsEntryPoint

use of org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint in project spring-security by spring-projects.

the class RetryWithHttpsEntryPointTests method testDetectsMissingPortResolver.

@Test
public void testDetectsMissingPortResolver() throws Exception {
    RetryWithHttpsEntryPoint ep = new RetryWithHttpsEntryPoint();
    try {
        ep.setPortResolver(null);
        fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
    }
}
Also used : RetryWithHttpsEntryPoint(org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint) Test(org.junit.Test)

Example 2 with RetryWithHttpsEntryPoint

use of org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint in project spring-security by spring-projects.

the class RetryWithHttpsEntryPointTests method testDetectsMissingPortMapper.

// ~ Methods
// ========================================================================================================
@Test
public void testDetectsMissingPortMapper() throws Exception {
    RetryWithHttpsEntryPoint ep = new RetryWithHttpsEntryPoint();
    try {
        ep.setPortMapper(null);
        fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
    }
}
Also used : RetryWithHttpsEntryPoint(org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint) Test(org.junit.Test)

Example 3 with RetryWithHttpsEntryPoint

use of org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint in project spring-security by spring-projects.

the class ChannelSecurityConfigurer method getChannelProcessors.

private List<ChannelProcessor> getChannelProcessors(H http) {
    if (this.channelProcessors != null) {
        return this.channelProcessors;
    }
    InsecureChannelProcessor insecureChannelProcessor = new InsecureChannelProcessor();
    SecureChannelProcessor secureChannelProcessor = new SecureChannelProcessor();
    PortMapper portMapper = http.getSharedObject(PortMapper.class);
    if (portMapper != null) {
        RetryWithHttpEntryPoint httpEntryPoint = new RetryWithHttpEntryPoint();
        httpEntryPoint.setPortMapper(portMapper);
        httpEntryPoint.setRedirectStrategy(this.redirectStrategy);
        insecureChannelProcessor.setEntryPoint(httpEntryPoint);
        RetryWithHttpsEntryPoint httpsEntryPoint = new RetryWithHttpsEntryPoint();
        httpsEntryPoint.setPortMapper(portMapper);
        httpsEntryPoint.setRedirectStrategy(this.redirectStrategy);
        secureChannelProcessor.setEntryPoint(httpsEntryPoint);
    }
    insecureChannelProcessor = postProcess(insecureChannelProcessor);
    secureChannelProcessor = postProcess(secureChannelProcessor);
    return Arrays.asList(insecureChannelProcessor, secureChannelProcessor);
}
Also used : SecureChannelProcessor(org.springframework.security.web.access.channel.SecureChannelProcessor) RetryWithHttpsEntryPoint(org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint) PortMapper(org.springframework.security.web.PortMapper) RetryWithHttpEntryPoint(org.springframework.security.web.access.channel.RetryWithHttpEntryPoint) InsecureChannelProcessor(org.springframework.security.web.access.channel.InsecureChannelProcessor)

Aggregations

RetryWithHttpsEntryPoint (org.springframework.security.web.access.channel.RetryWithHttpsEntryPoint)3 Test (org.junit.Test)2 PortMapper (org.springframework.security.web.PortMapper)1 InsecureChannelProcessor (org.springframework.security.web.access.channel.InsecureChannelProcessor)1 RetryWithHttpEntryPoint (org.springframework.security.web.access.channel.RetryWithHttpEntryPoint)1 SecureChannelProcessor (org.springframework.security.web.access.channel.SecureChannelProcessor)1