-
Notifications
You must be signed in to change notification settings - Fork 33
/
security.js
28 lines (23 loc) · 911 Bytes
/
security.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// implementation of the security schemes in the openapi specification
export class Security {
async initialize(schemes) {
// schemes will contain securitySchemes as found in the openapi specification
console.log("Initialize:", JSON.stringify(schemes));
}
// Security scheme: petstore_auth
// Type: oauth2
async petstore_auth(req, reply, params) {
console.log("petstore_auth: Authenticating request");
// If validation fails: throw new Error('Could not authenticate request')
// Else, simply return.
// The request object can also be mutated here (e.g. to set 'req.user')
}
// Security scheme: api_key
// Type: apiKey
async api_key(req, reply, params) {
console.log("api_key: Authenticating request");
// If validation fails: throw new Error('Could not authenticate request')
// Else, simply return.
// The request object can also be mutated here (e.g. to set 'req.user')
}
}