Slide 1

Slide 1 text

Mobile Development with Ionic, React Native, and JHipster September 4, 2019 Matt Raible | @mraible Photo by Miroslav Petrasko https://www.flickr.com/photos/theodevil/5257466382

Slide 2

Slide 2 text

Blogger on raibledesigns.com and developer.okta.com/blog Web Developer and Java Champion Father, Husband, Skier, Mountain Biker, Whitewater Rafter Open Source Connoisseur Hi, I’m Matt Raible! Bus Lover Okta Developer Advocate

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

developer.okta.com

Slide 7

Slide 7 text

Supported Authentication and Authorization Standards

Slide 8

Slide 8 text

What About You?

Slide 9

Slide 9 text

Agenda 1. Introduction to JHipster 2. JHipster Ignite 3. Ionic for JHipster 4. JHipster Roadmap 5. Action!

Slide 10

Slide 10 text

Introduction to JHipster What is JHipster? Installing and Using JHipster JHipster Microservices and OIDC Progressive Web Applications Overview Part 1

Slide 11

Slide 11 text

What is JHipster? + =

Slide 12

Slide 12 text

What is JHipster? JHipster is a development platform to generate, develop and deploy Spring Boot + Angular/React Web applications and Spring microservices. and Vue! ✨ www.jhipster.tech

Slide 13

Slide 13 text

JHipster is Inclusive github.com/jhipster/jhipster-artwork

Slide 14

Slide 14 text

A powerful workflow to build your application with Yeoman, Webpack, and Maven/Gradle JHipster Goals A sleek, modern, mobile-first front- end with Angular and Bootstrap A high-performance and robust Java stack on the server side with Spring Boot A robust microservice architecture with JHipster Registry, Netflix OSS, Elastic Stack, and Docker

Slide 15

Slide 15 text

How to Use JHipster Install JHipster and Yeoman, using npm: npm install -g generator-jhipster Create a directory and cd into it: mkdir newapp && cd newapp Run it! jhipster

Slide 16

Slide 16 text

Microservices with JHipster

Slide 17

Slide 17 text

Validate ID Token Token Endpoint Authorization Endpoint /.well-known/
 openid-configuration JWKS Endpoint UserInfo Endpoint OAuth 2.0 Authorization Server & OpenID Connect Provider (OP) OAuth 2.0 Resource Server Client (Relying Party) 1 3 2 5 4 1 Discover OpenID Provider Metadata 2 Perform OAuth flow to obtain a ID token and/or access token 3 Get JSON Web Key Set (JWKS) for signature keys 4 Validate ID token
 (JSON Web Token) 5 Get additional user attributes with access token from UserInfo endpoint OAuth 2.0 and OIDC

Slide 18

Slide 18 text

yelp.com/callback Back to redirect URI with authorization code Exchange code for access token and ID token accounts.google.com Email ********** Go to authorization server Redirect URI: yelp.com/cb Scope: openid profile Authorization Server yelp.com Connect with Google Resource owner Client accounts.google.com 
 Allow Yelp to access your public profile and contacts? No Yes Request consent from resource owner Hello Matt! accounts.google Get user info 
 with access token /userinfo OAuth 2.0 and OIDC

Slide 19

Slide 19 text

Monolith Examples JHipster 6 Demo github.com/mraible/jhipster6-demo youtu.be/uQqlO3IGpTU 21-Points Health github.com/mraible/21-points infoq.com/minibooks/jhipster-mini-book

Slide 20

Slide 20 text

Progressive Web Apps Originate from a secure origin, load while offline, and reference a web app manifest.

Slide 21

Slide 21 text

Progressive Web Apps Can be installed on your mobile device, look and act like a native application, but are distributed through the web.

Slide 22

Slide 22 text

Progressive Web Apps Are fast!

Slide 23

Slide 23 text

Enable PWA in JHipster if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker.register('/service-worker.js') .then(function () { console.log('Service Worker Registered'); }); }); } src/main/webapp/index.html

Slide 24

Slide 24 text

