簡體   English   中英

使用基本身份驗證保護簡單的 REST 服務

[英]Securing a simple REST Service with Basic Authentication

我有一個非常簡單的 REST 服務,我不想測試一個簡單的基本身份驗證。

我更改了 web.xml 以便為基本身份驗證配置特定的 REST 端點:

<security-constraint>
      <display-name>Restricted access</display-name>
      <web-resource-collection>
        <web-resource-name>Protected area</web-resource-name>
        <url-pattern>/rest/healthCheck</url-pattern>
      </web-resource-collection>
      <auth-constraint>
        <description>Only authenticated users can access this area</description>
        <role-name>authenticated</role-name>
      </auth-constraint>
</security-constraint>

之后它似乎可以工作,如果我使用 SOAP UI 調用該服務,我會得到 401 未經授權。

之后,我在 SOAP UI 中添加了一個基本身份驗證(用戶和密碼),但行為沒有改變。 我總是收到未經授權的 401。

我想我錯過了一些東西。 可以幫忙嗎?

您的 SOAP UI 客戶端似乎正在嘗試進行不受支持的 SPNEGO 身份驗證。 您是否嘗試過普通的 curl 來檢查基本身份驗證是否有效? curl -u username https://my.endpoint.com

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM