Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update igw-dev branch with latest IGW release #715

Open
wants to merge 94 commits into
base: igw-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
a7ef9fd
fixes for INTGW-923
Jan 28, 2020
f20e58a
INTGW-970 : Changes from 4-0-1-dev
SkNuwanTissera Mar 10, 2020
a0de232
INTGW-935 Admin portal integration and re-branding
sahantelco Mar 25, 2020
8385ae9
[INTGW-1011] - Newly added application tiers not available in OLD App…
Pradeep119 Mar 26, 2020
f39f2cb
[INTGW-1011] - Newly added application tiers not available in OLD App…
Pradeep119 Mar 26, 2020
8680b07
[INTGW-1011] - Newly added application tiers not available in OLD App…
Pradeep119 Mar 27, 2020
6d9057b
email notifications for application creation implemented. INTGW-998
chathurabuddi Mar 31, 2020
8784af6
Missing DDL for app-store added to the dep_db. INTGW-1031
chathurabuddi Apr 6, 2020
1e2a97d
email notifications for application approval implemented. INTGW-998
chathurabuddi Mar 31, 2020
a15349f
INTGW-916 Adding new entries to manage module permission(Edit App tie…
sahantelco Apr 8, 2020
d659eb2
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
6fabff3
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
f2ae131
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
a4d8457
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
42e3736
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
7523158
INTGW-960 : Incorrect message is showing when creating new user in store
SkNuwanTissera Apr 15, 2020
4265a1a
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
fa2b14d
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
9882658
INTGW-1047 : Customize admin portal for Apigate theme
SkNuwanTissera Apr 17, 2020
d4b7c20
INTGW-1048 : Hide unnecessary and irrelevant tabs and actions from ad…
SkNuwanTissera Apr 17, 2020
0794ef1
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
45ca05c
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
42e775a
INTGW-1048 : Hide unnecessary and irrelevant tabs and actions from ad…
SkNuwanTissera Apr 20, 2020
87b79f2
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
45031c1
INTGW-1027 : Inactivated Per Quota Tier in Edit application
SkNuwanTissera Apr 15, 2020
dd0c63b
INTGW-960 : Incorrect message is showing when creating new user in store
SkNuwanTissera Apr 22, 2020
6ece3a8
INTGW-1055 : [410][Adv. Throttling] - Required Logs on application Ap…
SkNuwanTissera Apr 28, 2020
176664a
INTGW-1055 : [410][Adv. Throttling] - Required Logs on subscription A…
SkNuwanTissera Apr 28, 2020
8ed85f5
INTGW-1055 : [410][Adv. Throttling] - New Logs on subscription Approval
SkNuwanTissera Apr 28, 2020
79cefac
updated core.version
cjpannila May 5, 2020
6c37769
INTGW-1048 : Breadcrumb hide menu header
SkNuwanTissera May 6, 2020
8d71999
Amdox IGW initial commit
dumidus Jul 9, 2020
69133aa
Custom validation DB changes
dumidus Jul 23, 2020
63cd4c0
Revert "Custom validation DB changes"
priyankahdp Jul 23, 2020
f27a970
super token conf file added. Ref INTGW-1110
chathurabuddi Jul 31, 2020
e63f47a
[INTGW-1116] Publisher create initial page setup for swagger-gen
GNS Jul 29, 2020
56a4a27
Swagger gen App updates
GNS Aug 4, 2020
69c5340
custom key validator added for skip subscription validation for super…
chathurabuddi Aug 5, 2020
e030836
[INTGW-1116] Publisher create initial page setup for swagger-gen
GNS Jul 29, 2020
3a98fe5
Swagger gen App updates
GNS Aug 4, 2020
826c572
minor style changes
GNS Aug 5, 2020
367e937
Swagger-gen build instructions
GNS Aug 5, 2020
76064ff
file replaced
GNS Aug 5, 2020
660763f
Environment selection added for generating the super token. Ref INTGW…
chathurabuddi Aug 10, 2020
d134079
enviroment selection added while using super token. Ref INTGW-1124
chathurabuddi Aug 11, 2020
bf6b8f5
Response Filtering DDL added. Ref INTGW-1127
chathurabuddi Aug 17, 2020
b5d0621
Recommit DB changes
dumidus Aug 19, 2020
7d1a09b
response filter mediation added as a API wise Message Mediation Polic…
chathurabuddi Aug 20, 2020
6e3a41c
swagger gen updates
GNS Aug 21, 2020
e6693a0
build updates
GNS Aug 21, 2020
9bada3d
Bug fix INTGW-1144
dumidus Sep 8, 2020
dbda578
INTGW-1173: Make custom search enabled for subscribers.
udithad Oct 12, 2020
ce6f678
Merge pull request #683 from udithad/igw-dev-410-rc3
cjpannila Oct 12, 2020
2a44fb4
json-schema-filter version upgraded. INTGW-1172
chathurabuddi Oct 14, 2020
582b967
json-schema-filter configured for detaching free-form objects. INTGW-…
chathurabuddi Oct 14, 2020
5d3c3c4
Merge pull request #687 from chathurabuddi/response-filtering
cjpannila Oct 14, 2020
7e64a42
Fix for not Updating tier-edit time / fix for updating tier of all th…
sahantelco Oct 16, 2020
eb70a18
Merge pull request #688 from sahantelco/igw-dev-410-rc3
cjpannila Oct 16, 2020
b51fe94
INTGW-1166 - added existingTier to ApplicationEditDTO and Subscriptio…
cjpannila Oct 16, 2020
80ed74d
Merge pull request #689 from cjpannila/igw-dev-410-rc3
cjpannila Oct 16, 2020
4641b44
[INTGW-1163] Sp Email notification for Tier Changes
buddhimihara Oct 16, 2020
d7af7d1
Merge pull request #690 from buddhimihara/igw-dev-410-rc3
cjpannila Oct 17, 2020
0f9de76
[INTGW-1166] Fix for tier edit logs are not available
Oct 17, 2020
66615cb
[INTGW-1166] Fix for tier edit logs are not available
Oct 17, 2020
9817102
Updated teir edit request changes
Oct 19, 2020
8011aef
[API Grouping] - When saving the API with tags, the tags should be ca…
sahantelco Oct 19, 2020
a5dea33
Merge pull request #692 from sahantelco/igw-dev-410-rc3
cjpannila Oct 19, 2020
3d22055
[INTGW-1166] Update PR requested changes
Oct 19, 2020
6037941
Merge pull request #691 from sachindakumara/igw-dev-410-rc3
cjpannila Oct 19, 2020
da514cf
fix for [INTGW-1150]
buddhimihara Oct 21, 2020
cf400e1
Fix for application-tier edit time not updating in the DB
sahantelco Oct 22, 2020
9be548d
Merge pull request #694 from buddhimihara/igw-dev-410-rc3
cjpannila Oct 22, 2020
b49ddae
[API Grouping] - the lower part of the tag list is covered by the footer
sahantelco Oct 22, 2020
2909024
Merge pull request #693 from sahantelco/igw-dev-410-rc3
cjpannila Oct 22, 2020
8a63617
audit logs added for application tier edit. INTGW-1193
chathurabuddi Oct 29, 2020
64dede4
audit logs added for subscription tier edit. INTGW-1193
chathurabuddi Oct 29, 2020
2948784
method name fixed. INTGW-1193
chathurabuddi Oct 29, 2020
1f56498
Merge pull request #698 from chathurabuddi/audit-log-sub-tier
cjpannila Oct 29, 2020
d5c472e
Merge pull request #697 from chathurabuddi/audit-log-app-tier
cjpannila Oct 29, 2020
c77c916
audit logs added for application approval. INTGW-1199
chathurabuddi Nov 2, 2020
67c766c
Merge pull request #703 from chathurabuddi/audit-log-app-approve
cjpannila Nov 3, 2020
e1f0b3f
audit logs added for subscription approval. INTGW-1195
chathurabuddi Nov 4, 2020
3c0f37d
Merge pull request #704 from chathurabuddi/audit-log-sub-approve
cjpannila Nov 4, 2020
1ea21f2
audit logs improvements for application approval. INTGW-1199
chathurabuddi Nov 4, 2020
618578d
audit logs improvements for subscription approval. INTGW-1195
chathurabuddi Nov 4, 2020
d87412f
Merge pull request #707 from chathurabuddi/app-approval-audit-log
cjpannila Nov 5, 2020
50ce6cf
Merge pull request #708 from chathurabuddi/sub-audit-impr
cjpannila Nov 5, 2020
4fbc1e3
release preparation
chathurabuddi Nov 10, 2020
0b08b6c
Merge pull request #712 from chathurabuddi/release-prep
udithad Nov 10, 2020
8d4ed41
Pre release changes
udithad Nov 10, 2020
8da3dbc
[maven-release-plugin] prepare release v3_0_3
udithad Nov 10, 2020
7c8d5a2
[maven-release-plugin] prepare for next development iteration
udithad Nov 10, 2020
8f55974
versions fixed in next development iteration
chathurabuddi Nov 16, 2020
7fbab2d
Merge pull request #714 from chathurabuddi/version-fix
cjpannila Nov 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ target
*pom.xml.next
*pom.xml.tag
*release.properties
*.DS_STORE
*.DS_STORE

dependency-reduced-pom.xml
2 changes: 1 addition & 1 deletion components/api-invocation-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/apim-loghandler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/billing/billing-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.4-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/billing/billing-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.4-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
102 changes: 102 additions & 0 deletions components/ipvalidate-handler/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
<version>3.0.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>ipvalidate-handler</artifactId>
<packaging>bundle</packaging>
<name>ipvalidate-handler</name>
<version>3.0.4-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.synapse</groupId>
<artifactId>synapse-core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.gateway</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.gateway</artifactId>
</dependency>
<dependency>
<groupId>com.wso2telco.core</groupId>
<artifactId>dbutils</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.0.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.2</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.3.5</version>
<configuration>
<obrRepository>NONE</obrRepository>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
com.wso2telco.dep.ipvalidate.handler.*
</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<Embed-Dependency>
scribe;scope=compile|runtime;inline=false;
</Embed-Dependency>
<DynamicImport-Package>*</DynamicImport-Package>
<Carbon-Component>UIBundle</Carbon-Component>

</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package com.wso2telco.dep.ipvalidate.handler;

import java.util.Map;

import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHeaders;
import org.apache.synapse.Mediator;
import org.apache.synapse.MessageContext;
import org.apache.synapse.SynapseConstants;
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.apache.synapse.transport.passthru.PassThroughConstants;
import org.apache.synapse.transport.passthru.util.RelayUtils;
import org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler;
import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityConstants;
import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException;

import com.wso2telco.dep.ipvalidate.handler.validation.ClientValidator;
import com.wso2telco.dep.ipvalidate.handler.validation.configuration.IPValidationProperties;
import com.wso2telco.dep.ipvalidate.handler.validation.dto.RequestData;
import com.wso2telco.dep.ipvalidate.handler.validation.impl.ClientValidatorImpl;
import com.wso2telco.dep.ipvalidate.handler.validation.service.ValidationCacheService;

public class IPValidateHandler extends APIAuthenticationHandler {

private static final Log log = LogFactory.getLog(IPValidateHandler.class);
private ClientValidator clientvalidator = null;

public boolean handleRequest(MessageContext messageContext) {
log.debug("Request received : " + messageContext);

try {

Map headers = getTransportHeaders(messageContext);
log.debug("headers : " + headers);
RequestData requestData = new RequestData();

requestData.setClientkey(getClientKey(messageContext));
requestData.setHostip(getHostIP(headers));

if (IPValidationProperties.isCustomValidationEnabled()) {
clientvalidator = new ClientValidatorImpl();
if (clientvalidator.validateRequest(requestData)) {
ValidationCacheService validationCacheService = new ValidationCacheService();
String clientToken = validationCacheService.getTokenfromCache(requestData.getClientkey());
if (clientToken != null) {
setTokentoContext(messageContext, clientToken);
} else {
throw new APISecurityException(IPValidationProperties.getValidationFalidErrCode(),
IPValidationProperties.getValidationFalidErrMsg());
}
} else {
throw new APISecurityException(IPValidationProperties.getInvalidHostErrCode(),
IPValidationProperties.getInvalidHostErrMsg());
}
}
return super.handleRequest(messageContext);
} catch (APISecurityException e) {
log.error("Error : " + e);
handleIPValidateFailure(messageContext, e);
return false;
}
}

private Map getTransportHeaders(MessageContext messageContext) {
return (Map) ((Axis2MessageContext) messageContext).getAxis2MessageContext()
.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
}

private String getHostIP(Map headers) {
String hostIp = null;

if (headers.get(IPValidationProperties.getIpHeaderName()) != null) {
hostIp = String.valueOf(headers.get(IPValidationProperties.getIpHeaderName())).split(",")[0];
} else if (headers.get(IPValidationProperties.getHostHeaderName()) != null) {
hostIp = String.valueOf(headers.get(IPValidationProperties.getHostHeaderName())).split(":")[0];
}
return hostIp;
}

private String getClientKey(MessageContext messageContext) throws APISecurityException
{
String clientKey = null;

try
{
String urlPath = messageContext.getTo().toString().split("[?]")[1];
String keyParam = urlPath.split("=")[0];
if(keyParam.equalsIgnoreCase(IPValidationProperties.getClientKeyParamName()))
{
clientKey = urlPath.split("=")[1];
} else
{
log.error("Invalid query parameter ");
throw new APISecurityException(IPValidationProperties.getValidationFalidErrCode(),
IPValidationProperties.getValidationFalidErrMsg());
}
}
catch(Exception e)
{
log.error("Error occurred while geting client key " + e);
throw new APISecurityException(IPValidationProperties.getValidationFalidErrCode(),
IPValidationProperties.getValidationFalidErrMsg());
}
return clientKey;
}

private void handleIPValidateFailure(MessageContext messageContext, APISecurityException e) {
messageContext.setProperty(SynapseConstants.ERROR_CODE, e.getErrorCode());
messageContext.setProperty(SynapseConstants.ERROR_MESSAGE,
APISecurityConstants.getAuthenticationFailureMessage(e.getErrorCode()));
messageContext.setProperty(SynapseConstants.ERROR_EXCEPTION, e);

Mediator sequence = messageContext.getSequence(APISecurityConstants.API_AUTH_FAILURE_HANDLER);
// Invoke the custom error handler specified by the user
if (sequence != null && !sequence.mediate(messageContext)) {
// If needed user should be able to prevent the rest of the fault handling
// logic from getting executed
return;
}
// By default we send a 401 response back
org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext).
getAxis2MessageContext();
// This property need to be set to avoid sending the content in pass-through pipe (request message)
// as the response.
axis2MC.setProperty(PassThroughConstants.MESSAGE_BUILDER_INVOKED, Boolean.TRUE);
try {
RelayUtils.consumeAndDiscardMessage(axis2MC);
} catch (AxisFault axisFault) {
//In case of an error it is logged and the process is continued because we're setting a fault message in the payload.
log.error("Error occurred while consuming and discarding the message", axisFault);
}
axis2MC.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/soap+xml");
int status;
if (e.getErrorCode() == APISecurityConstants.API_AUTH_GENERAL_ERROR) {
status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
} else if (e.getErrorCode() == APISecurityConstants.API_AUTH_INCORRECT_API_RESOURCE ||
e.getErrorCode() == APISecurityConstants.API_AUTH_FORBIDDEN ||
e.getErrorCode() == APISecurityConstants.INVALID_SCOPE) {
status = HttpStatus.SC_FORBIDDEN;
} else {
status = HttpStatus.SC_UNAUTHORIZED;
Map<String, String> headers =
(Map) axis2MC.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
if (headers != null) {
headers.put(HttpHeaders.WWW_AUTHENTICATE, getAuthenticator().getChallengeString() +
", error=\"invalid token\"" +
", error_description=\"The access token expired\"");
axis2MC.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, headers);
}
}

if (messageContext.isDoingPOX() || messageContext.isDoingGET()) {
setFaultPayload(messageContext, e);
} else {
setSOAPFault(messageContext, e);
}
sendFault(messageContext, status);
}


private void setTokentoContext(MessageContext messageContext, String token) {
Map headers = getTransportHeaders(messageContext);
Axis2MessageContext axis2smc = (Axis2MessageContext) messageContext;
org.apache.axis2.context.MessageContext axis2MessageCtx = axis2smc.getAxis2MessageContext();

if (headers != null && headers instanceof Map) {
Map headersMap = (Map) headers;
headersMap.put("Authorization", "Bearer " + token);
axis2MessageCtx.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, headersMap);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.wso2telco.dep.ipvalidate.handler.validation;

import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException;

import com.wso2telco.dep.ipvalidate.handler.validation.dto.RequestData;

public interface ClientValidator {

public boolean validateRequest(RequestData requestdata) throws APISecurityException ;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.wso2telco.dep.ipvalidate.handler.validation;

import org.wso2.carbon.apimgt.gateway.handlers.security.APISecurityException;

import com.wso2telco.dep.ipvalidate.handler.validation.dto.RequestData;

public abstract class CustomValidator {

protected CustomValidator nextValidator;

public void setNextValidator(CustomValidator nextValidator) {
this.nextValidator = nextValidator;
}

public abstract boolean doValidation(RequestData requestData) throws APISecurityException;

}
Loading