![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | InfoCard / CardSpace samples problems Hello, I am trying to complete the simple InfoCard walkthrough from the Federated Identity and Access Resource Kit - Sept 2005 CTP. I am running Windows XP SP2 with the following components installed: - Microsoft .NET Framework 3.0 - July 2006 CTP - Visual C# Express Edition - Federated Identity and Access Resource Kit - Sept 2005 CTP The .NET Framework 3.0 - July 2006 CTP provides the CardSpace control panel and the appropriate dlls for Visual C#. I have managed to re-write the sample code provided in the Federated Identity and Access Resource Kit - Sept 2005 CTP so that it utilises the new class structure in the .NET Framework 3.0 - July 2006 CTP. This includes needing to use System.IdentityModel.Policy and System.IdentityModel.Claims references. I have managed to get a simple WCF Hello World application working with the above components as long as I do not use security on the endpoints or message security. As soon as I try to bring in InfoCard into the equation, and thus endpoint security, I get a MessageSecurityException thrown which states the following: Client cannot determine the Service Principal Name vased on the identity in the target address 'http://localhost:4123/myService/endpoint1' for the purpose of SspiNegotiation/Kerberos. The target address identity must be a UPN identity (like acmedomain\alice) or SPN identity (like host\bobs-machine). The sample code shows wsHTTPBinding message security enabled with the message clientCredentialType="InfoCard", this is not a supported value in the .NET Framework 3.0 - July 2006 CTP. I am currently set to use clientCredentialType="IssuedToken". Is this correct, could this be causing the issue? I have included below my two files: Many thanks for any help / suggestions you can provide. James File 1 - Program.cs ------------------------------------------------ using System; using System.Collections.Generic; using System.Text; using System.ServiceModel; using System.IdentityModel.Policy; using System.IdentityModel.Claims; using System.IdentityModel.Selectors; namespace MyFirstHelloApp { [ServiceContract] interface IHello { [OperationContract] string SayHello(); [OperationContract] string SayWithID(); } class Hello : IHello { public const String emailClaimType = "http://schemas.microsoft.com/ws/2005/05/identity/claims/EmailAddress"; public string SayHello() { return "Hello World!"; } public string SayWithID() { AuthorizationContext authContext = OperationContext.Current.ServiceSecurityContext.AuthorizationContext; String identity = " "; for (int i = 0; i < authContext.ClaimSets.Count; i++) { foreach (Claim claim in authContext.ClaimSets[i]) { if (claim.ClaimType == emailClaimType) { identity += claim.Resource.ToString(); break; } } } return "Hello World - " + identity; } } class Program { static void Main(string[] args) { Console.WriteLine("Starting Service..."); ServiceHost sh = new ServiceHost(typeof(MyFirstHelloApp.Hello)); sh.Open(); Console.WriteLine("Service Listening..."); //Creating a client that consumes the interface (contract) Console.WriteLine("Starting Client..."); ChannelFactory<IHello> chnFactory = new ChannelFactory<IHello>("myClient"); Console.WriteLine("Client Creating Channel..."); IHello chn = chnFactory.CreateChannel(); Console.WriteLine("Client Connecting..."); Console.WriteLine(chn.SayWithID()); // Clean up chnFactory.Close(); // close the client's channel sh.Close(); // close the service host's listener } } } File 2 - App.config ------------------------------------------------ <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="myBinding"> <security mode="Message"> <message clientCredentialType="IssuedToken" /> </security> </binding> </wsHttpBinding> </bindings> <services> <service name="MyFirstHelloApp.Hello" behaviorConfiguration="MyServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost:4123/myService"></add> </baseAddresses> </host> <endpoint address="endpoint1" contract="MyFirstHelloApp.IHello" binding="wsHttpBinding" bindingConfiguration="myBinding"> <identity> <certificateReference findValue="Fabrikam" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName" /> </identity> </endpoint> </service> </services> <client> <endpoint name="myClient" address="http://localhost:4123/myService/endpoint1" contract="MyFirstHelloApp.IHello" binding="wsHttpBinding" behaviorConfiguration="MyClientBehavior"> <identity> <certificateReference findValue="Fabrikam" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> </identity> </endpoint> </client> <behaviors> <serviceBehaviors> <behavior name="MyServiceBehavior" returnUnknownExceptionsAsFaults="true" > <serviceCredentials> <serviceCertificate findValue="Fabrikam" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName" /> </serviceCredentials> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="MyClientBehavior"> <clientCredentials> <clientCertificate findValue="Fabrikam" storeLocation="CurrentUser" storeName="My" x509FindType="FindBySubjectName" /> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> </configuration> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Windows CardSpace | Vista General | |||
| CardSpace | Vista General | |||