1 / 46

Rest Services with Play Framework, MySQL, Adding Security with JWT

Learn how to build web applications with Java and Scala using Play Framework, integrating JSONs, secure database connections, and JWT for enhanced security. Explore the architecture, deployment, and best practices to create highly-scalable applications easily.

Download Presentation

Rest Services with Play Framework, MySQL, Adding Security with JWT

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rest Services with Play Framework, MySQL, Adding Security with JWT México

  2. Community Leader JDuchess Chapter Guatemala, Devs+502 Ex-JUG Member Guatemala Java Users Group (GuateJUG) Independent Consultor Full Stack Developer, Front-end y Back-end with Java, Mobile Development Android and iOS CTO at Produactivity #geek #traveler #speaker Mercedes Wyss @itrjwyss

  3. Agenda • Play Framework • Web Services Restful • JSONs • Database Connection (JPA, JDBC) • JWT (Json Web Tokens)

  4. Agenda • Play Framework • Web Services Restful • JSONs • Database Connection (JPA, JDBC) • JWT (Json Web Tokens)

  5. Play Framework • Makes it easy to build web applications with Java and Scala. • Is based on a lightweight, stateless, web-friendly architecture. • Built on Akka, provides predictable and minimal resources consumption (CPU, memory, threads) for • highly-scalable applications.

  6. Servidor: 1 CPU 2 GB Ram

  7. Play Framework • Develop using Java or Scala • Is reactive • Use the architecture MVC • Uses Netty as App Server, AKKA Http since 2.6.x (Fewer configurations) • Simulates the behavior of JRebel (more code, less deploys)

  8. JVM

  9. Reactive

  10. MVC

  11. How start a Play project? We need to use SBT Create sbt new playframework/play-scala-seed.g8 sbt new playframework/play-java-seed.g8 Deploy sbt run

  12. Full Project Structure

  13. Simple Project Structure

  14. Agenda • Play Framework • Web Services Restful • JSONs • Database connection (JPA, JDBC) • JWT (Json Web Tokens)

  15. Web Services • HyperText Transfer Protocol (HTTP) • Allows communication between a client and a server • Provide a standard means of interoperating between different software apps • Characterized for interoperability and extensibility • Based on XML

  16. Linda.com (June 2017) https://www.lynda.com/Software-Development-tutorials/What-web-service/126131/145941-4.html

  17. SOAP • Simple Object Access Protocol • XML-based • Use WSDL as specification description (Web Services Description Language) • Need to follow a communication protocol

  18. Restful • Software Architecture based on HTTP method (Get, Post, Put, Delete, etc) • Typically use JSON, but can use XML, Text

  19. Madhaiyan Muthu (June 2017) https://www.slideshare.net/madhaiyanm/web-services-a-practical-approach

  20. Agenda • Play Framework • Web Services Restful • JSONs • Database connection (JPA, JDBC) • JWT (Json Web Tokens)

  21. JSON • JavaScript Object Notation • Is a lightweight data-interchange format • Self-describing • Human-reading • Is a Protocol

  22. JSON Example

  23. JSON Scheme

  24. Package controllers; import play.libs.Json; import play.mvc.Controller; import play.mvc.Result; public class HomeController extends Controller { public Result index(){ JsonNodejson = request().body().asJson(); PostRequest request = Json.fromJson(json, PostRequest.class); return ok(Json.toJson(request)); } }

  25. Agenda • Play Framework • Web Services Restful • JSONs • JWT (Json Web Tokens) • Database connection (JPA, JDBC)

  26. JWT Is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.

  27. Auth0 (June 2017) https://cdn.auth0.com/content/jwt/jwt-diagram.png

  28. JWT Structure

  29. JWT Structure

  30. JWT Structure

  31. Agenda • Play Framework • Web Services Restful • JSONs • JWT (Json Web Tokens) • Database connection (JPA, JDBC)

  32. To EndLet’s Finish our Exercise México

More Related