【问题标题】:401 Error, Mule while Username/Password are Correct401 错误,Mule 而用户名/密码正确
【发布时间】:2020-01-14 21:15:32
【问题描述】:

我正在尝试使用邮递员来调用我使用 Mule 部署的 API。我已从受信任的来源 (Collibra) 下载此 API,因此希望它处于工作状态。

API 请求: http://localhost:8081/connect/dgc/export/asset?filter=name%20STARTS_WITH%20E

这是其中一个 xml 文件中的基本身份验证设置。

<mule-ss:security-manager name ="authenticationManager" doc:name="Spring Security Provider">
    <mule-ss:delegate-security-provider
        name="memory-provider" delegate-ref="authenticationManager-common" />
</mule-ss:security-manager> 
<spring:beans>
    <ss:authentication-manager alias="authenticationManager-common">
        <ss:authentication-provider>
            <ss:user-service id="userService">
                <ss:user name="${service.user}" password="${service.password}"
                    authorities="ROLE_ADMIN" />
            </ss:user-service>
        </ss:authentication-provider>
    </ss:authentication-manager>
 </spring:beans>

这是属性文件中用户名/密码的设置。

service.user=user
service.password=password

当我使用正确的凭据发出邮递员 GET 请求时出现以下错误。

Failed to connect/reconnect: Work Descriptor. Root Exception was: Unexpected response with status code: 401 was returned. Message was: {"statusCode":401,"titleMessage":"Not authorized","userMessage":"The user name or password is wrong. Try again."}

如果我使用了不正确的凭据,则会出现以下错误。

Root Exception stack trace:
    org.springframework.security.authentication.BadCredentialsException: Bad credentials

当我通过基本身份验证传递正确的凭据时出现错误可能会出现什么问题?我用在线标题生成器仔细检查了字符串,它确实是正确的。

【问题讨论】:

    标签: api get mule postman http-status-code-401


    【解决方案1】:

    如果不了解 API 实现就很难进行故障排除,但鉴于凭据不正确的错误似乎来自 Spring 安全管理器,并且使用正确的凭据,它看起来正在连接到其他东西,API 可能是调用某个后端系统或 API,但无法对其进行身份验证。

    【讨论】:

    • 是的,原来是这个问题。我一直在找错地方
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    • 2021-10-08
    • 2018-11-20
    • 1970-01-01
    • 2015-06-08
    • 2020-07-19
    相关资源
    最近更新 更多