Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF service and Thinktecture Identity server
    primarykey
    data
    text
    <p>im using the <a href="http://thinktecture.github.io/Thinktecture.IdentityServer.v2/" rel="nofollow">thinktecture identityserver</a> Security Token Service im trying to set up a scenario where I have a client using a WCF service. I'm stuck at a point where I get next error:</p> <pre><code>MessageSecurityException An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. InnerException At least one security token in the message could not be validated. </code></pre> <p>I've setup the STS on a win2008 server and all working correct its already working with an MVC site. But with a wcf service I cant get it to work. I'm using bearerkey as SecurityKeyType. I do get a token in the client app function RequestToken(). Here is my wcf service config:</p> <pre><code>&lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="ClaimWcfService.Service1"&gt; &lt;endpoint address="ClaimWcfService" binding="ws2007FederationHttpBinding" bindingConfiguration="" contract="ClaimWcfService.IService1" /&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="https://anno99-pc/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;ws2007FederationHttpBinding&gt; &lt;binding name=""&gt; &lt;security mode="TransportWithMessageCredential"&gt; &lt;message establishSecurityContext="false" issuedKeyType="BearerKey"&gt; &lt;issuerMetadata address="https://serveradress/Idsrv/issue/wstrust/mex" /&gt; &lt;/message&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/ws2007FederationHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior&gt; &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /&gt; &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; &lt;serviceAuthorization principalPermissionMode="Always" /&gt; &lt;serviceCredentials useIdentityConfiguration="true"&gt; &lt;serviceCertificate findValue="ANNO99-PC" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" /&gt; &lt;/serviceCredentials&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;protocolMapping&gt; &lt;add scheme="http" binding="ws2007FederationHttpBinding" /&gt; &lt;/protocolMapping&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;!-- Config STS --&gt; &lt;system.identityModel&gt; &lt;identityConfiguration&gt; &lt;audienceUris&gt; &lt;add value="https://anno99-pc/ClaimWcfService/Service1.svc" /&gt; &lt;/audienceUris&gt; &lt;!--Commented by Identity and Access VS Package--&gt; &lt;certificateValidation certificateValidationMode="None" /&gt; &lt;issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry"&gt; &lt;authority name="http://identityserver.v2.wkp.com/trust/wkp"&gt; &lt;keys&gt; &lt;add thumbprint="A540AD5B90B8459E919B39301B89F279A3AAEADB" /&gt; &lt;/keys&gt; &lt;validIssuers&gt; &lt;add name="http://identityserver.v2.wkp.com/trust/wkp" /&gt; &lt;/validIssuers&gt; &lt;/authority&gt; &lt;/issuerNameRegistry&gt; &lt;/identityConfiguration&gt; &lt;/system.identityModel&gt; </code></pre> <p>This is the client: It is just a console app.</p> <pre><code>static void Main(string[] args) { var token = RequestToken(); CallService(token); } static string _idsrvEndpoint = "https://serveradress/Idsrv/issue/wstrust/mixed/username"; static string _realm = "https://anno99-pc/ClaimWcfService/"; private static void CallService(SecurityToken token) { var serviceEndpoint = "https://anno99-pc/ClaimWcfService/Service1.svc"; var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential); binding.Security.Message.EstablishSecurityContext = false; binding.Security.Message.IssuedKeyType = SecurityKeyType.BearerKey; var factory = new ChannelFactory&lt;IService1&gt;(binding, new EndpointAddress(serviceEndpoint)); factory.Credentials.SupportInteractive = false; factory.Credentials.UseIdentityConfiguration = true; var channel = factory.CreateChannelWithIssuedToken(token); var data = channel.GetData(1); } private static SecurityToken RequestToken() { var binding = new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential); var credentials = new ClientCredentials(); credentials.UserName.UserName = "username"; credentials.UserName.Password = "password"; return WSTrustClient.Issue( new EndpointAddress(_idsrvEndpoint), new EndpointAddress(_realm), binding, credentials); } </code></pre> <p>If anyone could help me, that would be great.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload