Authenticate with application id using Certificated-based Authentication
@Ndiritu 已經在處理了。
開始於 2024年7月15日。
評估
這個 Issue 還沒有評估資料。
描述
I registered the app on the Microsoft Entra admin center by referring to this page:
https://learn.microsoft.com/en-us/graph/auth-v2-service?tabs=http
Then I created public/private key using openssl. Here is the commands.
$ openssl genrsa -out ms365-private.key 2048
$ openssl req -new -x509 -key ms365-private.key -out ms365-public.crt -days 365000
Uploaded the public key (ms365-private.key) on the Microsoft Entra admin center, and I created this code.
TokenCredential credential = new ClientCertificateCredentialBuilder().tenantId("xxxxxxxx")
.clientId("xxxxxxxx")
.pemCertificate("/xxxx/xxxxx/ms365-private.key")
.build();
graphClient = new GraphServiceClient(credential);
but if i execute some methods on this graphClient , this following error occurs
[ERROR] com.azure.identity.implementation.util.CertificateUtil.performLogging - PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block
java.lang.IllegalArgumentException: PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block
at com.azure.identity.implementation.util.CertificateUtil.publicKeyFromPem(CertificateUtil.java:79)
at com.azure.identity.implementation.IdentityClientBase.getConfidentialClient(IdentityClientBase.java:196)
at com.azure.identity.implementation.IdentitySyncClient.lambda$new$2(IdentitySyncClient.java:91)
at com.azure.identity.implementation.SynchronousAccessor.getValue(SynchronousAccessor.java:45)
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithConfidentialClientCache(IdentitySyncClient.java:171)
at com.azure.identity.ClientCertificateCredential.getTokenSync(ClientCertificateCredential.java:150)
at com.microsoft.kiota.authentication.AzureIdentityAccessTokenProvider.getAuthorizationToken(AzureIdentityAccessTokenProvider.java:146)
at com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider.authenticateRequest(BaseBearerTokenAuthenticationProvider.java:46)
Q. Should I also specify public key? If so, how to specify public key by using ClientCertificateCredentialBuilder?
- 主要語言
- Java
- 星號
- 444
- 分支
- 154
- 平均合併
- 18 小時 28 分鐘
- 30 天內合併 PR
- 4
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoftgraph/msgraph-sdk-java 的其他 Issue
-
status:waiting-for-triage type:bug
難度 2/5 1-3 小時 新手友好度 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
難度 3/5 1-2 天 新手友好度 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
難度 4/5 3-5 天 新手友好度 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
難度 4/5 3-5 天 新手友好度 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
status:waiting-for-triage type:bug
難度 3/5 1-2 天 新手友好度 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 則留言 ·
查看 microsoftgraph/msgraph-sdk-java 的全部 Issue
相似的 Issue
-
certification
難度 1/5 1 小時以內 新手友好度 80/100
-
難度 2/5 1-3 小時 新手友好度 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's 未關閉bug ecr
難度 2/5 1-3 小時 新手友好度 75/100
-
Needs: Triage Type: Feature request
難度 2/5 1-3 小時 新手友好度 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
難度 2/5 1-3 小時 新手友好度 65/100
github/copilot-sdk#2760 ·