我想使用ADAL庫在Xamarin形式(iOS和Android).NET來實現POC的應用程序來對我公司的Azure的AD認證微軟認證者將失敗。我已經設法在兩個平臺上使用用戶名/密碼進行身份驗證,並使用Microsoft Authenticator作爲Android上的代理(Workplace Join)。認證使用ADAL在Xamarin .NET和iOS
但我掙扎與iOS上的驗證器來驗證。我使用ADAL iOS的SSO指南作爲參考(https://docs.microsoft.com/en-us/azure/active-directory/active-directory-sso-ios)。
當我點擊身份驗證器應用中打開我的測試登錄按鈕,但它只是保持一個白色屏幕打開和取消按鈕。 我已經嘗試使用iOS 9.3和iOS 10.我在設備日誌中收到這些錯誤消息。
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: ADAL API call [Version - 2.0.2]. Additional Information: In function: +[ADBrokerContext getAllAccounts:], file line #632. ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: ADAL API call [Version - 2.0.2]. Additional Information: In function: -[ADKeychainTokenCacheStore allItemsWithError:], file line #419. ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: Keychain token cache store. Additional Information: (null). ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: ADAL API call [Version - 2.0.2]. Additional Information: In function: +[ADBrokerContext isBrokerRequest:returnUpn:], file line #157. ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: ADAL API call [Version - 2.0.2]. Additional Information: In function: +[ADBrokerContext isBrokerRequest:returnUpn:], file line #157. ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] INFORMATION: Broker invoked from my.company.xamarinadaltest. Additional Information: (null). ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] VERBOSE: ADAL API call [Version - 2.0.2]. Additional Information: In function: +[ADBrokerContext invokeBrokerImpl:sourceApplication:upn:webView:], file line #432. ErrorCode: 0.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] ERROR: Error raised: 2. Additional Information: Domain: ADAuthenticationErrorDomain Details: source application bundle identifier should be same as the redirect URI domain. ErrorCode: 2.
Warning (325)/Authenticator: ADALiOS [2016-11-28 11:04:35 - 9966AB28-6265-400D-91B4-F3B145D12FB9] ERROR: source application does not match redirect uri host. Additional Information: (null). ErrorCode: 0.
重定向URI代碼:msauth://code/x-msauth-adaltest%3A%2F%2Fmy.company.xamarinadaltest
在Entitlements.plist(我試過有沒有這個享待遇 - 同樣的結果):
<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)my.company.xamarinadaltest</string>
<string>$(AppIdentifierPrefix)com.microsoft.workplacejoin</string>
<string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
</array>
</dict>
在Info.plist中:
<key>CFBundleIdentifier</key>
<string>my.company.xamarinadaltest</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>my.company.xamarinadaltest</string>
<key>CFBundleURLSchemes</key>
<array>
<string>x-msauth-adaltest</string>
</array>
<key>CFBundleURLTypes</key>
<string>Editor</string>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>msauth</string>
</array>
在Azure Portal中重定向URI:
msauth://code/x-msauth-adaltest://my.company.xamarinadaltest
x-msauth-adaltest://my.company.xamarinadaltest
msauth://code/x-msauth-adaltest%3A%2F%2Fmy.company.xamarinadaltest
根據所述引導件(https://docs.microsoft.com/en-us/azure/active-directory/active-directory-sso-ios):
你的重定向URI必須在適當的形式:
<app-scheme>://<your.bundle.id>
所以我不明白錯誤「源應用程序包標識符應該與重定向URI域相同」。
有沒有人成功地得到這個工作? Authenticator似乎正在使用舊版本的ADALiOS,這可能是一個問題嗎?