// file: approov-protected-server.js

// Intercepts all calls to the shapes endpoint to validate the Approov token.
app.use('/shapes', checkApproovToken)

// Handles failure in validating the Approov token
app.use('/shapes', handlesApproovTokenError)

// Handles requests where the Approov token is a valid one.
app.use('/shapes', handlesApproovTokenSuccess)

// Intercepts all calls to the forms endpoint to validate the Approov token.
app.use('/forms', checkApproovToken)

// Handles failure in validating the Approov token
app.use('/forms', handlesApproovTokenError)

// Handles requests where the Approov token is a valid one.
app.use('/forms', handlesApproovTokenSuccess)

// checks if the custom payload claim is present in the Approov token and
// matches the claim used by the mobile app, that in this case we decided to be
// the ouath2 token, but you may want to use another type of claim.
app.use('/forms', checkApproovTokenCustomPayloadClaim)