11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12: Building Secure <strong>Web</strong> Services 333To call a <strong>Web</strong> service configured for Integrated Windows authentication, theconsumer must explicitly configure the Credentials property on the proxy.To flow the security context of the client’s Windows security context (either from animpersonating thread token or process token) to a <strong>Web</strong> service you can set theCredentials property of the <strong>Web</strong> service proxy toCredentialCache.DefaultCredentials as follows.proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;You can also use an explicit set of credentials as follows:CredentialCache cache = new CredentialCache();cache.Add( new Uri(proxy.Url), // <strong>Web</strong> service URL"Negotiate",// Kerberos or NTLMnew NetworkCredential(userName, password, domain));proxy.Credentials = cache;If you need to specify explicit credentials, do not hard code them or store them inplaintext. Encrypt account credentials by using DPAPI <strong>and</strong> store the encrypted dataeither in an element in <strong>Web</strong>.config or beneath a restricted registry key.For more information about platform level authentication, see the “<strong>Web</strong> Services<strong>Security</strong>” section in “Microsoft patterns & practices Volume I, Building SecureASP.NET <strong>Application</strong>s: Authentication, Authorization, <strong>and</strong> Secure Communication” athttp://msdn.microsoft.com/library/en-us/dnnetsec/html/secnetlpMSDN.asp?frame=true.Message Level AuthenticationYou can use WSE to implement a message level authentication solution thatconforms to the emerging WS-<strong>Security</strong> st<strong>and</strong>ard. This approach allows you topass authentication tokens in a st<strong>and</strong>ard way by using SOAP headers.Note When two parties agree to use WS-<strong>Security</strong>, the precise format of the authentication tokenmust also be agreed upon.The following types of authentication token can be used <strong>and</strong> are supported by WSE:●●●●User name <strong>and</strong> passwordKerberos ticketX.509 certificateCustom token

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!