簡體   English   中英

如何使用 ADFS 在 IOS 上實現 SSO 功能

[英]How to implement SSO functionality on IOS using ADFS

我想使用ADFSIOS single sign-on實現single sign-on功能。 我做了一些研發並嘗試使用MSAL iOS庫進行ADFS身份驗證,但它對我不起作用。

我為 ADFS 身份驗證添加了客戶端 ID、權限 URL,但它對我不起作用。 每次它給我Couldn't acquire token錯誤。

我有不同的SSO URL ,所以不使用Microsoft azure server

我嘗試以下列方式為MSAL IOS庫添加我的憑據

let kClientID = "xxxxxx-8929-4D60-B869-xxxxxxxx"

// These settings you don't need to edit unless you wish to attempt deeper scenarios with the app.
let kGraphURI = "https://graph.microsoft.com/v1.0/me/"
let kScopes: [String] = ["https://graph.microsoft.com/user.read"]
let kAuthority = "https://fs.example.com/adfs/oauth2"

任何的想法?

這里我們不需要使用 MSAL iOS。 有一個使用 Microsoft docs 的簡單解決方案。 按照鏈接:

https://docs.microsoft.com/en-us/windows-server/identity/ad-fs/overview/ad-fs-scenarios-for-developers

我們只需要形成一個url字符串

https://fs.xxx.com/adfs/oauth2/authorize?response_type=code&client_id=xxxx-xxxx-xxxx-xxxx-xxxxxxx&redirect_uri=appName://&resource=http://xxxx/workflow

這將生成一個代碼,我們可以在 App Delegate 的 openUrl 方法中獲取該代碼,然后我們需要使用參數創建一個 post 請求:

grant_type:authorization_code
code: xxxxx ( we got from get request)
redirect_uri: appName://
resource:http://xxxx/workflow

就是這樣 。 我們將獲得 access_token,我們可以進一步使用它來獲取 userProfile 等。

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM