【问题标题】:Java Spring: OAuth authentication failed: Unknown ErrorJava Spring:OAuth 身份验证失败:未知错误
【发布时间】:2019-10-23 15:06:44
【问题描述】:

我正在尝试在春季运行一个示例 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> 

【问题讨论】:

    标签: java spring oauth


    【解决方案1】:

    检查源 herehere。创建此消息的位置有两个。 看来您错过了oauth:resource 中的某些内容

    【讨论】:

      猜你喜欢
      • 2019-05-07
      • 2014-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-27
      • 2015-12-01
      • 2016-01-01
      相关资源
      最近更新 更多