1
我配置了帶有聯合身份驗證(谷歌,臉書,live id)的Thintecture Identity Server和WCF SOAP服務。使用IdentityServer將SAML令牌轉換爲JWT令牌
現在我需要Windows Phone應用程序的WCF Rest Endpoint(webHttpBinding)。我不想在授權標頭中傳遞WSTrust SAML令牌。有可能將SamlToken轉換爲JWT令牌以及如何:)?
下面是我試過的代碼,但不起作用。
var factory = new WSTrustChannelFactory(
new WindowsWSTrustBinding(SecurityMode.Transport),
new EndpointAddress("https://identityserver.local/issue/???"))
{
TrustVersion = TrustVersion.WSTrust13
};
var rst = new RequestSecurityToken
{
RequestType = RequestTypes.Issue,
KeyType = KeyTypes.Bearer,
TokenType = TokenTypes.JsonWebToken,
AppliesTo = new EndpointReference("http://my.realm/")
};
var securityToken = xmlToken.ToSecurityToken();
var response = factory.CreateChannelWithIssuedToken(securityToken).Issue(rst);
感謝您的幫助。
謝謝,回答。我需要兩個令牌...一個用於WCF桌面客戶端(WPF,Windows Store)的SAML,另一個用於REST客戶端(Windows Phone,Android,iOS)或者可以在兩種場景中使用JWT? 明天我會嘗試ACS Wrap Service ...這將把SAML轉換成JWT/SWT。我現在不會這麼做嗎? 並回答你的問題我使用WS聯合(與家庭領域發現)谷歌,現場ID和Facebook。我攔截Identity Sarver和Facebook之間的Web請求協商,並獲得SAML令牌。當我獲得SAML令牌時,我嘗試使用WS-Trust來獲取JsonWebToken。 – zielu1
是的 - 這不起作用 - 你可以手動轉換它(但需要一個簽名密鑰)或使用ACS來轉換它。沒有一個是完美的解決方案;)當然,您可以擴展IdSrv爲您提供這樣的服務。 – leastprivilege
擴展IdSrv是個好主意......這看起來非常自然和簡單的解決方案。我會試試這種方式。 – zielu1