コード例 #1
0
ファイル: Program.cs プロジェクト: rachkoud/HardCodedToken
        private static void CallService(SecurityToken token)
        {
            "Calling Service".ConsoleYellow();

            var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential);

            binding.Security.Message.EstablishSecurityContext = false;
            binding.Security.Message.IssuedKeyType            = SecurityKeyType.BearerKey;

            var factory = new ChannelFactory <IClaimsService>(binding, new EndpointAddress(_serviceAddress));

            factory.Credentials.SupportInteractive       = false;
            factory.Credentials.UseIdentityConfiguration = true;
            var proxy = factory.CreateChannelWithIssuedToken(token);

            var id = proxy.GetIdentity();

            Helper.ShowIdentity(id);
        }