0
votes

I'm learning Spring security using SAML. I got the example from

https://github.com/spring-projects/spring-security-saml

I'm in a network where I have proxy. So I hard to find this solution to enter proxy details. I used the following in securityContext.xml

<bean id="hostConfiguration" class="org.apache.commons.httpclient.HostConfiguration"/>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject" ref="hostConfiguration"/>
    <property name="targetMethod" value="setProxy"/>
    <property name="arguments">
        <list>
            <value>proxyhost.com</value>
            <value>5555</value>
        </list>
    </property>
</bean>

but still I'm getting connection refused error.

Open connection to idp.ssocircle.com:80
Closing the connection.
I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
Connection refused: connect java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)`

Pardon me if my understanding is wrong, sorry for wasted your time if it is duplicate.

1

1 Answers

1
votes

You could try adding something like the following snippet to your configuration:

<bean id="metadataManager" class="org.springframework.security.saml.metadata.CachingMetadataManager">
    <constructor-arg>
        <list>
            <bean class="org.opensaml.saml2.metadata.provider.HTTPMetadataProvider">
                <constructor-arg type="java.util.Timer" ref="metadataTimer"/>
                <constructor-arg type="org.apache.commons.httpclient.HttpClient" ref="samlHttpClient"/>
                <constructor-arg>
                    <value type="java.lang.String">${saml.idp.url}</value>
                </constructor-arg>
                <property name="parserPool" ref="parserPool"/>
            </bean>
        </list>
    </constructor-arg>
</bean>

Then you should create the samlHttpClient with any settings you like, i.e the proxy address.