Reputation: 3101
This PowerShell git repo contains scripts for rolling the keys in an Azure AD:
https://github.com/AzureAD/azure-activedirectory-powershell-tokenkey
I need to automate this process in Java. I can't call PowerShell because it runs on a SLES 12 automation server.
I'm wondering if you can do this sort of thing with the java sdk:
https://github.com/Azure/azure-sdk-for-java
or some other library?
Upvotes: 0
Views: 243
Reputation: 14649
AFAIK, there is no such method to roll the Azure AD keys in he Azure SDK for Java.
To achieve the goal, you can translate the PowerShell to Java. You can get the keys from the keys endpoint like below($authority$Tenant/discovery/keys"
):
https://login.microsoftonline.com/common/discovery/keys
And if you were developing with V2.0 endpoint, the URL is:
https://login.microsoftonline.com/common/discovery/v2.0/keys
And if you were developing with Azure AD B2C, below is the URL: https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys?p={policy}
And to verify the token manually from Azure AD from Java, you can refer this link.
Upvotes: 1