tools/oas-configurable-proxy/index.js
/**
 * Translate OAS security object to an apigee consumer authorization
 *
 * @param {any} security
 * @param {any} components
 * @return {any} apigee consumer authorization
 */
Translate OAS security object to an apigee consumer authorization
@param {any} security
@param {any} components
@return {any} apigee consumer authorization
Translate OAS security object to an apigee consumer authorization @param { any } security @param { any } components @return { any } apigee consumer authorization
function translateOasSecurity(security, components) {
    consumerAuthorization = { enabled: false, locations: [] };
    (security || []).forEach(securityObject => {
        Object.keys(securityObject).forEach(securityObjectKey => {
            if (components && components.securitySchemes && components.securitySchemes[securityObjectKey]) {
                const securityScheme = components.securitySchemes[securityObjectKey]
                if (securityScheme.type.toLowerCase() === "apikey") {
                    consumerAuthorization.enabled = true
                    consumerAuthorization.locations.push({ in: securityScheme.in, name: securityScheme.name});
                }
            }
        });
    });
    return consumerAuthorization
}
function translateOasSecurity ( security , components ) { consumerAuthorization = { enabled : false , locations : [ ] } ; ( security || [ ] ) . forEach ( securityObject => { Object . keys ( securityObject ) . forEach ( securityObjectKey => { if ( components && components . securitySchemes && components . securitySchemes [ securityObjectKey ] ) { const securityScheme = components . securitySchemes [ securityObjectKey ] if ( securityScheme . type . toLowerCase ( ) === "apikey" ) { consumerAuthorization . enabled = true consumerAuthorization . locations . push ( { in : securityScheme . in , name : securityScheme . name } ) ; } } } ) ; } ) ; return consumerAuthorization }
Translate OAS security object to an apigee consumer authorization
 @param {any} security
 @param {any} components
 @return {any} apigee consumer authorization
Translate OAS security object to an apigee consumer authorization @param { any } security @param { any } components @return { any } apigee consumer authorization