WSO2IS - Disable Embedded LDAP - deployment.toml - wso2

How can I disable Embedded Ldap on Identity Server 5.10.0 version? I'm checking conf/identity/embedded-ldap.xml and enable property is true.
<EmbeddedLDAP>
<Property name="enable">true</Property>
<Property name="port">${Ports.EmbeddedLDAP.LDAPServerPort}</Property>
<Property name="instanceId">default</Property>
.....
I couldn't find how I can disable. If I overwrite this file when docker starts it came back to true.

If you have <wso2is-5.10.0-home>/repository/resources/conf/templates/repository/conf/identity/embedded-ldap.xml.j2 file and it's enable property value under <EmbeddedLDAP> is templated as {{embedded_ldap.enable}} (shown below),
<EmbeddedLDAP>
<Property name="enable">{{embedded_ldap.enable}}</Property>
<Property name="port">${Ports.EmbeddedLDAP.LDAPServerPort}</Property>
<Property name="instanceId">default</Property>
.....
</EmbeddedLDAP>
you can use the following deployment.toml config
[embedded_ldap]
enable = false
If the <wso2is-5.10.0-home>/repository/resources/conf/templates/repository/conf/identity/embedded-ldap.xml.j2 file contains the EmbeddedLDAP config's enable property value as hardcoded to "true", you can change it to false and restat the server to change the config in embedded-ldap.xml.
<EmbeddedLDAP>
<Property name="enable">true</Property>
<Property name="port">${Ports.EmbeddedLDAP.LDAPServerPort}</Property>
<Property name="instanceId">default</Property>
.....
</EmbeddedLDAP>
If you don't have <wso2is-5.10.0-home>/repository/resources/conf/templates/repository/conf/identity/embedded-ldap.xml.j2 file, the property value changes in embedded-ldap.xml won't be replaced once the server is restarted.

In WSO2 Identity Server 5.10.0 the configurations are managed by a centralized toml file which is called as deployment.toml. We can add the following configuration to the deployment.toml file which is located in <IS_HOME>/repository/conf directory.
[embedded_ldap]
enable = false

In WSO2 Identity Server 5.10.0 version the file embedded-ldap.xml.j2 doesn't come inside
wso2is-5.10.0/repository/resources/conf/templates/repository/conf/identity so I needed to copy the file from this link: embedded-ldap.xml.j2 and put inside my configuration for docker container conf/is-as-km/repository/resources/conf/templates/repository/conf/identity
docker-compose.yml
...
volumes:
- ./conf/is-as-km:/home/wso2carbon/wso2-config-volume
ports:
- "9444:9443"
...
After that I put the property in deployment.toml:
[embedded_ldap]
enable = false
And everything worked as shown in docker log:
cup-is-as-km ... NFO {org.wso2.carbon.identity.oauth.uma...} - UMA Grant component activated successfully.
cup-is-as-km ... INFO {org.wso2.carbon.ldap.server.DirectoryActivator} - Embedded LDAP is disabled.
cup-is-as-km ... INFO {org.wso2.carbon.mex.internal.Of...} - Office365Support MexServiceComponent bundle activated successfully..
Based on the last answers and comments I reached the solution ;).

Related

How to transfer multiple files to different directories at the same time

I have created a file transfer service using wso2 integration studio. This service works with a file connector. I have it working from one directory to another, however I want to change this method to work with multiple directories. Initially, I had 2 sequences and a task to do this process, namely, " "FileListenerSeq" sequence, "FileReadSeq" sequence and "FileTask" scheduled task.
I have now created 2 extra sequences and a new task to do the same process. Namely, "FileReplyListenerSeq" sequence, "FileReplyReadSeq" sequence and "ReplyTask" scheduled task.
I want these sequences to work at the same time but even after creating the new sequences and task, the micro-integrator only reads the first initial process. I tried adding the same process twice in one sequence and it works but works only after the first one is done (which makes sense)
Is there a way to do this concurrently with multiple sequences that work at the same time?
environment specs:
Integration studio : 8.1.0
wso2 micro integrator : 7.1.0
file connector : 4.0.11
process flow from directory to directory:
LOCATION 1: FOLDERA --> LOCATION 2: FOLDERB ( This is the process that was created initially and works)
LOCATION 1: FOLDERC --> LOCATION 2: FOLDERD ( This is the new process I want to work with the initial process)
Any assistance will be greatly appreciated.
FileReadSeq source code:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="FileReadSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property description="file name" expression="//file/text()" name="FILE_TO_READ" scope="default" type="STRING"/>
<log level="custom">
<property expression="$ctx:FILE_TO_READ" name="Files to read"/>
</log>
<file.read configKey="LocalFolderAConnection">
<path>{fn:concat('/OUTGOING/' , $ctx:FILE_TO_READ)}</path>
<readMode>Complete File</readMode>
<startLineNum>0</startLineNum>
<endLineNum>0</endLineNum>
<lineNum>0</lineNum>
<contentType>application/binary</contentType>
<includeResultTo>Message Body</includeResultTo>
<enableStreaming>true</enableStreaming>
<enableLock>false</enableLock>
</file.read>
<file.write configKey="LocalFolderBConnection">
<filePath>{$ctx:FILE_PATH}</filePath>
<mimeType>Automatic</mimeType>
<compress>false</compress>
<writeMode>Overwrite</writeMode>
<enableStreaming>true</enableStreaming>
<appendNewLine>false</appendNewLine>
<enableLock>false</enableLock>
<includeResultTo>Message Body</includeResultTo>
<updateLastModified>true</updateLastModified>
</file.write>
<file.read configKey="LocalFolderCConnection">
<path>{fn:concat('/Incoming/' , $ctx:FILE_TO_READ)}</path>
<readMode>Complete File</readMode>
<startLineNum>0</startLineNum>
<endLineNum>0</endLineNum>
<lineNum>0</lineNum>
<contentType>application/binary</contentType>
<includeResultTo>Message Body</includeResultTo>
<enableStreaming>true</enableStreaming>
<enableLock>false</enableLock>
</file.read>
<file.write configKey="LocalFolderDConnection">
<filePath>{$ctx:FILE_PATH}</filePath>
<mimeType>Automatic</mimeType>
<compress>false</compress>
<writeMode>Overwrite</writeMode>
<enableStreaming>true</enableStreaming>
<appendNewLine>false</appendNewLine>
<enableLock>false</enableLock>
<includeResultTo>Message Body</includeResultTo>
<updateLastModified>true</updateLastModified>
</file.write>
<filter regex="true" source="//writeResult/success/text()">
<then>
<log description="Status Log " level="custom">
<property expression="$ctx:FILE_TO_READ" name="files successfully moved"/>
</log>
</then>
<else>
<log description="Failed log">
<property name="message" value="Files failed to move"/>
</log>
</else>
</filter>
</sequence>
I think the best solution for the requirement would be to use file inbound endpoints[1]. You can create multiple inbound endpoints for each file location from where you need to process files. The inbound endpoint will be listening to the defined transport.vfs.FileURI location and the files will be processed parallelly from multiple inbound endpoints. Since the requirement is to transfer the files, you can set the transport.vfs.ActionAfterProcess parameter to MOVE and set the destination file location using the transport.vfs.MoveAfterProcess parameter.
Please refer to the documentation here[1] for more details.
[1] https://ei.docs.wso2.com/en/latest/micro-integrator/use-cases/examples/inbound_endpoint_examples/file-inbound-endpoint/

ESB WSO2 | Trying to send an email through email connector and getting "org.wso2.carbon.connector.email.send cannot be found" error

