Example usage for org.springframework.security.web.access.channel ChannelDecisionManagerImpl getClass

List of usage examples for org.springframework.security.web.access.channel ChannelDecisionManagerImpl getClass

Introduction

In this page you can find the example usage for org.springframework.security.web.access.channel ChannelDecisionManagerImpl getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.broadleafcommerce.common.security.channel.ProtoChannelBeanPostProcessor.java

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof ChannelDecisionManagerImpl) {
        try {// w w w .jav  a 2  s  .  c  om
            ChannelDecisionManagerImpl manager = (ChannelDecisionManagerImpl) bean;
            Field channelProcessors = manager.getClass().getDeclaredField("channelProcessors");
            channelProcessors.setAccessible(true);
            List<ChannelProcessor> list = (List<ChannelProcessor>) channelProcessors.get(manager);
            list.clear();
            manager.setChannelProcessors(channelProcessorOverrides);
            LOG.info(
                    "Replacing the standard Spring Security channel processors with custom processors that look for a "
                            + "'X-Forwarded-Proto' request header. This allows Spring Security to sit behind a load balancer with SSL termination.");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    return bean;
}