We have a wcf webservice that is secured using a Custom STS Active Federation Implementation.
So clients have to contact the STS for a "Token" with which it can call the methods in WCF Service.
I am puzzled how to make self service call from the service itself.
Steps are below
- Client calls STS to get Token
- Using this Token it calls a method in WCF service
- Method in WCF Service is getting executed
- i need to make a call to another web service method by creating channel factory and using the bootstrap token that is available in the thread
How to implement the 4th step?
public int GetValue(string input)
{
CallGetValue1();
return int.Parse(input);
}
public int GetValue1()
{
return int.MaxValue;
}
private void CallGetValue1()
{
var channelFactory = new ChannelFactory<IWCFService>("WCFService");
channelFactory.Credentials.SupportInteractive = false;
channelFactory.ConfigureChannelFactory();
var proxy = channelFactory.CreateChannelWithIssuedToken(GetSecurityToken());
var result = proxy.GetValue1();
}
private static SecurityToken GetSecurityToken()
{
var identity = Thread.CurrentPrincipal.Identity as IClaimsIdentity;
return identity.BootstrapToken;
}
CallGetValue1 gives me some error @ proxy.GetValue1()
System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: The security token authenticator 'System.ServiceModel.Security.Tokens.GenericXmlSecurityTokenAuthenticator' cannot validate a token of type 'System.IdentityModel.Tokens.SamlSecurityToken'. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.IdentityModel.Tokens.SecurityTokenValidationException: The security token authenticator 'System.ServiceModel.Security.Tokens.GenericXmlSecurityTokenAuthenticator' cannot validate a token of type 'System.IdentityModel.Tokens.SamlSecurityToken'.
Am sorry i dono what details to add more. If you need more details please do reply in the comments. Thanks :)