I'm trying to send an email using email connector from esb wso2 but I'm getting this error:
Invoking Target EIP Sequence org.wso2.carbon.connector.email.send paramNames : [from, to, subject, content, contentType]
[2022-07-22 10:52:14,113] ERROR {org.apache.synapse.mediators.template.InvokeMediator} - Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,121] DEBUG {org.apache.synapse.debug.SynapseDebugManager} - Mediation flow terminated for id urn:uuid:3f3f9864-bbc1-4e95-a4bf-1574196dfb8c
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.core.axis2.SynapseMessageReceiver} - Executing fault handler due to exception encountered
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.FaultHandler} - ERROR_CODE : 0
[2022-07-22 10:52:14,121] WARN {org.apache.synapse.FaultHandler} - ERROR_MESSAGE : Sequence template org.wso2.carbon.connector.email.send cannot be found
[2022-07-22 10:52:14,122] WARN {org.apache.synapse.FaultHandler} - ERROR_DETAIL : org.apache.synapse.SynapseException: Sequence template org.wso2.carbon.connector.email.send cannot be found
This is my api which I use:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api/send/email" name="api.send.email" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
<inSequence>
<property expression="json-eval($.from)" name="from" scope="default" type="STRING"/>
<property expression="json-eval($.to)" name="to" scope="default" type="STRING"/>
<property expression="json-eval($.subject)" name="subject" scope="default" type="STRING"/>
<property expression="json-eval($.content)" name="content" scope="default" type="STRING"/>
<property expression="json-eval($.contentType)" name="contentType" scope="default" type="STRING"/>
<log level="custom">
<property expression="$ctx:from" name="Log_from:"/>
<property expression="$ctx:to" name="Log_to:"/>
<property expression="$ctx:subject" name="Log_subject:"/>
<property expression="$ctx:content" name="Log_content:"/>
<property expression="$ctx:contentType" name="Log_contentType:"/>
</log>
<email.send configKey="TEST_SMTP_CONNECTION">
<from>{json-eval($.from)}</from>
<to>{json-eval($.to)}</to>
<subject>{json-eval($.subject)}</subject>
<content>{json-eval($.content)}</content>
<contentType>{json-eval($.contentType)}</contentType>
</email.send>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
I think the problem is based on the fact that I don't think I added the connector on my project in the correct way.
So, first of all I added a connector on my main project (where I have APIs, endpoints etc) - Right Click - Add or Remove Connector/Module - then I added the email connector)
Then I created a new Connector Exporter on my project (Right Click on an empty space on my Project Explorer - I named the exporter 'test' - and I think here is the problem:
What Group ID, Parent Group ID and Parent Artifact ID I should choose? (same question when I'm making Composite Application for connector)
LATER EDIT*:
When I'm deploying de car. app for the email connector I'm getting these errors:
Error in instantiating class : org.wso2.carbon.connector.operations.list.EmailGetAttachment java.lang.NoClassDefFoundError: org/wso2/carbon/connector/core/exception/ContentBuilderException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
Unable to update status for : {org.wso2.carbon.connector}email :: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment org.apache.synapse.deployers.SynapseArtifactDeploymentException: Template configuration : null cannot be builtfor Synapse Library artifact : getEmailAttachment
To answer your questions, if you have a Maven MultiModule Project you can get the details of the parent project from the pom.xml of the parent project.(This is the root pom.xml typically)
The easiest way to resolve your problem is to create your project from an existing template which will make sure projects are created correctly. Inorder to do that, follow the steps below.
Open Integration Studio and Go to Help -> Getting Started.
Then select the Email Service sample project, give it a name and create the project.
Now you should have a full working project with a Connector Exported.
In the future for creating new projects, you can refer to this document.

getting an exception on running sample of wso2cep

I am a beginner in wso2cep. I want to execute the first sample of WSO2 CEP documentation. I use windows10 as operating system. I type the following command but i getting following exeption in Console output:
c:\wso2cep-4.0.0\samples\producers\http>ant Durl=http://localhost:9763/endpoints/httpReceiver -Dsn=0001
Buildfile: c:\wso2cep-4.0.0\samples\producers\http\build.xml
init:
compile:
[javac] c:\wso2cep-4.0.0\samples\producers\http\build.xml:71: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to
false
for repeatable builds
[copy] Copying 1 file to c:\wso2cep-4.0.0\samples\producers\http\temp\classes
run:
[echo] Configure -Durl=xxxx and ( -DfilePath=xxxx or -Dsn='sample number')
optionally use -Dusername=xxxx -Dpassword=xxxx
[java] [main] INFO org.wso2.carbon.sample.http.Http - Starting WSO2 Http
Client
[java] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:4
[java] at org.wso2.carbon.sample.http.Http.main(Unknown Source)
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 3 seconds
I add this line: <property name="filePath" value=""""/> to the build.xml file but I still get above exception. My build.xml file become as following:
<property name="carbon.home" value="${basedir}"/>
<property name="lib" value="${carbon.home}/repository/lib"/>
<property name="tempdir" value="${carbon.home}/tmp/setup"/>
<property name="output.dir" value="${carbon.home}/tmp/wso2"/>
<property name="filePath" value=""""/>
Should i change "filePath" to another thing? Should i add this line to build.xml file or change other lines? Please help and explain to me.

Dynamically replace the PATH value of an Endpoint (WSO2 - API Manager)

I have created an API in the WSO2 API Manager (1.10.0) with the next info:
POST:
/regularPath/*
API URL:
http://<ip-address-1>/t/tenant.com/api/1.0.0/
HTTP-Endpoint:
http://<ip-address-2>:8181/{uri.var.newRestVar}
The issue is that the HTTP Endpoint has more than one path, e.g.:
http://<ip-address-2>:8181/mainService/cityInfo
http://<ip-address-2>:8181/country/cityInfo
http://<ip-address-2>:8181/country/dataKey/amountOfUsers
http://<ip-address-2>:8181/main/city/data/users
And I want that the resulting API URLs look like this:
http://<ip-address-1>/t/tenant.com/api/1.0.0/regularPath/mainService/cityInfo
http://<ip-address-1>/t/tenant.com/api/1.0.0/regularPath/country/cityInfo
http://<ip-address-1>/t/tenant.com/api/1.0.0/regularPath/country/dataKey/amountOfUsers
http://<ip-address-1>/t/tenant.com/api/1.0.0/regularPath/main/city/data/users
My initial approach was to use the REST_URL_PREFIX variable in order to capture the path after the 1.0.0 part of the API URL (e.g.: regularPath/country/dataKey/amountOfUsers) and then, assign that value to the uri.var.newRestVar variable.
Next, is the modified Service Bus Configuration of the API Manager (Carbon) I've created in the API Manager:
...
<inSequence>
<filter regex="PRODUCTION" source="$ctx:AM_KEY_TYPE">
<then>
<property expression="get-property('SYSTEM_TIME')" name="api.ut.backendRequestTime"/>
<log>
<property expression="$trp:To" name="ToURL"/>
</log>
<property expression="$axis2:REST_URL_POSTFIX" name="restURL" scope="default" type="STRING"/>
<log>
<property
expression="get-property('restURL')" name="logRestURL"/>
</log>
<script description="JS" language="js">
<![CDATA[
var unmodifiedRestPostfix = new String(mc.getProperty("restURL"));
print("value = " + unmodifiedRestPostfix);
unmodifiedRestPostfix = unmodifiedRestPostfix.replace("/regularPath/", "");
mc.setProperty("uri.var.newRestVar", unmodifiedRestPostfix);
]]>
</script>
<log>
<property expression="get-property('uri.var.newRestVar')" name="URI_VAR_NEWRESTVAR"/>
</log>
<send>
<endpoint name="admin-AT-tenant.com--API-Main_APIproductionEndpoint_0">
<http uri-template="http://<ip-address-2>:8181/{uri.var.newRestVar}"/>
</endpoint>
</send>
...
But it does not work. I checked the logs but everything seems to be OK:
TID: [35] [] [2016-04-11 16:47:01,955] #bank.com [35] [AM] INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: local://axis2services/api/1.0.0/regularPath/mainService/cityInfo, MessageID: urn:uuid:091613ce-9fd3-4094-8638-5b112
a4214ad, Direction: request, logRestURL = /regularPath/mainService/cityInfo {org.apache.synapse.mediators.builtin.LogMediator}
a4214ad, Direction: request, URI_VAR_NEWRESTVAR = /regularPath/mainService/cityInfo {org.apache.synapse.mediators.builtin.LogMediator}
What configuration should I change in order to successfully access the HTTP-Endpoint using the paths of the API I've mentioned?
You can do the same thing without modifying the synapse configuration. Following are the steps. Hope it would be a solution for you
Create the api as following
API context : api/{version}/regularPath
Note: you can define the version in the context as a template in AM 1.10. once you define the version, above context will get the version
resources:
POST mainService/cityInfo
POST country/cityInfo
POST country/dataKey/amountOfUsers
POST main/city/data/users
HTTP Endpoint
http://<ip-address-2>:8181
After that you would be able to call a backend . No need to add custom modifications to synapse config
http://<ip-address-2>:8181/country/dataKey/amountOfUsers
with
http://<ip-address-1>/t/tenant.com/api/1.0.0/regularPath/country/dataKey/amountOfUsers
Additional information
If something went wrong, you can enable the wire logs and check what kind of request coming and going out in the gateway. see http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html on how to enable wirelogs and debug using it.

How to pick service name in WSO2 using Log Mediator

I am using WSO2 ESB 4.8.1. When i use log mediator, i want it to also log the proxy service name in which log mediator is being used. Is there any property defined in wso2 that i can use?
Problem:
In the following log mediator I am using "Server_IP" and "Server_HOST" property to pick up the Server IP and Server Host name. So is there any property from which i can pick up the service name.
Log Mediaator:
<log level="full" separator="LogMediator" description="LoggerTemplate">
<property name="ServerIP" expression="get-property('SERVER_IP')"/>
<property name="ServerHost" expression="get-property('SERVER_HOST')"/>
</log>
Yes. Use the $ctx:proxy.name expression for your property mediator:
<log level="custom">
<property name="proxyName" expression="$ctx:proxy.name"/>
</log>
Output:
[2015-02-06 06:24:07,161] INFO - LogMediator proxyName = vfsTest