Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into event
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashi1993 committed Mar 4, 2024
2 parents 506ff87 + 2a9fb39 commit 112ec76
Show file tree
Hide file tree
Showing 41 changed files with 5,002 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,25 @@
{% else %}
<RequestJWTValidation>true</RequestJWTValidation>
{% endif %}
<RegistrationRequestParams>
<SoftwareEnvironmentIdentification>
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_name is defined %}
<PropertyName>{{open_banking.dcr.registration.software_environment_identification.ssa_property_name}}</PropertyName>
{% else %}
<PropertyName>software_environment</PropertyName>
{% endif %}
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_sandbox is defined %}
<PropertyValueForSandbox>{{open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_sandbox}}</PropertyValueForSandbox>
{% else %}
<PropertyValueForSandbox>sandbox</PropertyValueForSandbox>
{% endif %}
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_production is defined %}
<PropertyValueForProduction>{{open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_production}}</PropertyValueForProduction>
{% else %}
<PropertyValueForProduction>production</PropertyValueForProduction>
{% endif %}
</SoftwareEnvironmentIdentification>
</RegistrationRequestParams>
</DCR>
<KeyManagerName>{{open_banking.keyManager.name}}</KeyManagerName>
{% if open_banking.publisher.hostname is defined %}
Expand All @@ -288,6 +307,13 @@
<Enabled>false</Enabled>
{% endif %}
</APIMAnalytics>
<ELKAnalytics>
{% if open_banking.analytics.elk is defined %}
<Enabled>{{open_banking.analytics.elk.enabled}}</Enabled>
{% else %}
<Enabled>false</Enabled>
{% endif %}
</ELKAnalytics>
<DataPublishing>
{% if open_banking.data_publishing.enable is defined %}
<Enabled>{{open_banking.data_publishing.enable}}</Enabled>
Expand Down
1 change: 0 additions & 1 deletion open-banking-accelerator/accelerators/ob-apim/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<directory>${project.basedir}/carbon-home/repository/components/lib</directory>
<excludes>
<exclude>**/jjwt-0.9.1.jar</exclude>
<exclude>**/mysql-connector-java-5.1.44.jar</exclude>
</excludes>
</fileset>
<fileset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ roles = "AISP,PISP"
api_name = "AccountandTransactionAPI"
roles = "AISP"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#============executors=========================
[[open_banking.gateway.openbanking_gateway_executors.type]]
name = "Default"
Expand Down Expand Up @@ -471,6 +477,9 @@ priority = 1000
[open_banking.apim.analytics]
enable=false

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ roles = "AISP,PISP"
api_name = "AccountandTransactionAPI"
roles = "AISP"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#============executors=========================
[[open_banking.gateway.openbanking_gateway_executors.type]]
name = "Default"
Expand Down Expand Up @@ -471,6 +477,9 @@ priority = 1000
[open_banking.apim.analytics]
enable=false

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,12 @@ roles = "AISP,PISP"
api_name = "AccountandTransactionAPI"
roles = "AISP"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#============executors=========================
[[open_banking.gateway.openbanking_gateway_executors.type]]
name = "Default"
Expand Down Expand Up @@ -475,6 +481,9 @@ priority = 1000
[open_banking.apim.analytics]
enable=false

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@
{% else %}
<FundsConfirmationAPIURL>https://localhost:8243/open-banking/{version}/cbpii/</FundsConfirmationAPIURL>
{% endif %}
{% if open_banking.consent.vrp_consent_self_link is defined %}
<VRPAPIURL>{{open_banking.consent.vrp_consent_self_link}}</VRPAPIURL>
{% else %}
<VRPAPIURL>https://localhost:8243/open-banking/{version}/vrp/</VRPAPIURL>
{% endif %}
<DataRetention>
{% if open_banking.consent.data_retention.enabled is defined %}
<Enabled>{{open_banking.consent.data_retention.enabled}}</Enabled>
Expand Down Expand Up @@ -468,6 +473,23 @@
<RegistrationClientURI>https://localhost:8243/open-banking/0.1/register/</RegistrationClientURI>
{% endif %}
<RegistrationRequestParams>
<SoftwareEnvironmentIdentification>
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_name is defined %}
<PropertyName>{{open_banking.dcr.registration.software_environment_identification.ssa_property_name}}</PropertyName>
{% else %}
<PropertyName>software_environment</PropertyName>
{% endif %}
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_sandbox is defined %}
<PropertyValueForSandbox>{{open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_sandbox}}</PropertyValueForSandbox>
{% else %}
<PropertyValueForSandbox>sandbox</PropertyValueForSandbox>
{% endif %}
{% if open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_production is defined %}
<PropertyValueForProduction>{{open_banking.dcr.registration.software_environment_identification.ssa_property_value_for_production}}</PropertyValueForProduction>
{% else %}
<PropertyValueForProduction>production</PropertyValueForProduction>
{% endif %}
</SoftwareEnvironmentIdentification>
<GrantTypes>
{% if open_banking.dcr.registration.grant_types.required is defined %}
<Required>{{open_banking.dcr.registration.grant_types.required}}</Required>
Expand Down Expand Up @@ -782,6 +804,13 @@
<IdpStep>{{open_banking.sca.idp.step}}</IdpStep>
{% endif %}
</SCA>
<ELKAnalytics>
{% if open_banking.analytics.elk is defined %}
<Enabled>{{open_banking.analytics.elk.enabled}}</Enabled>
{% else %}
<Enabled>false</Enabled>
{% endif %}
</ELKAnalytics>
<DataPublishing>
{% if open_banking.data_publishing.enable is defined %}
<Enabled>{{open_banking.data_publishing.enable}}</Enabled>
Expand Down
1 change: 0 additions & 1 deletion open-banking-accelerator/accelerators/ob-is/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
<directory>${project.basedir}/carbon-home/repository/components/lib</directory>
<excludes>
<exclude>**/commons-beanutils-1.9.4.jar</exclude>
<exclude>**/mysql-connector-java-5.1.44.jar</exclude>
<exclude>**/hibernate-validator-6.0.20.Final.jar</exclude>
<exclude>**/validation-api-2.0.1.Final.jar</exclude>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ read_timeout = 3000
[[open_banking.dcr.regulatory_issuers.iss]]
name = "OpenBanking Ltd"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#Signature algorithm types that are allowed
#[[open_banking.signature_validation.allowed_algorithms]]
#name = "PS256"
Expand All @@ -430,6 +436,9 @@ name = "OpenBanking Ltd"
#required = false
#allowed_values = ["web"]

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ read_timeout = 3000
[[open_banking.dcr.regulatory_issuers.iss]]
name = "OpenBanking Ltd"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#Signature algorithm types that are allowed
#[[open_banking.signature_validation.allowed_algorithms]]
#name = "PS256"
Expand All @@ -430,6 +436,9 @@ name = "OpenBanking Ltd"
#required = false
#allowed_values = ["web"]

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ read_timeout = 3000
[[open_banking.dcr.regulatory_issuers.iss]]
name = "OpenBanking Ltd"

[open_banking.dcr.registration.software_environment_identification]
ssa_property_name = "software_environment"
# If both below values doesnt match, Then software_environment is default to production.
ssa_property_value_for_sandbox = "sandbox"
ssa_property_value_for_production = "production"

#Signature algorithm types that are allowed
#[[open_banking.signature_validation.allowed_algorithms]]
#name = "PS256"
Expand All @@ -430,6 +436,9 @@ name = "OpenBanking Ltd"
#required = false
#allowed_values = ["web"]

[open_banking.analytics.elk]
enabled = false

[open_banking.data_publishing]
enable = false
username="$ref{super_admin.username}@carbon.super"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,40 @@ public String getRealtimeEventNotificationRequestGenerator() {
: (String) getConfigElementFromKey(OpenBankingConstants.REALTIME_EVENT_NOTIFICATION_REQUEST_GENERATOR);
}

/**
* Method to get software environment identification SSA property name.
*
* @return String software environment identification SSA property name.
*/
public String getSoftwareEnvIdentificationSSAPropertyName() {
return getConfigElementFromKey(OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_PROPERTY_NAME) == null ?
OpenBankingConstants.SOFTWARE_ENVIRONMENT : (String) getConfigElementFromKey(
OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_PROPERTY_NAME);
}

/**
* Method to get software environment identification value for sandbox in SSA.
*
* @return String software environment identification value for sandbox.
*/
public String getSoftwareEnvIdentificationSSAPropertyValueForSandbox() {
return getConfigElementFromKey(OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_SANDBOX) == null ?
"sandbox" : (String) getConfigElementFromKey(
OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_SANDBOX);
}

