Skip to content

Commit

Permalink
Merge pull request #13497 from ashera96/master
Browse files Browse the repository at this point in the history
Attaching OAuthResponseMediator to Production and Sandbox Endpoints
  • Loading branch information
ashera96 authored Jun 9, 2024
2 parents f9e0982 + b9488e9 commit 6857ea7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions modules/distribution/resources/api_templates/velocity_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -346,8 +348,19 @@ $out_sequences.get("$resource.getUriTemplate()").get($uri)
#if( $responseCacheEnabled )
<cache scope="per-host" collector="true"/>
#end
#if( $endpointsecurity.type == "oauth" || $endpointsecurity.type == "OAUTH" )
<class name="org.wso2.carbon.apimgt.gateway.mediators.oauth.OAuthResponseMediator"/>
#if( $apiIsOauthProtected || $apiIsApiKeyProtected || $apiIsBasicAuthProtected )
<filter source="$ctx:AM_KEY_TYPE" regex="$filterRegex">
<then>
#if($endpointSecurityProd.clientId && ($endpointSecurityProd.type == "oauth" || $endpointSecurityProd.type == "OAUTH"))
<class name="org.wso2.carbon.apimgt.gateway.mediators.oauth.OAuthResponseMediator"/>
#end
</then>
<else>
#if($endpointSecuritySand.clientId && ($endpointSecuritySand.type == "oauth" || $endpointSecuritySand.type == "OAUTH"))
<class name="org.wso2.carbon.apimgt.gateway.mediators.oauth.OAuthResponseMediator"/>
#end
</else>
</filter>
#end
<send/>
</outSequence>
Expand Down

0 comments on commit 6857ea7

Please sign in to comment.