From feb7ac36baa9112dc54457e69f199f7b6cd5b13a Mon Sep 17 00:00:00 2001 From: shnrndk Date: Tue, 3 Oct 2023 09:31:56 +0530 Subject: [PATCH] Attaching OAuthResponse Mediator to Production and Sandbox Endpoints. --- .../api_templates/velocity_template.xml | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/distribution/resources/api_templates/velocity_template.xml b/modules/distribution/resources/api_templates/velocity_template.xml index 4732d712ef..715e482c8f 100644 --- a/modules/distribution/resources/api_templates/velocity_template.xml +++ b/modules/distribution/resources/api_templates/velocity_template.xml @@ -31,6 +31,8 @@ #set( $endpointClass = $endpoint_config.get("endpoint_type") ) #set( $endpoints = $endpoint_config.get("${type}_endpoints")) #set( $ep_key = "${endpointKey}_API${type}Endpoint") + #set( $endpointSecurityProd = $endpoint_security.get("production")) + #set( $endpointSecuritySand = $endpoint_security.get("sandbox")) #set( $endpointsecurity = $endpoint_security.get("${type}")) ## IF endpoint secured #if($endpointsecurity.enabled) @@ -346,9 +348,26 @@ $out_sequences.get("$resource.getUriTemplate()").get($uri) #if( $responseCacheEnabled ) #end - #if( $endpointsecurity.type == "oauth" || $endpointsecurity.type == "OAUTH" ) - - #end + #if($apiStatus != 'PROTOTYPED' && ($apiIsOauthProtected || $apiIsApiKeyProtected || $apiIsBasicAuthProtected)) + + + #end + #if($endpointSecurityProd.clientId) + #set( $endpointSecurityProd = $endpoint_security.get("${type}")) + #if($endpointSecurityProd.type == "oauth" || $endpointSecurityProd.type == "OAUTH") + + #end + #end + + + #if($endpointSecuritySand.clientId) + #set( $endpointSecuritySand = $endpoint_security.get("${type}")) + #if($endpointSecuritySand.type == "oauth" || $endpointSecuritySand.type == "OAUTH") + + #end + #end + +