/**
* Method to get software environment identification value for production in SSA.
*
* @return String software environment identification value for production.
*/
public String getSoftwareEnvIdentificationSSAPropertyValueForProduction() {
return getConfigElementFromKey(
OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_PRODUCTION) == null ?
"production" : (String) getConfigElementFromKey(
OpenBankingConstants.DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_PRODUCTION);
}

/**
* Get config related for checking whether PSU is a federated user or not.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public class OpenBankingConstants {
public static final String DCR_JWKS_NAME = "DCR.JWKSEndpointName";
public static final String DCR_APPLICATION_NAME_KEY = "DCR.ApplicationName";
public static final String OB_KM_NAME = "KeyManagerName";
public static final String DCR_SOFTWARE_ENV_IDENTIFICATION_PROPERTY_NAME =
"DCR.RegistrationRequestParams.SoftwareEnvironmentIdentification.PropertyName";
public static final String DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_SANDBOX =
"DCR.RegistrationRequestParams.SoftwareEnvironmentIdentification.PropertyValueForSandbox";
public static final String DCR_SOFTWARE_ENV_IDENTIFICATION_VALUE_FOR_PRODUCTION =
"DCR.RegistrationRequestParams.SoftwareEnvironmentIdentification.PropertyValueForProduction";

public static final String APIM_APPCREATION = "DCR.APIMRESTEndPoints.AppCreation";
public static final String APIM_KEYGENERATION = "DCR.APIMRESTEndPoints.KeyGeneration";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package com.wso2.openbanking.accelerator.common.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wso2.openbanking.accelerator.common.exception.OpenBankingException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Map;

/**
* Open Banking common utility class to publish analytics logs.
*/
public class AnalyticsLogsUtils {

private static final Log log = LogFactory.getLog(AnalyticsLogsUtils.class);
private static final String LOG_FORMAT = "Data Stream : %s , Data Stream Version : %s , Data : {\"payload\":%s}";
private static final String DATA_PROCESSING_ERROR = "Error occurred while processing the analytics dataset";

/**
* Method to add analytics logs to the OB analytics log file.
*
* @param logFile Name of the logger which is used to log analytics data to the log file
* @param dataStream Name of the data stream to which the data belongs
* @param dataVersion Version of the data stream to which the data belongs
* @param analyticsData Data which belongs to the given data stream that needs to be logged via the given logger
*/
public static void addAnalyticsLogs(String logFile, String dataStream, String dataVersion, Map<String,
Object> analyticsData) throws OpenBankingException {
Log customLog = LogFactory.getLog(logFile);
try {
customLog.info(String.format(LOG_FORMAT, dataStream,
dataVersion, new ObjectMapper().writeValueAsString(analyticsData)));
} catch (JsonProcessingException e) {
log.error(DATA_PROCESSING_ERROR);
throw new OpenBankingException(DATA_PROCESSING_ERROR, e);
}
}

}
Loading

0 comments on commit 112ec76

Please sign in to comment.