简体   繁体   English

Azure AD Graph API访问,不使用客户端ID和密钥

[英]Azure AD Graph API access without using client id and secret key

I have a back-end service that needs to read from and write into Azure AD. 我有一个需要读取和写入Azure AD的后端服务。 I was able to read and write using graph api by authenticating using tenant info, client id and secret key (these values come from Authentication Scenarios for Azure AD | Basics of Registering an Application in Azure AD ). 通过使用租户信息,客户端ID和密钥进行身份验证,我能够使用图形api进行读写:这些值来自Azure AD的身份验证方案|在Azure AD中注册应用程序的基础知识

Using the tenant info, client id and secret key for authentication means that end users need to register their tenants by manually specifying these values and I am trying to avoid this manual step of registration where users need to specify these values. 使用租户信息,客户端ID和密钥进行身份验证意味着最终用户需要通过手动指定这些值来注册他们的租户,我试图避免这种手动注册步骤,用户需要指定这些值。

I have also looked at the multi-tenant application admin/user consent and its associated sample Integrating applications with azure active directory . 我还查看了多租户应用程序管理员/用户同意及其相关示例将应用程序与azure活动目录集成 However, the issue with the admin consent is that it enables all users in the directory to have access to the directory. 但是,管理员同意的问题是它允许目录中的所有用户都可以访问该目录。

Is there any other way where I can provide a registration link of some sort, let the global admin user authenticate and consent for permission at which point some sort of an access or refresh token can be persisted for use by the back-end service? 有没有其他方法可以提供某种注册链接,让全局管理员用户进行身份验证并同意权限,此时可以保留某种访问或刷新令牌以供后端服务使用?

I have the reverse problem (see How to use Azure AD Graph API access for service principals? ), but can answer your question. 我有相反的问题(请参阅如何使用Azure AD Graph API访问服务主体? ),但可以回答您的问题。 Daemon apps can run as either single tenant or multi-tenant, and use user/password authentication, so can be limited to the rights/roles for that user. 守护程序应用程序可以作为单租户或多租户运行,并使用用户/密码身份验证,因此可以限制为该用户的权限/角色。 I've tested this by using both client ID/secret and user/password using the same app for both - you just need to add the required permissions to the app for the user/password case (that doesn't seem to apply for SP's). 我已经使用相同的应用程序同时使用客户端ID /密码和用户/密码对此进行了测试 - 您只需要为应用程序添加用户/密码案例所需的权限(这似乎不适用于SP的)。

In my case, I'm using adal4j, but I'm sure you can adapt it as needed, eg: 就我而言,我正在使用adal4j,但我确信你可以根据需要调整它,例如:

final ExecutorService service = Executors.newFixedThreadPool(1);
final AuthenticationContext context = new AuthenticationContext(authority, true, service);
final Future<AuthenticationResult> future = context.acquireToken("https://graph.windows.net", clientID, userName, decryptedPassword, null);
final AuthenticationResult result = future.get();

...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取访问令牌以使用客户端ID和客户端密钥以及图形API从Azure中提取用户组所需的范围 - Scope needed to get access token to pull user groups from Azure using client id and client secret and graph API 如何使用 azure AD 图形 API 获取客户端机密到期日期 - How to get client secret expiry date using the azure AD graph API 如何使用 NodeJs 调用 REST API 的客户端 ID、租户 ID、azure AD 的客户端密码生成授权承载令牌? - How to generate Authorization Bearer token using client ID , tenant Id, Client secret of azure AD using NodeJs for calling REST API? Azure AD:如何在不使用任何库的情况下访问Azure AD Graph API - Azure AD: How to access Azure AD Graph API without using any library 如何从 azure 广告中获取登录用户的用户 Id_token 而不使用客户端 ID 和机密进行重定向 - How to Get User Id_token of logged in user from azure ad without redirect using Client Id and Secret 如何仅使用客户端 ID 和租户 ID 使用没有客户端密码的 azure 广告? - how to use azure ad without client secret just with client id and tenant id? Azure 和 Microsoft Graph:使用客户端密码拒绝访问收件箱 - Azure & Microsoft Graph: Access denied accessing inbox, using Client Secret 访问被拒绝到Azure AD Graph Client 2.0中的指定API版本 - Access denied to the specified API version in Azure AD Graph Client 2.0 使用client_credentials Azure AD Graph API进行授权时出现问题 - Trouble with authorization using client_credentials Azure AD Graph API C# - 获取图形访问令牌 - 使用客户端 ID、客户端密码、Scope 和客户端委派权限 - C# - Get Graph access token - using Client ID, Client Secret, Scope with Client Delegated Permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM