120 likes | 139 Views
CS320 Web and Internet Programming Authentication, Authorization, and SSL. Chengyu Sun California State University, Los Angeles. Overview. General Information. Everyone. Insider Information. Alumni. Web Site of Alumni Association. Administrators. Admin Information.
E N D
CS320 Web and Internet ProgrammingAuthentication, Authorization, and SSL Chengyu Sun California State University, Los Angeles
Overview General Information Everyone Insider Information Alumni Web Site of Alumni Association Administrators Admin Information
Client and Server Interaction Client Server request page x who are you? Authentication username/password Authorization (Access Control) you’re not authorized to access page x Connection Security
Authentication • Basic • Digest • Form • SSL
Authentication – Basic • Part of HTTP protocol • Support by all web servers and browsers request for a restricted page prompt for username/password resend request authorization header field = username & password • Problem?
Authentication – Digest … • Part of HTTP 1.1 protocol • Support by most web servers and browsers request for a restricted page prompt for username/password + nonce resend request + message digest MD5(username + password + nonce + other stuff)
… Authentication – Digest • MD5 • By Ronald Rivest (“R” in RSA) • String of arbitrary length 128bit digest • It’s virtually impossible that two different strings have the same digest • It’s virtually impossible to compute the original string from the digest • How does the server validate the username/password? • Why nonce?
Authentication – Form • Both Basic and Digest authentications are implemented by the HTTP server • Form authentication is implemented by the Servlet/JSP engine • Form and Basic • Username/password are passed as clear text • Login page instead of login prompt
Form Authentication – User File <?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <role rolename="test"/> <user username="tomadmin" password=“abcd" fullName="" roles="admin,manager,standard,tomcat"/> <user username="csun" password="abcd" fullName="Chengyu Sun" roles="test"/> </tomcat-users>
Form Authentication – Login Page <form method="post" action="j_security_check"> <input type="text“ name="j_username"> <input type="password" name="j_password"> </form>
web.xml <security-constraint> <web-resource-collection> <web-resource-name>restricted</web-resource-name> <url-pattern>/restricted/*</url-pattern> <web-resource-collection/> <auth-constraint> <role-name>test</role-name> <auth-constraint/> </security-constraint> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/FormLogin.html</form-login-page> <form-error-page>/FormError.html</form-error-page> </form-login-config> </login-config>
SSL • HTTPS • Server authentication • Client authentication • Connection encryption