小编vci*_*ima的帖子

如何使用 Java 验证 Azure AD JWT 令牌?

我有一个使用 Msal 库获取的 Azure AD JWT 令牌,但当我尝试验证此令牌时出现问题:

客户端:Sharepoint Web 部件

 const config = {
     auth: {
         clientId: "xxxxx",
         authority: "https://login.microsoftonline.com/yyyyyy"
     }
 };

 const myMSALObj = new UserAgentApplication(config);

 let accessTokenRequest = {
     scopes: ["user.read"],
     loginHint: this.context.pageContext.user.loginName,
     extraQueryParameters: {domain_hint: 'organizations'}
 }

 myMSALObj.acquireTokenSilent(accessTokenRequest).then(
  function(accessTokenResponse) { 
  // Acquire token silent success 
  let accessToken = accessTokenResponse.accessToken;
Run Code Online (Sandbox Code Playgroud)

我正在尝试从以下位置检索公钥:https: //login.microsoftonline.com/tenant-id/.well-known/openid-configuration,但使用此公钥我永远无法重定向到:https://login。 microsoftonline.com/common/discovery/keys

请问这种情况下还有其他方法可以获取公钥吗?

服务器:验证

public PublicKey getPublicKeyFromParams(String e, String n){

    byte[] modulusBytes = Base64.getUrlDecoder().decode(n);

    BigInteger modulusInt = new BigInteger(1, modulusBytes);

    byte[] exponentBytes = Base64.getUrlDecoder().decode(e);

    BigInteger exponentInt …
Run Code Online (Sandbox Code Playgroud)

azure azure-active-directory

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

azure ×1

azure-active-directory ×1