ASP.Net Security Chapter 10 Jeff Prosise’s Book. Authentication To ascertain the caller’s identity –Windows authentication –Forms authentication –Passport.

Slides:



Advertisements
Similar presentations
Forms Authentication, Users, Roles, Membership Ventsislav Popov Crossroad Ltd.
Advertisements

Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
Securing web applications using Java EE Dr Jim Briggs 1.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 13: Administering Web Resources.
ASP.NET Web Application Security Hannes Preishuber ppedv AG
Authenticating Users in an ASP.NET Application. Web Site Administration Tool From VS 2008, click Website/ ASP.Net Configuration to open Web Site Administration.
An Authorization Service using.NET Passport ™ as underlying Authentication Scheme Bar-Hen Ron Hochberger Daniel Winter 2002 Technion – Israel Institute.
Microsoft ASP.NET Security Venkat Chilakala Support Professional Microsoft Corporation.
Security in.NET Framework Sergey Baidachni MCT, MCSD, MCDBA.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
Chapter 13 – Site Security. Internet Information Server ASP.NET Applications.NET Framework Windows NT/2000 Operating System Forms Passport Windows Certificates.
Website Security ISYS 512. Cookies Data in Cookies System.Web Which web site set the cookie Expiration date –DateTime data type –TimeSpan data type One.
Access Control in IIS 6.0 Windows 2003 Server Prepared by- Shamima Rahman School of Science and Computer Engineering University of Houston - Clear Lake.
Jonas Thomsen, Ph.d. student Computer Science University of Aarhus Best Practices and Techniques for Building Secure Microsoft.
Role based Security in.NET By By Aasia Riasat Aasia RiasatCS-795.
Module 4 Managing Client Access. Module Overview Configuring the Client Access Server Role Configuring Client Access Services for Outlook Clients Configuring.
Internet Information Server 6.0. Overview  What’s New in IIS 6.0?  Built-in Accounts and IIS 6.0  IIS Pass-Through Authentication  Securing Web Traffic.
Delivering Excellence in Software Engineering ® EPAM Systems. All rights reserved. ASP.NET Authentication.
Edwin Sarmiento Microsoft MVP – Windows Server System Senior Systems Engineer/Database Administrator Fujitsu Asia Pte Ltd
Ins and Outs of Authenticating Users Requests to IIS 6.0 and ASP.NET Chris Adams Program Manager IIS Product Unit Microsoft Corporation.
Understanding Integrated Authentication in IIS Chris Adams IIS Supportability Lead Microsoft Corp.
Building Secure Applications
Session 11: Security with ASP.NET
Authentication and Authorization CS795/895. How.Net Security Works Users who log in to the application are granted a principal and an identity, based.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
Forms Authentication, Users, Roles, Membership Svetlin Nakov Telerik Corporation
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter Four Configuring Outlook and Outlook Web Access.
Copyright 2000 eMation SECURITY - Controlling Data Access with
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Securing a Microsoft ASP.NET Web Application.
1 Web services and security ---discuss different ways to enforce security Presenter: Han, Xue.
.Net and Web Services Security CS795. Web Services A web application Does not have a user interface (as a traditional web application); instead, it exposes.
Module 5 Configuring Authentication. Module Overview Lesson 1: Understanding Classic SharePoint Authentication Providers Lesson 2: Understanding Federated.
Dr. Mustafa Cem Kasapbaşı Security in ASP.NET. Determining Security Requirements Restricted File Types.
Effective Security in ASP.Net Applications Jatin Sharma: Summer 2005.
Grid Chemistry System Architecture Overview Akylbek Zhumabayev.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Securing Your ASP.NET Application Presented by: Rob Bagby Developer Evangelist Microsoft ( )
The.NET Runtime and IIS Presented by Chris Dickey – cdickey.net consulting
PROG Advanced Web Applications With.NET PROG Advanced Web Applications With.NET User Authentication & Authorization.
1 CS 3870/CS 5870: Note 07 Lab 3 Lab 4 Test 1: Two Tables.
Module 11: Securing a Microsoft ASP.NET Web Application.
Slide 1 ASP Authentication There are basically three authentication modes Windows Passport Forms There are others through WCF You choose an authentication.
Module 7: Creating a Microsoft ASP.NET Web Application.
Website Security ISYS 512. Authentication Authentication is the process that determines the identity of a user.
DEV301 Building Secure ASP.NET Applications Scott Guthrie ASP.NET Team.
G CITRIXHACKIN. Citrix Presentation Server 4.5 New version is called XenApp/Server Common Deployments Nfuse classic CSG – Citrix Secure Gateway Citrix.
CS795.Net Impersonation… why & How? Presented by: Vijay Reddy Mara.
Ins and Outs of Authenticating Users Requests to IIS 6.0 and ASP.NET Chris Adams Program Manager IIS Product Unit Microsoft Corporation.
MEMBERSHIP AND IDENTITY Active server pages (ASP.NET) 1 Chapter-4.
GUDURU PRAVEEN REDDY.NET IMPERSONATION. Contents Introduction Impersonation Enabled Impersonation Disabled Impersonation Class Libraries Impersonation.
IIS and.Net security -Vasudha Bhat. What is IIS? Why do we need IIS? Internet Information Services (IIS) is a Web server, its primary job is to accept.
Configuring and Troubleshooting Identity and Access Solutions with Windows Server® 2008 Active Directory®
1 Chapter Overview Creating Web Sites and FTP Sites Creating Virtual Directories Managing Site Security Troubleshooting IIS.
Security E-Learning Chapter 08. Security Control access to your web site –3 Techinques for Identifying users Giving users access to your site Securing.
Configuring and Deploying Web Applications Lesson 7.
Securing Web Applications Lesson 4B / Slide 1 of 34 J2EE Web Components Pre-assessment Questions 1. Identify the correct return type returned by the doStartTag()
Security. Agenda ASP.NET security basics AuthenticationAuthorization Security principals Forms authentication Membership service Login controls Role Management.
ASP.NET 2.0 Security Alex Mackman CM Group Ltd
ASP.NET Essentials State management, authentication, and Web Services Daniele Pagano Arizona State University.
Security In your webSite.
Unit 7 Learning Objectives
Agenda Introduction Security flow for a request Authentication
Security Basics and ASP.NET Support
Jim Fawcett CSE686 – Internet Programming Summer 2005
IIS.
Introduction to .net Impersonation
Created by : Asst. Prof. Ashish Shah
HACKIN G CITRIX.
Presentation transcript:

ASP.Net Security Chapter 10 Jeff Prosise’s Book

Authentication To ascertain the caller’s identity –Windows authentication –Forms authentication –Passport authentication Windows authentication: Here, IIS does the authentication and makes the caller’s identity available to ASP.Net (via a token) –Most suitable when everyone that uses the application can login to the local machine –Uses the built-in security features of the OS

Passport authentication: –Passport serves as a front-end to a large group of users registered with Microsoft Passport –Such users can be authenticated anywhere on the Internet by applications that present long credentials to Passport. –If Passport validates them, it returns an authentication ticket to the application; that in turn stores it as an encoded cookie

Forms authentication –Relies on login forms in web pages to authenticate users –In an e-commerce application such as e-bay’s bidding, windows authentication is not viable since it is impractical to create windows accounts for all millions –In web.config, we set –Other modes are: None, Windows, and Passport

Authorization Determines what resources a user can access ASP.Net supports: –ACL authorization or file authorization---e.g., using NTFS file system’s ACL –URL authorization---relies on configuration directives in web.config using the element –Authorization linkAuthorization link

Windows Authentication Maps incoming requests to accounts on the web server Used to serve a well defined user group that may be controlled through windows accounts –Basic authentication: transmits a user name and password in each request; IIS maps them to an account on the web server and generates a token. Suppose a web page is placed in the virtual directory Suppose IIS is configured to disallow anonymous access to that directory and to require basic authentication When a user attempts to access it for the first time (via HTTP request, a 401 is returned indicating that it requires basic authentication The user’s browser then prompts the user for windows user name/password Problem: User name/password sent in plain text between the browser and the web server with each request; user needs a windows account –Digest authentication: User name/password are sent as an encrypted token with each request integrated windows authentication

IIS Security Internet Information Services---a web server IIS protects a server in four ways: –Web applications are deployed in virtual directories that are URL-addressable on the server. Remote clients cannot automatically access files outside this directory. –IIS assigns every request a token---a windows security principal; OS and.Net check this token prior to allowing access –It can enable/disable requests based on IP addresses and domains –Supports SSL and HTTPs –IIS supports four types of authentication: Basic authentication (user name/password) Digest authentication (user name/password) Integrated windows authentication SSL client authentication

Forms Authenticatrion Authenticates a user by asking the user to type credentials (e.g., user name/password) into a web form. Entries in web.config can identify login page When a user accesses for the 1 st time, ASP.Net redirects the user to the login page. If the login is successful, ASP.Net issues a ticket in the form of a cookie and redirects the user to the page originally requested. The cookie enables the user not to login everytime. Lifetime of a cookie is dictated by your application.

Example Application with Forms Authentication Application contains two pages: –PublicPage.aspx --- viewed by any one –ProtectedPage.aspx --- available only to authenticated users (validated by login page) LoginPage.aspx---asks for a user name and a password Web.config---stores valid user names and passwords

PublicPage.aspx Public Page <asp:Button Text="View Secret Message" OnClick="OnViewSecret" RunAt="server" /> void OnViewSecret (Object sender, EventArgs e) { Response.Redirect ("Secret/ProtectedPage.aspx"); }

LoginPage.aspx Please Log In User Name: Password: <asp:TextBox ID="Password" TextMode="password" RunAt="server" /> <asp:Button Text="Log In" OnClick="OnLogIn" RunAt="server" /> void OnLogIn (Object sender, EventArgs e) { if (FormsAuthentication.Authenticate (UserName.Text, Password.Text)) FormsAuthentication.RedirectFromLoginPage (UserName.Text, false); else Output.Text = "Invalid login"; }

Web.config in the main directory

Web.config in the secret subdirectory (to deny unauthenticated users)

Why is the earlier example not realistic? Unreasonable to store passwords in clear text Storing a large number of names/passwords in Web.config is unrealistic. Instead, store them in a database. Modified Login.aspx is in the next few slides

Please Log In User Name: Password: <asp:TextBox ID="Password" TextMode="password" RunAt="server" /> <asp:Button Text="Log In" OnClick="OnLogIn" RunAt="server" />

<asp:Button Text="Log In" OnClick="OnLogIn" RunAt="server" /> <asp:CheckBox Text="Keep me signed in" ID="Persistent" RunAt="server" />

void OnLogIn (Object sender, EventArgs e) { if (CustomAuthenticate (UserName.Text, Password.Text)) FormsAuthentication.RedirectFromLoginPage (UserName.Text, Persistent.Checked); else Output.Text = "Invalid login"; } bool CustomAuthenticate (string username, string password) { SqlConnection connection = new SqlConnection ("server=localhost;database=weblogin;uid=sa;pwd="); try { connection.Open (); StringBuilder builder = new StringBuilder (); builder.Append ("select count (*) from users " + "where username = \'"); builder.Append (username); builder.Append ("\' and cast (rtrim (password) as " + "varbinary) = cast (\'"); builder.Append (password); builder.Append ("\' as varbinary)"); SqlCommand command = new SqlCommand (builder.ToString (), connection); int count = (int) command.ExecuteScalar (); return (count > 0); } catch (SqlException) { return false; } finally { connection.Close (); }

New Web.config in main directory

Authentication Cookie Lifetime Timeout value is controlled by: –In Machine.config file: –In local Web.config file: configuration>

Forms Authentication and Role- based Security Previous example, all authenticated users have access; what if we want to restrict access to a few? (Here, * means all; ? means unauthenticated users) –In Web.config of the secret page:

Alternately, deny access to Jeff, Bob, and Mary explicitly. Order sensitive statement execution Still not practical when a large number of users are involved Solution: Role based control

Using role-based authorization: Step 1 In Web.config file of the secret directory:

Step 2: Mapping users to roles void Application_AuthenticateRequest (Object sender, EventArgs e) { HttpApplication app = (HttpApplication) sender; if (app.Request.IsAuthenticated && app.User.Identity is FormsIdentity) { FormsIdentity identity = (FormsIdentity) app.User.Identity; // Find out what role (if any) the user belongs to string role = GetUserRole (identity.Name); //From DB // Create a GenericPrincipal containing the role name // and assign it to the current request if (role != null) app.Context.User = new GenericPrincipal (identity, new string[] { role }); }

Multiple roles? if (role != null) app.Context.User = new GenericPrincipal (identity, new string[] { role }); The 2 nd parameter is a string and hence could be: new string[] { “Manager”, “Developer”}); In Web.config we can say: