The brackets at the end of each step indicate the alias’s or IntelliJ Live Templates to use. You can find the template definitions at mraible/idea-live-templates.
-
start.spring.io: h2, lombok, jpa, rest, web, and okta [
bootiful-start
]http https://start.spring.io/starter.zip dependencies==h2,lombok,data-jpa,data-rest,web,okta \ packageName==com.okta.developer.demo -d
-
Comment out Okta starter in
pom.xml
-
Add
Beer
,BeerRepository
,BeerCommandLineRunner
and add default beers [boot-entity-lombok
,boot-repo
,boot-command
,boot-add
] -
Start and see list of beers in console
-
Create
BeerController
with a/good-beers
endpoint [boot-controller
,boot-good
] -
Restart and confirm http://localhost:8080/good-beers works in browser and with http
http POST :8080/beers name='Guinness' http PUT :8080/beers/10 name='Guinness is good for you' http DELETE :8080/beers/10
-
Run
npx create-react-app client --typescript
; show app withnpm start
-
Modify
App.tsx
and add acomponentDidMount()
method to fetch good beers [react-fetch
] -
Create interfaces:
Beer
,AppProps
, andAppState
; add constructor and initialize state [react-constructor
] -
Change
render()
to show beers [react-loading
andreact-beer-list
] -
Configure CORS for Spring Boot and show list of beers
-
Create
BeerList.tsx
and copy code fromApp.tsx
; changeApp.tsx
to use<BeerList/>
-
Create
GiphyImage.tsx
; add toBeerList
; show beers with images [react-giphy
]
-
Run
npm run build
; serve withserve -s build -p 3000
-
Run Lighthouse; fix 512px icon
-
Mention Cloud Foundry and Heroku + scripts
-
Uncomment Okta Spring Boot starter in
pom.xml
-
Create OIDC app in Okta; add properties to
application.properties
[okta-oauth2
] -
Create Security configuration for resource server [
oauth2-resource-server
]@Configuration static class OktaOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests().anyRequest().authenticated() .and() .oauth2ResourceServer().jwt(); } }
-
Add Okta’s React SDK and configure
npm install -g @angular-devkit/schematics-cli npm i -D @oktadev/schematics schematics @oktadev/schematics:add-auth
-
Show
App.tsx
and how it uses<Security/>
component; show auth awareness inHome.tsx
, addBeerList
-
Update
BeerList
to addauth
toBeerListProps
-
Add CSS to
App.css
to make buttons more visible [react-css
] -
Show app and Loading…
-
Fix CORS error after adding Spring Security [
cors-filter
] -
Update
BeerList
to add an authorization header + error handling [react-token
] -
Fini!