mirror of
https://github.com/ditkrg/AuthorizationServerDemos.git
synced 2026-01-23 03:36:52 +00:00
the RE node api now uses OIDC
This commit is contained in:
parent
0f7550c362
commit
732f851302
@ -2,11 +2,28 @@ const express = require('express')
|
|||||||
const cors = require('cors')
|
const cors = require('cors')
|
||||||
const bodyParser = require('body-parser')
|
const bodyParser = require('body-parser')
|
||||||
const db = require('./queries')
|
const db = require('./queries')
|
||||||
|
const jwt = require('express-jwt');
|
||||||
|
const jwksRsa = require('jwks-rsa');
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
app.use(cors())
|
app.use(cors())
|
||||||
const port = 8000
|
const port = 8000
|
||||||
|
|
||||||
|
app.use(jwt({
|
||||||
|
// Dynamically provide a signing key based on the kid in the header and the signing keys provided by the JWKS endpoint.
|
||||||
|
secret: jwksRsa.expressJwtSecret({
|
||||||
|
cache: true,
|
||||||
|
rateLimit: true,
|
||||||
|
jwksRequestsPerMinute: 5,
|
||||||
|
jwksUri: `http://localhost:10000/.well-known/openid-configuration/jwks`
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Validate the audience and the issuer.
|
||||||
|
audience: 'real-estate-api',
|
||||||
|
issuer: 'http://localhost:10000',
|
||||||
|
algorithms: [ 'RS256' ]
|
||||||
|
}));
|
||||||
|
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(
|
app.use(
|
||||||
bodyParser.urlencoded({
|
bodyParser.urlencoded({
|
||||||
|
|||||||
1480
Node/real-estate/package-lock.json
generated
1480
Node/real-estate/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
"express-jwt": "^6.0.0",
|
||||||
|
"jwks-rsa": "^1.12.2",
|
||||||
"pg": "^8.5.1"
|
"pg": "^8.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ const VehiclesMain = () => {
|
|||||||
async function getVehicles() {
|
async function getVehicles() {
|
||||||
console.log(user);
|
console.log(user);
|
||||||
const vehicles = await apiService.getVehiclesFromApi(user.access_token);
|
const vehicles = await apiService.getVehiclesFromApi(user.access_token);
|
||||||
|
console.log(vehicles);
|
||||||
setVehicleData(vehicles);
|
setVehicleData(vehicles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user