I need to change route options from auth plugin:
example route
hapiServer.route({
method: 'GET',
path: '/users',
handler: this.handler.getUsersForLoggedInUserCompany.bind(this.handler),
options: {
auth: auth.setAuth(hapiServer, {
scopes: ['Internal', 'User'],
roles: ['userRole'],
}),
response: {
failAction: 'error',
status: {
200: AccountSchemas.responseUsers,
},
},
},
});
In auth.setAuth
I have options based on it and some manipulations to hide sensitive values I have to put in
auth: auth.setAuth(hapiServer, { scopes: ['Internal', 'User'], roles: ['Rsa.Default'] }),
plugins: {
'hapi-swagger': {
'x-vi-visibility': 'external',
'x-vi-permission': {
scopes: ['Internal', 'User'],
roles: ['Rsa.Default'],
},
},
},
Is it possible? I tried in auth plugin
// server.ext('onPostStart', () => {
// server.table().forEach((route) => {
// // @ts-ignore
// route.settings.plugins['hapi-swagger'] = {
// // @ts-ignore
// ...route.settings.plugins['hapi-swagger'],
// 'x-vi-visibility': isViVisibility(route.settings.auth || {}),
// 'x-vi-permission': viPermisions(route.settings.auth || {}),
// };
// });
// });
but i can not get information about route in normal way and these values are not passing when I call for /openapi.json
route