클라이언트는 먼저 ID 공급자의 토큰을 요청한 후이 토큰을 사용하여 새 토큰을 요청합니다. 리소스 STS http://leastprivilege.com/2010/10/28/wif-adfs-2-and-wcfpart-6-chaining-multiple-token-services/활성 클라이언트 - idp 토큰을 사용하여 리소스 파트너 adfs에서 토큰 가져 오기
Idp에서 토큰을 가져 왔지만 리소스 STS에서 토큰을 가져 오는 것을 관리하지 못했습니다. 캐릭터 세트 =; 바인딩 (응용 프로그램/비누 + XML의 내용 유형과 일치하지 않습니다 응답 메시지의 콘텐츠 형식 text/html과 :이 오류가
string RPRealm = "https://service.contoso.com/";
string RSTSRealm = "http://fsweb.contoso.com/adfs/services/trust";
string IdPstsEndpoint = "https://IdpAdfs.domain.com/adfs/services/trust/13/kerberosmixed";
string RSTSEndpoint = "https://fsweb.contoso.com/adfs/services/trust/13/IssuedTokenMixedSymmetricBasic256";
private static SecurityToken GetIdPToken(string rstsRealm, string IdPstsEndpoint)
{
using (var factory = new WSTrustChannelFactory(
new KerberosWSTrustBinding(SecurityMode.TransportWithMessageCredential),
new EndpointAddress(new Uri(IdPstsEndpoint))))
{
WSTrustChannel channel = null;
factory.TrustVersion = TrustVersion.WSTrust13;
try
{
var rst = new RequestSecurityToken
{
RequestType = WSTrust13Constants.RequestTypes.Issue,
AppliesTo = new EndpointAddress(rstsRealm),
KeyType = WSTrust13Constants.KeyTypes.Bearer,
};
channel = (WSTrustChannel)factory.CreateChannel();
RequestSecurityTokenResponse rstr;
SecurityToken token = channel.Issue(rst, out rstr);
return token;
}
finally
{
if (channel != null)
{
channel.Abort();
}
factory.Abort();
}
}
}
private static SecurityToken GetRSTSToken(SecurityToken IdPToken, string RSTSEndpoint, string RPRealm)
{
var binding = new WS2007FederationHttpBinding();
binding.Security.Message.IssuedKeyType = SecurityKeyType.BearerKey;
binding.Security.Message.EstablishSecurityContext = false;
binding.Security.Mode = WSFederationHttpSecurityMode.TransportWithMessageCredential;
using (var factory = new WSTrustChannelFactory(
binding,
new EndpointAddress(new Uri(RSTSEndpoint))))
{
var rst = new RequestSecurityToken
{
RequestType = WSTrust13Constants.RequestTypes.Issue,
AppliesTo = new EndpointAddress(RPRealm),
KeyType = WSTrust13Constants.KeyTypes.Bearer,
};
factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
factory.TrustVersion = TrustVersion.WSTrust13;
factory.Credentials.SupportInteractive = false;
factory.ConfigureChannelFactory();
var channel = factory.CreateChannelWithIssuedToken(IdPToken);
RequestSecurityTokenResponse rstr;
SecurityToken token = channel.Issue(rst, out rstr);
return token;
}
}
:
이
내 코드입니다 utf-8) 내 코드가 무엇입니까? 미리 감사드립니다.
Thinktecture.IdentityModel에서 WSTrust-Bindings를 사용해보십시오. 두 번째 홉의 경우 IssuedTokenWSTrustBinding을 사용합니다. 내가 IssuedTokenWSTrustBinding를 사용하는 경우 – leastprivilege
, 내가 얻을 오류 : 서명 토큰 일반 XML 토큰 : validFrom : 2013년 5월 5일 14시 51분 22초 validTo : 2013년 5월 5일 15시 51분 22초 InternalTokenReference : SamlAssertionKeyIdentifierClause (AssertionId (AssertionId = '_29979767-107a-4c16-b59b-4a9462edfea3') 외부 요소 참조 : SamlAssertionKeyIdentifierClause (AssertionId = '_29979767-107a-4c16-b59b-4a9462edfea3') 토큰 요소 : (EncryptedData, http://www.w3.org/2001/04/xmlenC#) 에는 키가 없습니다. 보안 토큰은 암호화 작업을 수행하는 데 필요한 컨텍스트에서 사용되지만 토큰에는 암호화가 포함되어 있지 않습니다. – user1551454