Add Workbox to Content Security Policy src/main/java/com/okta/developer/config/SecurityConfiguration.java @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http ... .and() .headers() .contentSecurityPolicy("default-src 'self'; script-src 'self' " + "'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; " + "style-src 'self' 'unsafe-inline'; img-src 'self' data:") .and() ... } }

Slide 25

Slide 25 text

Force HTTPS in Spring Boot src/main/java/com/okta/developer/config/SecurityConfiguration.java @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requiresChannel() .requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null) .requiresSecure(); } } developer.okta.com/blog/2018/07/30/10-ways-to-secure-spring-boot

Slide 26

Slide 26 text

Demo Using JHipster, create an app Generate entities in app Convert app to be a PWA Test with Lighthouse

Slide 27

Slide 27 text

Part 2 Ignite JHipster What is React Native? What is Ignite CLI? Ignite JHipster JWT and OIDC Support Entity Generator

Slide 28

Slide 28 text

Works on macOS, Windows, and Linux Ignite CLI Saves an average of two weeks Easily spin up a new React Native app An ever-expanding list of boilerplates and plugins infinite.red/ignite

Slide 29

Slide 29 text

Create an app: ignite new myapp -b ignite-jhipster Ignite JHipster https://github.com/ruddell/ignite-jhipster Install Ignite CLI and Ignite JHipster, using npm: npm i -g ignite-cli ignite-jhipster Ignite! A React Native boilerplate for JHipster apps

Slide 30

Slide 30 text

Demo Create an app w/ Ignite JHipster Generate entities in app Modify UI to be friendlier Run on iOS and Android

Slide 31

Slide 31 text

Build a Mobile App with React Native developer.okta.com/blog/2018/10/10/react-native-spring-boot-mobile-app

Slide 32

Slide 32 text

Part 3 Ionic 4 JHipster What is Ionic? Why? Ionic Module for JHipster JWT and OIDC Support Entity Generator

Slide 33

Slide 33 text

Ionic Ionic Framework Develop Hybrid & PWA Apps https://ionicframework.com Stencil Vanilla Web Components https://stenciljs.com PWA Toolkit Lightning fast PWAs https://github.com/ionic- team/ionic-pwa-toolkit

Slide 34

Slide 34 text

Run it! yo jhipster-ionic Ionic Module for JHipster Because Ionic Apps need some JHipster too! https://github.com/oktadeveloper/generator-jhipster-ionic Install Ionic and the Ionic Module for JHipster, using npm: npm install -g ionic generator-jhipster-ionic Profit!

Slide 35

Slide 35 text

Demo Create an app with Ionic4J Generate entities in app Modify UI to be friendlier Run on iOS and Android

Slide 36

Slide 36 text

Use Ionic for JHipster to Create Mobile Apps developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster

Slide 37

Slide 37 text

Part 4 JHipster Roadmap What You Learned What’s Next for JHipster

Slide 38

Slide 38 text

What You Learned

Slide 39

Slide 39 text

What’s Next for JHipster? Improved Reactive Support .NET Core and Node.js Blueprints RFCs are open! github.com/jhipster/generator-jhipster/tree/master/rfcs

Slide 40

Slide 40 text

Part 5 Action Try JHipster! Learn More about PWAs Try Ignite JHipster Try Ionic for JHipster Report Issues

Slide 41

Slide 41 text

The JHipster Mini-Book
 Written with Asciidoctor Free download from InfoQ: infoq.com/minibooks/jhipster-mini-book Quick and to the point, 164 pages Developed a real world app: www.21-points.com

Slide 42

Slide 42 text

Learn More stackoverflow.com Spring Boot spring.io/guides JHipster www.jhipster.tech Okta APIs developer.okta.com

Slide 43

Slide 43 text

developer.okta.com/blog @oktadev

Slide 44

Slide 44 text

git clone https://github.com/oktadeveloper/okta-spring-webflux-react- example.git github.com/mraible/mobile-jhipster Use the Source, Luke!

Slide 45

Slide 45 text

Thanks! Keep in Touch raibledesigns.com @mraible Presentations speakerdeck.com/mraible Code github.com/oktadeveloper developer.okta.com

Slide 46

Slide 46 text

developer.okta.com