0

我正在尝试在春季运行示例 OAuth 客户端。当我运行应用程序时,我收到异常: org.springframework.security.oauth.consumer.OAuthRequestFailedException: OAuth authentication failed: Unknown Error

异常中没有更多详细信息,我尝试调试代码以查看失败的位置,但没有运气。

我该如何解决此类问题?

以下是应用程序上下文中的身份验证管理器配置:

    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="user" password="pass" authorities="ROLE_USER"/>
            </user-service>
        </authentication-provider>
    </authentication-manager>

    <oauth:consumer resource-details-service-ref="resourceDetails" oauth-failure-page="/error">
        <oauth:url pattern="/person/login" resources="resource"/>
    </oauth:consumer>

    <beans:bean id="consumerService" class="com.apple.ist.idms.service.impl.PersonServiceImpl">
        <beans:property name="personURL" value="${person-details-url}"/>
        <beans:property name="consumerTemplate">
            <beans:bean class="org.springframework.security.oauth.consumer.client.OAuthRestTemplate">
                 <beans:constructor-arg ref="resource"/>
            </beans:bean>
        </beans:property>
    </beans:bean>

    <beans:bean id="oauthInputs" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <beans:property name="location" value="classpath:apple-idms-oauth-config.properties"/>
    </beans:bean>

    <oauth:resource-details-service id="resourceDetails">
        <oauth:resource id="resource"
                        key="${consumer-key}"
                        secret="${consumer-secret}" request-token-url="${request-token-url}"
                        user-authorization-url="${user-authorization-url}"
                        access-token-url="${access-token-url}"
                        request-token-method="${request-token-method}"
                        access-token-method="${access-token-method}">
        </oauth:resource> 
4

1 回答 1

0

检查源herehere。创建此消息的位置有两个。看起来你错过了什么oauth:resource

于 2019-10-23T06:29:27.523 回答