jeffwils / grails-spring-security-saml

Grails Spring Security SAML2.0 Plugin for Grails 3
8 stars 25 forks source link

Support for configuration adding contextProvider as SAMLContextProviderLB as well for AWS ELB support for https to http forward. #71

Open vsachinv opened 3 years ago

vsachinv commented 3 years ago

In env setup with AWS ELB if a request with HTTPS protocol getting pass to backend as HTTP then following code fails due to mismatch of URL due to HTTPS and HTTP mismatch.

context.setLocalEntityEndpoint(SAMLUtil.getEndpoint(context.getLocalEntityRoleMetadata().getEndpoints(), context.getInboundSAMLBinding(), context.getInboundMessageTransport(), uriComparator));

To resolve the same issue, we had to override contextProvider bean. Can we add the same in the plugin itself to provide out of the box support?

 contextProvider(org.springframework.security.saml.context.SAMLContextProviderLB) {
            scheme = Holders.config.getProperty('saml.lb.scheme')
            serverName = Holders.config.getProperty('saml.lb.serverName')
            serverPort = Holders.config.getProperty('saml.lb.port', Integer)
            contextPath = Holders.config.getProperty('saml.lb.contextPath')
        }