定义 OAuth 服务提供者
OAuth 服务提供者是指定用于 OAuth 的配置选项集。在对授权和令牌端点的入站请求的 URL 中指定提供者的 id 或名称。处理请求时将使用该提供者的配置选项集。此过程允许一个带有一个端点 servlet 的服务器有效地提供多项 OAuth 配置。例如,使用定义给 OAuth 提供者 photoShare 的 OAuth 配置选项集来处理 https://my.company.com:8021/oauth2/endpoint/photoShare/authorize URL。使用定义给 OAuth 提供者 calendarAuthz 的 OAuth 配置选项集来处理 https://my.company.com:8021/oauth2/endpoint/calendarAuthz/authorize URL。
关于此任务
使用 server.xml 文件中的 oauthProvider 元素来定义 OAuth 服务提供者。通过编辑 server.xml 文件或使用用于 Liberty 概要文件的 WebSphere® Application Server Development Tools,您可定义 OAuth 服务提供者。本任务描述如何定义最低 OAuth 配置。
过程
结果
示例
<server>
<featureManager>
<feature>oauth-2.0</feature>
<feature>ssl-1.0</feature>
</featureManager>
<keyStore password="keyspass" />
<oauth-roles>
<authenticated>
<user>testuser</user>
</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>