简体   繁体   English

Spring Security SAML中的代理设置

[英]Proxy settings in Spring security saml

I'm learning Spring security using SAML. 我正在学习使用SAML的Spring安全性。 I got the example from 我从那里得到了例子

https://github.com/spring-projects/spring-security-saml 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 我在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 打开与idp.ssocircle.com的连接:80
Closing the connection. 关闭连接。
I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect 处理请求时捕获了I / O异常(java.net.ConnectException):连接被拒绝: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)` 拒绝连接:连接java.net.ConnectException:拒绝连接:在java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)处的java.net.DualStackPlainSocketImpl.waitForConnect(本机方法)处进行连接AbstractPlainSocketImpl.java:339)`

Pardon me if my understanding is wrong, sorry for wasted your time if it is duplicate. 如果我的理解是错误的,请原谅我,如果重复的话浪费您的时间,对不起。

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, ie the proxy address. 然后,您应该使用自己喜欢的任何设置(即代理地址)创建samlHttpClient。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM