Guest User

Untitled

a guest
Apr 23rd, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. var endpointAddress =
  2. new EndpointAddress("https://test/adfs/services/trust/13/usernamemixed");
  3. var binding = new Binding();
  4. var endpointReference = new EndpointReference("test");
  5. WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(binding, endpointAddress);
  6. trustChannelFactory.Credentials.UserName.UserName = "test";
  7. trustChannelFactory.Credentials.UserName.Password = "test";
  8.  
  9. WSTrustChannel channel = (WSTrustChannel)trustChannelFactory.CreateChannel();
  10.  
  11. var rst = new RequestSecurityToken
  12. {
  13. RequestType = RequestTypes.Issue,
  14. AppliesTo = endpointReference,
  15. KeyType = KeyTypes.Bearer
  16. };
  17.  
  18. RequestSecurityTokenResponse rstr = null;
  19. try
  20. {
  21. SecurityToken token = channel.Issue(rst, out rstr);
  22. }
  23. catch (Exception e)
  24. {
  25. Console.WriteLine(e.Message);
  26. }
  27.  
  28. {"The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs."}
Add Comment
Please, Sign In to add comment