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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

360 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>s2. Add the following line to the top of the file, <strong>and</strong> then save the file.3. Add an appropriately configured ACL to the file using Windows Explorer todetermine which users or user groups can <strong>and</strong> cannot access the object.Authorize Users with Principal-Based Role ChecksThe FileAuthorizationModule approach described above allows you to control whocan <strong>and</strong> cannot access the remote object. For finer grained authorization that can beapplied at the method level, you can perform authorization checks using theIPrincipal object attached to the current request.If your remote object is hosed by ASP.NET <strong>and</strong> you use Windows authentication, anIPrincipal object based on the authenticated caller’s Windows identity isautomatically created <strong>and</strong> attached to Thread.CurrentPrinicipal.If you use a custom host, create an IPrincipal object to represent the authenticateduser. The mechanics depend on your authentication approach. For example if you usea named pipe transport, you can impersonate the caller to obtain their identity <strong>and</strong>construct an IPrincipal object.With the IPrincipal object in place you can perform authorization using principalpermission dem<strong>and</strong>s both declaratively <strong>and</strong> imperatively <strong>and</strong> you can callIPrincipal.IsInRole.Consider Limiting Remote AccessIn some scenarios, where you use remoting for inter process or cross applicationdomain communication on a single computer, you can set rejectRemoteRequests totrue to ensure that your object cannot be accessed from remote computers as shownbelow.

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

Saved successfully!

Ooh no, something went wrong!