我想为 Spring Security OpenID 实现一个新的 OpenIDConsumer。我在一个类中实现了OpenIDConsumer,然后添加了相应的配置applicationContext-security.xml,但是我的代码似乎根本没有执行。
这是来自的相关部分applicationContext-security.xml:
<http auto-config="false">
<intercept-url pattern="/**" access="ROLE_USER"/>
<openid-login login-page="/auth/login"
authentication-failure-url="/auth/login?login_error=true">
<attribute-exchange>
<openid-attribute name="email" type="http://axschema.org/contact/email" required="true"/>
</attribute-exchange>
</openid-login>
</http>
<b:bean id="openIdConsumer" class="sample.OpenIDTestConsumer">
<b:property name="email" value="email"/>
</b:bean>
现在,类 sample.OpenIDTestConsumer 已初始化,但 Spring Security 不使用它,我认为使用原始类代替OpenID4JavaConsumer。
该类sample.OpenIDTestConsumer实现了OpenIDConsumer接口并对其进行了初始化并setEmail设置了方法,但它不执行beginConsumption或endConsumption方法,这就是为什么我认为它只是因为applicationContext-security.xmlbean定义而创建但没有使用的原因。
问题是:如何粘合或设置自定义类作为 OpenIDConsumer 工作而不使用 Spring 实现?