XsuaaTokenFlows: Deprecated constructors for client credential based authentication
See original GitHub issueHello Colleagues, could you please provide an example for the proper usage of Example Usage of XsuaaServiceConfiguration?
The background of this request is the following: We have developed a service which in turn is calling an instance of the Market Rates Management (MRM) service. For the MRM call we first get the access token from the uaa instance bound to the MRM service. Currently we use the following coding for this purpose:
XsuaaTokenFlows tokenFlows =
new XsuaaTokenFlows(
new DefaultOAuth2TokenService(),
new XsuaaDefaultEndpoints(uaaUrl),
new ClientCredentials(clientId, clientSecret));
return tokenFlows.clientCredentialsTokenFlow().execute().getAccessToken();
In this solution uaaUrl
, clientId
and clientSecret
are coming from uaa
environment variables (VCAP_SERVICES):
@Value("${vcap.services.bpi-market-rates.credentials.uaa.url}")
String uaaUrl;
The solution was/is working as expected but unfortunately the used constructor version of XsuaaTokenFlows is now deprecated. For the alternative constructor we need an instance of OAuth2ServiceConfigurationProperties. I have seen that XsuaaServiceConfiguration is a specialization of OAuth2ServiceConfigurationProperties. My question now is, how do we get a proper instance of XsuaaServiceConfiguration?
Seeing that the SpringBoot annotation @ConfigurationProperties(“sap.security.services.xsuaa”) is used I’m wondering from where the properties are really taken from and how can I get an instance which then contains the uaa-credentials of the MRM service and not the ones of my own service?
And maybe one additional remark: at the end my own service should be called from the BTP Job Scheduler - I’m not sure if this adds additional complexity for getting the MRM credentials.
Thanks in advance for your help!
Best regards, Sven.
P.S.: If have seen that there was already a similar question raised but this doesn’t answer my question above.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (7 by maintainers)
Hi @shravanpishike thanks for the additional remark…
Finally, instead of
…instantiate
XsuaaTokenFlows
like that:Done: https://github.com/SAP/cloud-security-xsuaa-integration/releases/tag/2.11.3