Mule OAuth2-从Mule流外部化客户端配置
我使用下面的配置创建了一个mule OAuth2提供程序,一切都很好 我想做的是将客户机详细信息存储在数据存储中,以便在不重新部署应用程序的情况下快速添加客户机。这是可能的还是我必须将客户端硬编码到mule流中Mule OAuth2-从Mule流外部化客户端配置,mule,mule-studio,Mule,Mule Studio,我使用下面的配置创建了一个mule OAuth2提供程序,一切都很好 我想做的是将客户机详细信息存储在数据存储中,以便在不重新部署应用程序的情况下快速添加客户机。这是可能的还是我必须将客户端硬编码到mule流中 <oauth2-provider:config name="OAuth_provider_module" accessTokenEndpointPath="oauth/token" authorizationEndpointPath="oauth/authorize" doc:na
<oauth2-provider:config name="OAuth_provider_module" accessTokenEndpointPath="oauth/token" authorizationEndpointPath="oauth/authorize" doc:name="OAuth provider module" scopes="READ_PROFILE" resomuurceOwnerSecurityProvider-ref="resourceOwnerSecurityProvider" providerName="Provider" loginPage="login.html">
<oauth2-provider:clients>
<oauth2-provider:client clientId="ccccccc" secret="ddddddd" type="CONFIDENTIAL" clientName="blah" description="blah">
<oauth2-provider:redirect-uris>
<oauth2-provider:redirect-uri>http://localhost:3000/callback</oauth2-provider:redirect-uri>
</oauth2-provider:redirect-uris>
<oauth2-provider:authorized-grant-types>
<oauth2-provider:authorized-grant-type>AUTHORIZATION_CODE</oauth2-provider:authorized-grant-type>
</oauth2-provider:authorized-grant-types>
<oauth2-provider:scopes>
<oauth2-provider:scope>READ_PROFILE</oauth2-provider:scope>
</oauth2-provider:scopes>
</oauth2-provider:client>
</oauth2-provider:clients>
</oauth2-provider:config>
http://localhost:3000/callback
授权代码
阅读个人资料
如果您查看以下内容,应该有很多选项。如果您想从外部管理您的客户机,将配置或客户机存储注入到定制Springbean中可能是一个不错的选择
<spring:bean class="YourClass" init-method="initialize">
<spring:property name="config" value="#{OAuth_provider_module.configuration}" />
</spring:bean>
或者,直接(如指南示例中所示)将
及
最后,我将配置更改为
<oauth2-provider:config name="OAuth_provider_module"
accessTokenEndpointPath="oauth/token"
authorizationEndpointPath="oauth/authorize"
doc:name="OAuth provider module"
scopes="READ_PROFILE"
resourceOwnerSecurityProvider-ref="resourceOwnerSecurityProvider"
clientStore-ref="customClientStore"
providerName="TLRG Authentication"
loginPage="login.html">
</oauth2-provider:config>
并使用spring注入clientStore ref
我所要做的就是让customClientStore实现org.mule.modules.oauth2.provider.client.ClientStore,然后我就离开了
name="clientRegistration" value="#{OAuth_provider_module.configuration.clientStore}"
setClientRegistration(final ClientRegistration clientRegistration)
<oauth2-provider:config name="OAuth_provider_module"
accessTokenEndpointPath="oauth/token"
authorizationEndpointPath="oauth/authorize"
doc:name="OAuth provider module"
scopes="READ_PROFILE"
resourceOwnerSecurityProvider-ref="resourceOwnerSecurityProvider"
clientStore-ref="customClientStore"
providerName="TLRG Authentication"
loginPage="login.html">
</oauth2-provider:config>