Hi Experts,
Now I'm using latest Java SAP cloud SDK, and found that Authorization is deprecated.
Set<Authorization> getAuthorizations()
how to get the Authorization list?
final Try<Principal> principalTry = PrincipalAccessor.tryGetCurrentPrincipal();
if (principalTry.isFailure()) {
throw new ServiceException(ResultCode.GET_PRINCIPAL_ERROR, principalTry.getCause());
}
Principal principal = principalTry.get();
Request clarification before answering.
Hi Gary,
the SAP Cloud SDK team is currently working hard on the release of the next major version (v5). Related documentation you can find here: https://sap.github.io/cloud-sdk/docs/java/v5/guides/5.0-upgrade
In the case of the Authorization API we decided to drop the SAP Cloud SDK side implementation, in favor of leveraging the more central "cloud-security-services-integration-library", which you can find here: https://github.com/SAP/cloud-security-services-integration-library/tree/main
As already bring the required replacement as a dependency of the SAP Cloud SDK, you should be able to retrieve the Authorizations by using the following code:
Token token = SecurityContext.getToken();
List<String> scopes = token.getClaimAsStringList(TokenClaims.XSUAA.SCOPES);
These scopes represent what the SAP Cloud SDK was calling "Authorizations" before.
I hope this helps!
Greetings
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, currently you don't "need" to change anything, those API will just be removed in version 5 of the Cloud SDK.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.