【发布时间】:2019-02-15 20:09:24
【问题描述】:
我已经为 ADAL 身份验证设置了一个演示应用程序。我们公司要求安装 InTune 应用程序:https://itunes.apple.com/us/app/intune-company-portal/id719171358?mt=8
在安装和设置 InTune 之后,我已经使用我开发的 ADAL 安装了演示:
将 ADAL 添加为 Pod 库
在我的 Azure 门户 (https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) 中添加了重定向 URI(一个带有 schema://bundle_id,一个带有 msauth://code/schema%3A%2F%2Fbundle_id)
-
添加到应用的 info.plist:
<key>LSApplicationQueriesSchemes</key> <array> <string>msauth</string> </array>
4.添加到应用的info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>bundle_id</string>
<key>CFBundleURLSchemes</key>
<array>
<string>schema</string>
</array>
</dict>
</array>
添加了
[_authContext setCredentialsType:AD_CREDENTIALS_AUTO];以使用 inTune App Portal 进行代理身份验证。-
使用以下命令创建身份验证:
ADAuthenticationError *error = nil; _authContext = [ADAuthenticationContext authenticationContextWithAuthority:@"https://login.microsoftonline.com/common" error:&error]; [_authContext setCredentialsType:AD_CREDENTIALS_AUTO]; [_authContext acquireTokenWithResource:@"https://graph.microsoft.com" clientId:@"my_client_id" // Comes from App Portal redirectUri:[NSURL URLWithString:@"schema://bundle_id"] // Comes from App Portal completionBlock:^(ADAuthenticationResult *result) { NSLog(result.accessToken); }];
应用程序会正确提示用户进行microsoft authentication,即在公司页面的microsofth authentication上重定向,但是在Authentication之后,结果是这样的:
【问题讨论】:
-
您的设备是否受到管理? IE。它是否显示在 Comp Portal 应用程序的“设备”下?
-
是的,显示出来了
-
设备显示为“合规”?如果您点击“立即注册”会发生什么?您是否收到设备已注册的错误消息?这是条件访问失败。您应该让您的 AD 管理员查看已将哪些条件访问策略应用于图形端点和您的应用程序 ID
-
@Paulw11如果我按下按钮,将出现一个 HTML 页面,其中包含在 Intune 上打开 AppStore 的按钮
-
@Paulw11 在 Android 上使用相同的 AD 应用程序没有问题
标签: ios objective-c azure azure-active-directory adal