MEAN login management CS252.

Slides:



Advertisements
Similar presentations
MFA for Business Banking – Security Code Multifactor Authentication: Quick Tip Sheets Note to Financial Institutions: We are providing these QT sheets.
Advertisements

Presenter: James Huang Date: Sept. 29,  HTTP and WWW  Bottle Web Framework  Request Routing  Sending Static Files  Handling HTML  HTTP Errors.
Forms Authentication, Users, Roles, Membership Ventsislav Popov Crossroad Ltd.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
Getting Started with Pearson Mastering products This presentation is designed to help you get started with any of the following Pearson online technologies:
Web Application Vulnerabilities Checklist. EC-Council Parameter Checklist  URL request  URL encoding  Query string  Header  Cookie  Form field 
15. User Authentication, Form Validation, Paging. M. Udin Harun Al Rasyid, S.Kom, Ph.D
Login Screen This is the Sign In page for the Dashboard Enter Id and Password to sign In New User Registration.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Introduction: This VCSS training session has been developed to provide : I.A quick overview of VCSS II.A walk through of the main VCSS features III.Solutions.
Additional Topics. Tutorial #9 Review – Forms Forms Legend and fieldset Fields Text Password Radio buttons, check box, text area, select lists Buttons.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Create an online booking system (login/registration)
Nina Drozd Supervisor: Fearghal Morgan Co-Supervisor: Martin Glavin Project Progress Presentation.
Login Screen This is the Sign In page for the Dashboard New User Registration Enter Id and Password to sign In.
Forms Authentication, Users, Roles, Membership Svetlin Nakov Telerik Corporation
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
MSM Computer Orientation PowerSchool MSM Web Page SchoolFusion/Class Pages.
Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2012.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
Getting Started with:. Registering for Pearson MasteringNutrition is easy! Go to the home page to get started
A little PHP. Enter the simple HTML code seen below.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
Sayed Ahmed Computer Engineering, BUET, Bangladesh MSc., Computer Science, Canada
Created by Bonnie Smith SimNet Registration and Overview Created for Fresno City College CIT 12 – Computer Literacy Students.
1 ITI 1120 Lab # 1 An Introduction to the Lab Environment Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot.
Feedback #2 (under assignments) Lecture Code:
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The.
ASSIGNMENT 2 Salim Malakouti. Ticketing Website  User submits tickets  Admins answer tickets or take appropriate actions.
Scheduler CSE 403 Project SDS Presentation. What is our project? We are building a web application to manage user’s time online User comes to our webpage.
Sessions and cookies (part 2) MIS 3501, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/19/2015.
LOGIN FORMS.
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
Web Programming Assignment #3: Admin, Moderator and User Functions Old Dominion University Department of Computer Science CS 418/518 Fall 2008 Michael.
NodeJS Security Using PassportJS and HelmetJS:
Getting Started with.
Web Application Vulnerabilities, Detection Mechanisms, and Defenses
Web-Technology Exam preparation.
CMPE 280 Web UI Design and Development October 19 Class Meeting
CMPE 280 Web UI Design and Development October 24 Class Meeting
CMPE 280 Web UI Design and Development October 26 Class Meeting
JavaScript: ExpressJS Overview
CSE 403 Project SDS Presentation
How to Register on Active Orders Trading Grid Company Registration
Getting Started with Pearson Mastering products
Web Systems Development (CSC-215)
PHP: Security issues FdSc Module 109 Server side scripting and
NMD202 Web Scripting Week9.
Abel Sanchez, John R. Williams
Chapter 13 Security Methods Part 3.
Lecture 2 - SQL Injection
Getting Started with:.
This is the Sign In page for the Dashboard
How to Submit your Booking Requests?
One EPIC Place Website Scheduler
MyLion Registration Website | Mobile device
Welcome to Grant Tracker!
The first time you login in to the upgraded system, please select ‘Forgotten your password?’ to reset your password before using the system.
Presentation transcript:

MEAN login management CS252

Last week We looked at how to secure a LAMP application with a password-based scheme Hopefully, you have looked at the PHP code and made the changes we agreed upon Assignment 4 is due November 8th midnight Have to submit link to working login management system incorporating these features

Basic password scheme Hash function h : strings  strings Given h(password), hard to find password No known algorithm better than trial and error User password stored as h(password) When user enters password System computes h(password) Compares with entry in password file No passwords stored on disk

Password-based authentication for nodeJS applications Structure of a typical express-node app Bin Contains binary file that runs the app Models Contains data models as separate js files Routes Contains routing instructions for different landing pages Each as a separate js file Views Different html/template files Public Contains client-side css and javascript Node_modules Contains modules from npm Package.json Lists modules from npm actually required by the application App.js The main application file Includes dependencies, and sets up important middleware

