EDN Admin
Well-known member
Hi,
Im trying to get a Security Token from the local STS.
static string ServiceAddress = "https://developer-pc/logonWIF";
static string STSAddress = "https://developer-pc/STS/users/issue.svc/mex";
static X509Certificate2 STSCertificate = GetCertificateFromStore("CN=Developer-pc");
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
// authenticate with WS-Trust endpoint
var factory = new WSTrustChannelFactory(
new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential),
new EndpointAddress(STSAddress));
factory.Credentials.UserName.UserName = model.UserName;
factory.Credentials.UserName.Password = model.Password;
var channel = (WSTrustChannel)factory.CreateChannel();
var rst = new RequestSecurityToken
{
RequestType = RequestTypes.Issue,
AppliesTo = new EndpointAddress(ServiceAddress),
KeyType = KeyTypes.Bearer,
Entropy = new Entropy(CreateEntropy(), new X509EncryptingCredentials(STSCertificate))
};
var genericToken = channel.Issue(rst) as GenericXmlSecurityToken;
At this final line Im getting the following exception:
<span lang="EN-US {"An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail."}
<span lang="EN-US
<span lang="EN-US {"The message with Action http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched
Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."}
Can anyone help me solving this problem?
Thanks
<span lang="EN-US <br/>
<hr class="sig Mário Vaz Henriques .NET Dev
View the full article
Im trying to get a Security Token from the local STS.
static string ServiceAddress = "https://developer-pc/logonWIF";
static string STSAddress = "https://developer-pc/STS/users/issue.svc/mex";
static X509Certificate2 STSCertificate = GetCertificateFromStore("CN=Developer-pc");
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
// authenticate with WS-Trust endpoint
var factory = new WSTrustChannelFactory(
new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential),
new EndpointAddress(STSAddress));
factory.Credentials.UserName.UserName = model.UserName;
factory.Credentials.UserName.Password = model.Password;
var channel = (WSTrustChannel)factory.CreateChannel();
var rst = new RequestSecurityToken
{
RequestType = RequestTypes.Issue,
AppliesTo = new EndpointAddress(ServiceAddress),
KeyType = KeyTypes.Bearer,
Entropy = new Entropy(CreateEntropy(), new X509EncryptingCredentials(STSCertificate))
};
var genericToken = channel.Issue(rst) as GenericXmlSecurityToken;
At this final line Im getting the following exception:
<span lang="EN-US {"An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail."}
<span lang="EN-US
<span lang="EN-US {"The message with Action http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched
Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."}
Can anyone help me solving this problem?
Thanks
<span lang="EN-US <br/>
<hr class="sig Mário Vaz Henriques .NET Dev
View the full article