Hi everyone,
I created my custom Claim-Aware WCF Service and a Custom STS Service using the WIF SDK Template.
Everything works fine but I would like to define my own custom Identity when I call the service and retrieve it in the STS Service.
For example in the following code:
protected override IClaimsIdentity GetOutputClaimsIdentity(IClaimsPrincipal principal, RequestSecurityToken request, Scope scope)
{
IClaimsIdentity callerIdentity = (IClaimsIdentity)principal.Identity;
Console.WriteLine("\nRequest from: " + callerIdentity.Name + "\n");
IClaimsIdentity outputIdentity = new ClaimsIdentity();
// Create a name claim from the incoming identity.
Claim nameClaim = new Claim(ClaimTypes.Name, callerIdentity.Name);
// Create an 'Age' claim with a value of 25. In a real scenario, this may likely be looked up from a database.
Claim ageClaim = new Claim("http://WindowsIdentityFoundationSamples/2008/05/AgeClaim", "25", ClaimValueTypes.Integer);
outputIdentity.Claims.Add(nameClaim);
Console.WriteLine("ClaimType : " + nameClaim.ClaimType);
Console.WriteLine("ClaimValue : " + nameClaim.Value);
Console.WriteLine();
Console.WriteLine("ClaimType : " + ageClaim.ClaimType);
Console.WriteLine("ClaimValue : " + ageClaim.Value);
Console.WriteLine("===========================");
outputIdentity.Claims.Add(ageClaim);
return outputIdentity;
}
The "callerIdentity.Name" value that i get from "IClaimsPrincipal principal" in the method is always my Windows credentials "MyDoman\MyUserName". I'm calling the service from a Windows Form that contains Username and Password fields and I'd like to validate those credentials in the STS by retrieving a custom Identity. I don't want to use the Windows Credentials. My question is when I can define that? because I tried many thing and I always get the Windows domain and username in "callerIdentity.Name" attribute. Thanks!