定義 OAuth 服務提供者
OAuth 服務提供者是 OAuth 的一組具名配置選項。 提供者的 id
或名稱指定在授權和記號端點之入埠要求的 URL 中。 當處理要求時,會使用這個提供者的配置選項集。 這個程序使含有單一端點 Servlet 的伺服器能夠有效提供多重 OAuth 配置。 比方說,https://my.company.com:8021/oauth2/endpoint/photoShare/authorize
URL 就是利用定義給名稱為 photoShare
之 OAuth 提供者的該組 OAuth 配置選項來進行處理。 https://my.company.com:8021/oauth2/endpoint/calendarAuthz/authorize
URL 是使用針對名稱為 calendarAuthz
的 OAuth 提供者所定義的 OAuth 配置選項集來處理。
關於這項作業
OAuth 服務提供者是利用 server.xml 檔中的 oauthProvider
元素來定義。 您可以編輯 server.xml 檔,或使用 WebSphere® Application Server Development Tools for Liberty,來定義 OAuth 服務提供者。 這項作業說明如何定義最小的 OAuth 配置。
程序
結果
範例
<server>
<featureManager>
<feature>oauth-2.0</feature>
<feature>transportSecurity-1.0</feature>
</featureManager>
<keyStore password="keyspass" />
<oauth-roles>
<authenticated>
<user name="testuser"/>
</authenticated>
</oauth-roles>
<oauthProvider id="SampleProvider" filter="request-url%=ssodemo">
<localStore>
<client name="client01" secret="{xor}LDo8LTor"
displayname="Test client number 1"
redirect="http://localhost:1234/oauthclient/redirect.jsp"
enabled="true" />
</localStore>
</oauthProvider>
<webAppSecurity allowFailOverToBasicAuth="true" />
<basicRegistry id="basic" realm="BasicRealm">
<user name="testuser" password="testuserpwd" />
</basicRegistry>
</server>