Adding password authentication to a vanilla node app Link to tutorial on course website Comes with an associated github repo Major conceptual steps Storing user registration details in database Comparing user inputs to database entries Routing users based on authentication success/failure

User registration Add a users model in the models directory Fields Email, needs to be unique and mandatory Username, likewise Password Password confirmation Export the users model so your login router can use it

Routing for user registration In your routing file, add a POST route for sending input that looks like users to the server if (req.body.email && req.body.username && req.body.password && req.body.passwordConf) { var userData = { email: req.body.email, username: req.body.username, password: req.body.password, passwordConf: req.body.passwordConf, } //use schema.create to insert data into the db User.create(userData, function (err, user) { if (err) { return next(err) } else { return res.redirect('/profile'); } }); } What’s wrong with this?

Have to hash password before storage Can use npm module bcrypt to do this Edit the users model file to add a function to hash passwords before storing UserSchema.pre('save', function (next) { var user = this; bcrypt.hash(user.password, 10, function (err, hash) { if (err) { return next(err); } user.password = hash; next(); }) });

Logging people in Two steps needed Setting up a login route Setting up sessions for authenticated users Login route is simple to set up in routing file router.get('/profile', function (req, res, next) { User.findById(req.session.userId) .exec(function (error, user) { if (error) { return next(error); } else { if (user === null) { var err = new Error(‘Fail'); err.status = 400; return next(err); return res.send('<p>Logged in <p>') } });

Session management Express can help – use the prebuilt session package Add to main app.js file Store the user ID from mongo in the req.session.userId variable in the POST route to associate all future sessions for this user with this ID

Login authentication Have to define authentication protocol as part of data model, in users model file UserSchema.statics.authenticate = function (email, password, callback) { User.findOne({ email: email }) .exec(function (err, user) { if (err) { return callback(err) } else if (!user) { var err = new Error('User not found.'); err.status = 401; return callback(err); } bcrypt.compare(password, user.password, function (err, result) { if (result === true) { return callback(null, user); } else { return callback(); } }) }); }

Login authentication Have to define authentication protocol as part of data model, in users model file (middleware that returns a function that listens for requests) UserSchema.statics.authenticate = function (email, password, callback) { User.findOne({ email: email }) .exec(function (err, user) { if (err) { return callback(err) } else if (!user) { var err = new Error('User not found.'); err.status = 401; return callback(err); } bcrypt.compare(password, user.password, function (err, result) { if (result === true) { return callback(null, user); } else { return callback(); } }) }); }

Protecting pages Define a function that checks for the presence of valid session and userID in the incoming request in your routing file For protecting pages, pass this function as a parameter in the GET request in the router

Missing from this demo Password reset Missing rate limits How would you implement it? Remember the same precautions we discussed last week for security hold here too Missing rate limits Protection against XSS attacks Is this system vulnerable?

Third-party authentication Designing a solid and secure authentication system is hard All it takes is one forgetful error, and your entire database is compromised Easier to profit from others’ hard work Third-party authentication systems Open authorization protocols

OpenAuth2.0 Use third party authorization servers to authenticate users who want to use your app

Service architecture You register your app with third party authorization service Client accesses third party authorization service with third party credentials Third party grants an access token that your app recognizes No new login credentials needed

Next week in lab We will design a login management system using Passport.js Conceptually the same as what we’ve seen today, but with more robust application support Link to tutorial and corresponding github repo on course website We will reshape the login management system to log people in using FB/Twitter Might be the best model for your project apps

Logistics Wednesday batch will go to lab this Saturday (Nov 3rd) in lieu of Nov 7th Projects should be substantively finished by Nov 10th Last week of course We will meet in RM101 on Monday and Wednesday from 1400-1600 Attendance will be taken, as for all lab sessions Monday batch will demo their apps on Monday Wednesday batch will demo their apps on Wednesday No class on 15th November End sem in DOAA end sem slot (Nov 28th, 1600-1900)

App demo logistics You will make a 5-7 minute video of your app Point out all salient features and views Show it in action Point out pieces of code that were hard to execute Need not have accompanying commentary You will have the option to talk over the visuals during the demo Host the video on YouTube/other web sources and send me the link before the presentation There will be external examiners, who will be free to ask questions about any aspect of the app to any member of the team

End sem pointers I will try to make it non-trivial If you have worked on all the assignments yourself, you will have no trouble If you have looked at others’ code, or had stuff explained to you, you will have trouble Will provide separation for grading Closed book, closed notes Likely 90 minute exam