Compare commits

...

2 Commits

Author SHA1 Message Date
argoyle b4d5dbe9e3 feat: add dummy-implementation of management API 2022-04-26 16:54:03 +02:00
argoyle b476cf0e36 fix: use correct return-variable 2022-04-26 15:37:19 +02:00
2 changed files with 26 additions and 4 deletions
+24 -2
View File
@@ -43,7 +43,7 @@ const addCustomClaims = (email, customClaims, token) => {
// Configure our small auth0-mock-server
app.options('*', cors(corsOpts))
.use(cors())
.use(bodyParser.json())
.use(bodyParser.json({ strict: false }))
.use(bodyParser.urlencoded({ extended: true }))
.use(cookieParser())
.use(express.static(`${__dirname}/public`))
@@ -264,7 +264,7 @@ app.post('/issuer', (req, res) => {
}
issuer = req.body.issuer
jwksOrigin = `https://${issuer}/`
const { privateKey: key, certDer: der, thumbPrint: thumb, exponent: exp, modulus: mod } = cert(jwksOrigin)
const { privateKey: key, certDer: der, thumbprint: thumb, exponent: exp, modulus: mod } = cert(jwksOrigin)
privateKey = key
certDer = der
thumbprint = thumb
@@ -274,6 +274,28 @@ app.post('/issuer', (req, res) => {
res.send('ok')
})
app.get('/api/v2/users-by-email', (req, res) => {
res.json([])
})
app.post('/api/v2/users', (req, res) => {
const email = req.body.email
res.json({
user_id: `auth0|${email}`
})
})
app.post('/api/v2/tickets/password-change', (req, res) => {
res.json({
ticket: `https://some-url`
})
})
app.use(function(req, res, next) {
console.log('404', req.path)
res.status(404).send('error: 404 Not Found ' + req.path)
})
app.listen(3333, () => {
debug('Auth0-Mock-Server listening on port 3333!')
})
+2 -2
View File
@@ -122,8 +122,8 @@ const setup = (jwksOrigin) => {
return {
privateKey: forge.pki.privateKeyToPem(privateKey),
certDer: certDer,
thumbPrint: thumbprint.toString(),
certDer,
thumbprint: thumbprint.toString(),
exponent: bnToB64(exponent),
modulus: modulus.toString('base64')
}