[Dev] JAX-RS Enpoints are not exposed with Java Security Manager Enabled

2016-12-06 Thread Nisala Nanayakkara
Hi all,

I am trying to deploy a web app which contains some classes in the
web-inf/classes directory in AS 5.3.0. The classes inside the
web-inf/classes directory are used to expose several jaxrs endpoints. But
when I enabled the java security manager, those enpoints are not working
(404 Not found). I checked whether there are any back-end errors. But I was
unable to find any. Then I tried enabling the security logs by following
this article [1]. But I could not find any useful information in that also.
When I disabled the java security manager, it is working as expected. Then
I tried to pack the classes inside the web-inf/classes dir into a jar and
put it in the web-inf/lib directory. After doing that change, it is working
as expected. I have attached the sec.policy file here. Please be kind
enough to provide your kind input regarding this.

[1] -
http://isuru-perera.blogspot.com/2014/12/enabling-java-security-manager-for-wso2.html

Thanks,
Nisala

-- 
*Nisala Niroshana Nanayakkara,*
Software Engineer
Mobile:(+94)717600022
WSO2 Inc., http://wso2.com/


sec.policy
Description: Binary data
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [C5] MSF4J Interceptors need to be configurable.

2016-12-06 Thread Thusitha Thilina Dayaratne
Hi Ishara,

As you have mentioned, with the current architecture we can't set the
specific interceptor for a particular service but rather to all services in
the registry. And also if there are multiple interceptors and one
interceptor returns false from its' preCaall then the invocation chain will
not continue further.

IMHO we have few options

   - We can implement a way to register specific interceptors to specific
   services
   - We can support JAX-RS Filters
   - We can provide a way to skip some interceptors for specific services

@Azeez WDYT?

Thanks
Thusitha


On Wed, Dec 7, 2016 at 10:56 AM, Ishara Cooray  wrote:

> HI,
>
> We are using MSF4J interceptor for securing REST APIs in API Manager. [1]
> As for now Interceptor registration happens at the class level @Component
> annotation as below.
>
> @Component(
> name = "org.wso2.carbon.apimgt.rest.api.common.interceptors.
> OAUTH2SecurityInterceptor",
> service = Interceptor.class,
> immediate = true
> )
> The limitations here are
>
>1. it is not possible to have more than one interceptor that will
>dynamically pick when an api call is received(Because the order matters and
>we are not certain which interceptor will take into effect ).
>2. We cannot explicitly configure to use Custom interceptors because
>of the above[1] reason.
>
> Do we have any plans for these limitations?
>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog  alokayasoya.blogspot.com
Abouthttp://about.me/thusithathilina

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [C5] MSF4J Interceptors need to be configurable.

2016-12-06 Thread Ishara Cooray
HI,

We are using MSF4J interceptor for securing REST APIs in API Manager. [1]
As for now Interceptor registration happens at the class level @Component
annotation as below.

@Component(
name =
"org.wso2.carbon.apimgt.rest.api.common.interceptors.OAUTH2SecurityInterceptor",
service = Interceptor.class,
immediate = true
)
The limitations here are

   1. it is not possible to have more than one interceptor that will
   dynamically pick when an api call is received(Because the order matters and
   we are not certain which interceptor will take into effect ).
   2. We cannot explicitly configure to use Custom interceptors because of
   the above[1] reason.

Do we have any plans for these limitations?

Thanks & Regards,
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [C5] [carbon-datasources] Expose carbon datasource services to non-OSGi environment using Java SPI

2016-12-06 Thread Gokul Balakrishnan
Hi Thanuja,

+1 for this approach. For the analytics use case especially, the
requirement is for the datasources component to fully work in a non-carbon,
non-OSGi environment; hence our request to have the relevant services
exposed via SPI.

We are not using JNDI to look up datasources at the moment, and
consequently that functionality is not critical to us at the moment. What's
important is the ability for us to specify an absolute path (from the
non-carbon JVM) the location of datasource definitions, and then for the
datasources component to natively read and expose the datasource from
within this JVM.

On a related note, I believe that the secure vault component will also need
to go through the same treatment.

Thanks.

On 5 December 2016 at 15:01, Thanuja Uruththirakodeeswaran <
thanu...@wso2.com> wrote:

> Hi All,
>
> I'm currently working on $subject. The carbon datasource component
> registers the JNDIContextManager and DataSourceReader services before
> initializing datsources using DataSourceManager in an OSGi environment as
> in [1]. In order to make the carbon datasource component to be used in
> non-OSGi environment as well, the same services have to be made available
> using Java SPI before the non-OSGi client makes use of it.
>
>
>- In the existing implementation the DataSourceReader service can be
>loaded to non-OSGi environment when initializing datasources using
>DataSourceManager's initDataSources()[2] which calls
>loadDataSourceProviders()[3] to load the Service Providers of
>DataSourceReader SPI.
>
>
>
>- In order to register JNDIContextManager service in non-OSGi
>environment, the carbon-jndi component implementation has to be modified.
>I'm planning to a have separate service provider for JNDIContextManager SPI
>so that it can be used in non-OSGi environment like we are using the
>JNDIContextManagerImpl[4] for OSGi environment. Then the particular service
>provider can be loaded using ServiceLoader and used to do datasource lookup
>using  the Context in non-OSGi environment. Is this the correct approach to
>acces JNDI service in non-OSGi environment? Please give your suggestions.
>
> [1]. https://github.com/wso2/carbon-datasources/blob/master/
> components/org.wso2.carbon.datasource.core/src/main/java/
> org/wso2/carbon/datasource/core/internal/DataSourceListenerComponent.java
> [2]. https://github.com/wso2/carbon-datasources/blob/master/
> components/org.wso2.carbon.datasource.core/src/main/java/
> org/wso2/carbon/datasource/core/DataSourceManager.java#L107-L111
> [3]. https://github.com/wso2/carbon-datasources/blob/master/
> components/org.wso2.carbon.datasource.core/src/main/java/
> org/wso2/carbon/datasource/core/DataSourceManager.java#L177-L182
> [4]. https://github.com/wso2/carbon-jndi/blob/master/compone
> nts/org.wso2.carbon.jndi/src/main/java/org/wso2/carbon/
> jndi/internal/osgi/JNDIContextManagerImpl.java
>
> Thanks.
> --
> Thanuja Uruththirakodeeswaran
> Software Engineer
> WSO2 Inc.;http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 774363167 <+94%2077%20436%203167>
>
> 
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Gokul Balakrishnan
Senior Software Engineer,
WSO2, Inc. http://wso2.com
M +94 77 5935 789 | +44 7563 570502 <+44%207563%20570502>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] APIM C5 Analytics - Designing Event streams

2016-12-06 Thread Nuwan Dias
I think its better to merge these first and then compare with the CGI list.
I don't think we're missing many on that list.

On Tue, Dec 6, 2016 at 1:24 PM, Uvindra Dias Jayasinha 
wrote:

> Hi Rukshan,
>
> There have been requests in the past to include all available CGI
> variables[1] to give more flexibility when it comes to stats. We are
> already capturing some of these above. I dont know for sure how useful or
> relevant it might be to capture them all though.
>
> [1] http://www.cgi101.com/book/ch3/text.html
>
> On 6 December 2016 at 11:33, Rukshan Premathunga  wrote:
>
>> Hi All,
>>
>> As part of the new APIM C5 release we are start to design analytics
>> Streams. Here is the list of streams we decided to publish from APIM
>> components. Even though here we listed separate event streams we hope to
>> merge all the event streams except *org.wso2.apimgt.statistics.workflow* to
>> one event and publish. By merging these event stream we will be able to
>> avoid duplicate attributes and increase the performance at the event
>> receivers.
>>
>> So please go though these stream schema and share your ideas.
>>
>> *Stream name  :org.wso2.apimgt.statistics.request*
>>
>> *version  :2.0.0*
>>
>> api :STRING
>>
>> context  :STRING
>>
>> version  :STRING
>>
>> publisher:STRING
>>
>> subscription_policy :STRING
>>
>> resource_path:STRING
>>
>> uri_template :STRING
>>
>> consumer_key :STRING
>>
>> application_name:STRING
>>
>> application_id   :STRING
>>
>> application_owner   :STRING
>>
>> user_id  :STRING
>>
>> subscriber   :STRING
>>
>> request_count:INT
>>
>> request_time :LONG
>>
>> gateway_domain :STRING
>>
>> gateway_ip   :STRING
>>
>> is_throttled :BOOL
>>
>> throttled_reason :STRING
>>
>> throttled_policy :STRING
>>
>> client_ip:STRING
>>
>> user_agent   :STRING
>>
>> host_name:STRING
>> method   :STRING
>>
>>
>>
>> *name : org.wso2.apimgt.statistics.response*
>>
>> *version  : 2.0.0*
>>
>> consumer_key : STRING
>>
>> context  : STRING
>>
>> api  : STRING
>>
>> resource_path: STRING
>>
>> uri_template : STRING
>>
>> method   : STRING
>>
>> version  : STRING
>>
>> response_count   : INT
>>
>> username : STRING
>>
>> event_time   : LONG
>>
>> host_name: STRING
>>
>> publisher: STRING
>>
>> application_name: STRING
>>
>> application_id   : STRING
>>
>> application_owner: STRING
>>
>> user_id : STRING
>>
>> subscriber  : STRING
>>
>> cache_hit   : BOOL
>>
>> response_size: LONG
>>
>> protocol : STRING
>>
>> response_code: INT
>>
>> destination  : STRING
>>
>> gateway_domain   : STRING
>>
>> gateway_ip   : STRING
>>
>> response_time: LONG
>>
>> service_time : LONG
>>
>> backend_time : LONG
>>
>> backend_latency  : LONG
>>
>> security_latency : LONG
>>
>> throttling_latency   : LONG
>>
>> request_mediation_latency: LONG
>>
>> respons_mediation_latency: LONG
>> other_latency: LONG
>>
>>
>>
>> *name   : org.wso2.apimgt.statistics.fault*
>>
>> *version: 2.0.0*
>>
>> consumer_key : STRING
>>
>> context : STRING
>>
>> api  : STRING
>>
>> resource_path: STRING
>>
>> method   : STRING
>>
>> version  : STRING
>>
>> error_code   : STRING
>>
>> error_message: STRING
>>
>> request_time : LONG
>>
>> application_owner   : STRING
>>
>> user_id  : STRING
>>
>> subscriber   : STRING
>>
>> host_name: STRING
>>
>> publisher: STRING
>>
>> application_name: STRING
>>
>> application_id   : STRING
>>
>> protocol : STRING
>>
>> gateway_domain : STRING
>>
>> gateway_ip   : STRING
>>
>>
>>
>> *name: org.wso2.apimgt.statistics.throttle*
>>
>> *version : 2.0.0*
>>
>> api  : STRING
>>
>> context  : STRING
>>
>> publisher: STRING
>>
>> throttled_time   : LONG
>>
>> application_name: STRING
>>
>> application_id   : STRING
>>
>> application_owner   : STRING
>>
>> user_id  : STRING
>>
>> subscriber   : STRING
>>
>> throttled_reason : STRING
>>
>> throttled_policy : STRING
>>
>> gateway_domain : STRING
>>
>> gateway_ip   : STRING
>>
>>
>>
>> *name: org.wso2.apimgt.statistics.workflow*
>>
>> *version : 2.0.0*
>>
>> workflow_reference : STRING
>>
>> workflow_status  : STRING
>>
>> workflow : STRING
>>
>> created_time : LONG
>>
>> updated_time : LONG
>>
>> 

Re: [Dev] [Identity cloud]Client certification missing when requesting the REST services using the dashboard jaggery app

2016-12-06 Thread Malithi Edirisinghe
Hi Sajith,

I looked into this issue in detail with ssl debug on, with the help of
Manu.
The request to the backend service is invoked via an HttpClient instance,
picked from a client pool from jaggery [1]. When host name verification is
disabled, HttpClient is initialized with a Trust manager that accepts any
certificate, thus, at the SSL handshake, when the server presents the
certificate, client blindly trusts the server and presents client
certificate back to the server.
When hostname verification is disabled, from jaggery the default HttpClient
is used (with no custom SSL context). It's loading the default key
manager(java cacerts) and using strict hostname verification. In that case,
the self signed certificate the server provide, is not trusted. Thus, since
server authenticity fails in client side, it does not present the client
certificate.
In order to solve this we have to set the ssl context for HttpClient to
use, with key manager and trust manager loaded with the key store and trust
store of the product.

Protocol mutualSSLProtocol = new Protocol("https",
(ProtocolSocketFactory) new AuthSSLProtocolSocketFactory(new
File(ServerConfiguration.getInstance()

.getFirstProperty("Security.KeyStore.Location")).toURI().toURL(),"wso2carbon",
new File(ServerConfiguration.getInstance()

.getFirstProperty("Security.TrustStore.Location")).toURI().toURL(),"wso2carbon"),
HTTPS_DEFAULT_PORT);
Protocol.registerProtocol("https", mutualSSLProtocol);

Therefore, in order to solve this issue I see below options.

1. Support the local call by configuring CA signed certs in the nodes.

2. From the jaggery application itself, use a HttpClient with custom SSL scheme.

AFAIK, in each place where we use mutual ssl in Identity Server, we
load the context for the client with key manager and trust manager,
which I think is actually needed here as well.

[1]
https://github.com/wso2/jaggery/blob/master/components/hostobjects/org.jaggeryjs.hostobjects.xhr/src/main/java/org/jaggeryjs/hostobjects/xhr/XMLHttpRequestHostObject.java#L88
[2] http://hc.apache.org/httpclient-3.x/sslguide.html

Thanks,
Malithi.

On Tue, Nov 29, 2016 at 9:17 PM, Sajith Abeywardhana 
wrote:

> Hi All,
>
> I observe the "AuthenticationHandler not found exception"[1] when the
> dashboard jaggery app calls[2] the backend REST services over the HTTPS. By
> debugging, we found that this issue occurs only when the carbon server is
> started with the hostname verification enable mode. If the hostname
> verification is enabled the jaggery app does not send the client
> certificate along with the request. If there is no any client certification
> in the request the AuthenticationHandler reject the request and throws the
> exception[1].  When I disable the hostname verification, the jaggery app
> sends the client certificate along with the request and then the
> AuthenticationHandler will process the request.
>
> Any thoughts how to solve this issue?
>
> [1]
> TID: [-1234] [] [2016-11-29 13:05:36,332] ERROR
> {org.wso2.carbon.tomcat.ext.valves.CompositeValve} -  Could not handle
> request: /api/appm/publisher/v1.1/roles
> org.wso2.carbon.identity.auth.service.exception.AuthRuntimeException:
> AuthenticationHandler not found.
> at org.wso2.carbon.identity.auth.service.AuthenticationManager.
> authenticate(AuthenticationManager.java:101)
> at org.wso2.carbon.identity.auth.valve.AuthenticationValve.
> invoke(AuthenticationValve.java:75)
> at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(
> CompositeValve.java:99)
> at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.
> invoke(CarbonTomcatValve.java:47)
> at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(
> TenantLazyLoaderValve.java:57)
> at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(
> TomcatValveContainer.java:47)
> at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(
> CompositeValve.java:62)
> at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValv
> e.invoke(CarbonStuckThreadDetectionValve.java:159)
> at org.apache.catalina.valves.AccessLogValve.invoke(
> AccessLogValve.java:956)
> at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(
> CarbonContextCreatorValve.java:57)
> at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:116)
> at org.apache.catalina.connector.CoyoteAdapter.service(
> CoyoteAdapter.java:442)
> at org.apache.coyote.http11.AbstractHttp11Processor.process(
> AbstractHttp11Processor.java:1082)
> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.
> process(AbstractProtocol.java:623)
> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> doRun(NioEndpoint.java:1756)
> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.
> run(NioEndpoint.java:1715)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1145)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:615)

Re: [Dev] WSO2 Committers += Kanapriya Kuleswararajan

2016-12-06 Thread Biruntha Gnaneswaran
Congratulations Kanapriya

Biruntha

Associate Software Engineer
WSO2
Email : birun...@wso2.com
Linkedin : https://lk.linkedin.com/in/biruntha
Mobile : +94773718986

On Tue, Dec 6, 2016 at 3:49 PM, Yashothara Shanmugarajah <
yashoth...@wso2.com> wrote:

> Congratulations Kanapriya :)
>
> Best Regards,
> Yashothara.S
> Software Engineer
> WSO2
> http://wso2.com
> https://wso2.com/signature
> 
>
> On Tue, Dec 6, 2016 at 3:44 PM, Thanuja Uruththirakodeeswaran <
> thanu...@wso2.com> wrote:
>
>> Congratulations Kanapriya :)
>>
>> On Tue, Dec 6, 2016 at 3:22 PM, Malaka Silva  wrote:
>>
>>> Hi Devs,
>>>
>>> Its my pleasure to welcome Kanapriya Kuleswararajan as a WSO2 Committer.
>>>
>>> She has been working with the WSO2 Platform Extensions Team for a while
>>> and has contributed to  ESB and IS product extensions,
>>>
>>> Kanapriya, welcome aboard and keep up the good work.
>>>
>>> Best Regards,
>>>
>>> Malaka Silva
>>> Senior Technical Lead
>>> M: +94 777 219 791 <+94%2077%20721%209791>
>>> Tel : 94 11 214 5345
>>> Fax :94 11 2145300
>>> Skype : malaka.sampath.silva
>>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>>> Blog : http://mrmalakasilva.blogspot.com/
>>>
>>> WSO2, Inc.
>>> lean . enterprise . middleware
>>> https://wso2.com/signature
>>> http://www.wso2.com/about/team/malaka-silva/
>>> 
>>> https://store.wso2.com/store/
>>>
>>> Don't make Trees rare, we should keep them with care
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanuja Uruththirakodeeswaran
>> Software Engineer
>> WSO2 Inc.;http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 774363167 <+94%2077%20436%203167>
>>
>> 
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 IS 5.3.0-Alpha2 : Not Able to authenticate users coming from External LDAP user store

2016-12-06 Thread Danushka Fernando
My guess is that you are using default ldap config which we use wso2Person
type objects and your ldap doesn't have that type defined. So please try
changing that to inetOrgPerson in user-mgt.cml

Thanks & Regards
Danushka Fernando
Senior Software Engineer
WSO2 inc. http://wso2.com/
Mobile : +94716332729

On Tue, Dec 6, 2016 at 7:18 PM, Hanen Ben Rhouma  wrote:

> Hello,
>
> I'm facing an issue while trying to authenticate external users (coming
> from an external OpenLDAP user store) through WSO2 IS. There are missing
> claims that are required and even through I commented all what my LDAP
> doesn't provide in  claim-config.xml I'm still not able to authenticate
> users:
>
> [2016-12-06 13:32:39,159] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager}
> -  User: admin exist: true
> [2016-12-06 13:32:39,161] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  Replace escape characters configured to: true
> [2016-12-06 13:32:39,161] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  Replace escape characters configured to: true
> [2016-12-06 13:32:39,204] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  One or more attributes you are trying to add/update are not supported by
> underlying LDAP for user : admin
> javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error
> code 17 - failedLoginAttempts: attribute type undefined]; remaining name
> 'cn=admin'
> at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3205)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2888)
> at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1408)
> at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(
> ComponentDirContext.java:257)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(
> PartialCompositeDirContext.java:167)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(
> PartialCompositeDirContext.java:156)
> at org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager.
> doSetUserClaimValues(ReadWriteLDAPUserStoreManager.java:917)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> setUserClaimValues(AbstractUserStoreManager.java:1211)
> at org.wso2.carbon.identity.governance.store.
> UserStoreBasedIdentityDataStore.store(UserStoreBasedIdentityDataStor
> e.java:72)
> at org.wso2.carbon.identity.governance.listener.
> IdentityStoreEventListener.doPreSetUserClaimValues(
> IdentityStoreEventListener.java:110)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> setUserClaimValues(AbstractUserStoreManager.java:1205)
> at org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.
> handlePostAuthentication(AccountLockHandler.java:221)
> at org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.
> handleEvent(AccountLockHandler.java:141)
> at org.wso2.carbon.identity.event.services.IdentityEventServiceImpl.
> handleEvent(IdentityEventServiceImpl.java:56)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> handleEvent(IdentityMgtEventListener.java:595)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> handleEvent(IdentityMgtEventListener.java:547)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> doPostAuthenticate(IdentityMgtEventListener.java:101)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> authenticateInternal(AbstractUserStoreManager.java:558)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.access$100(
> AbstractUserStoreManager.java:71)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.
> run(AbstractUserStoreManager.java:466)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.
> run(AbstractUserStoreManager.java:463)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(
> AbstractUserStoreManager.java:463)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.
> run(AbstractUserStoreManager.java:451)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.
> run(AbstractUserStoreManager.java:442)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(
> AbstractUserStoreManager.java:442)
> at org.wso2.carbon.core.services.authentication.AuthenticationAdmin.login(
> AuthenticationAdmin.java:100)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at 

[Dev] WSO2 Identity Server 5.3.0 Beta Released !!

2016-12-06 Thread Pulasthi Mahawithana
The WSO2 Identity Server team is pleased to announce the release of WSO2
Identity Server 5.3.0 Beta. You can download this distribution from
following locations.

Runtime : https://github.com/wso2/product-is/releases/tag/v5.3.0-beta
Analytics : https://github.com/wso2/analytics-is/releases/tag/v5.3.0-beta


Following list contains all the features, improvements and bug fixes
available with this beta release.

*Runtime*
Security Vulnerability

   - [IDENTITY-4701 ] - Move
   all operations in secret key revocation/regeneration, that change server
   state to ajaxprocessors and invoke them via POST

Patch

   - [IDENTITY-4250 ] -
   Userinfo endpoint does not return claims for a valid token.
   - [IDENTITY-4728 ] - "More
   APIs from Provider" section becomes empty after migrating to API Manager
   1.10 and browse the API Store without login
   - [IDENTITY-4773 ] -
   Supporting error codes generically for Basic Authenticator
   - [IDENTITY-5108 ] - Improve
   retrieving roles from cache for users
   - [IDENTITY-5149 ] -
   Secondary userstore encryption not works when deployed the userstore via
   file system
   - [IDENTITY-5227 ] - SCIM
   /me call does not return user attributes
   - [IDENTITY-5229 ] - Carbon
   products are limited to using RSA-SHA1 for Asymmetric key signature
   - [IDENTITY-5280 ] - Error
   is generated when SAML2 SP is sent a logout request when IDP session has
   been terminated.
   - [IDENTITY-5335 ] - Cannot
   delete internal roles using SCIM
   - [IDENTITY-5346 ] - UserDN
   Cache is not invalidated for authentication failures
   - [IDENTITY-5349 ] - We can
   not define full IDP url in WSO2IS dashboard
   - [IDENTITY-5350 ] - Cannot
   disable org.wso2.carbon.identity.user.profile.mgt.listener.
   ProfileMgtEventListener
   - [IDENTITY-5352 ] - When
   responseType equal to "id_token" the resulting token is passed back as a
   query parameter
   - [IDENTITY-5356 ] - SSO and
   SLO configuration for carbon server - Eventhough
   IdentityProviderSLOServiceURL is mentioned in authenticators.xml
   Destination value in SAML request is the SSO url not the SLO url.

Bug

   - [IDENTITY-3868 ] - Can't
   authorize with 'remember me' checked
   - [IDENTITY-4754 ] - Cannot
   call setUserClaimValues when user store is readOnly.
   - [IDENTITY-4922 ] - Cannot
   login after clearing the database and run -Dsetup.
   - [IDENTITY-5165 ] - Error
   when IS is started with -Dsetup pointing to a MYSQL DB
   - [IDENTITY-5170 ] - CNF
   when calling OIDC DCR endpoint to register a client
   - [IDENTITY-5177 ] - Clear
   samlssotokenid cookie after SAML2 SSO loging out from IS
   - [IDENTITY-5183 ] - OIDC
   DCR does not work without dynamic imports
   - [IDENTITY-5186 ] -
   NoClassDefFoundError At Server startup from IWA authenticator
   - [IDENTITY-5228 ] -
   Permission is denied when trying to authorize concurrently
   - [IDENTITY-5247 ] - Invalid
   response status when authentication headers are not sent to secured REST
   API via Genric Authentication
   - [IDENTITY-5250 ] - IS
   dashboard not working after installing KM features
   - [IDENTITY-5253 ] - Invalid
   response status from selfsignup API when trying to add user with existing
   username
   - [IDENTITY-5254 ] - Error
   when updating user roles in tenant from Management console
   - [IDENTITY-5256 ] - When
   secured REST APIs via Genric Authentication, permissions doesn't get
   dynamically updated for the Autherization valve
   - [IDENTITY-5257 ] - When
   email username is enabled cannot login to management console as tenant users
   - [IDENTITY-5262 ] - Error
   in account lock while 

Re: [Dev] WSO2 IS 5.3.0-Alpha2 : Not Able to authenticate users coming from External LDAP user store

2016-12-06 Thread Isura Karunaratne
Hi Hanen,

It looks like failedLoginAttempts attribute is not supported by your LDAP.
You can change the mapped attribute of
*http://wso2.org/claims/identity/failedLoginAttempts
* claim to a different
one which is supported by open LDAP.



​

If you do not require new Identity management features, you can disable
IdentityMgtEventListener from identity.xml file by adding following tag
under tag.  Then, this issue will not occur.



Thanks
Isura.



*Isura Dilhara Karunaratne*
Senior Software Engineer | WSO2
Email: is...@wso2.com
Mob : +94 772 254 810
Blog : http://isurad.blogspot.com/




On Tue, Dec 6, 2016 at 7:18 PM, Hanen Ben Rhouma  wrote:

> Hello,
>
> I'm facing an issue while trying to authenticate external users (coming
> from an external OpenLDAP user store) through WSO2 IS. There are missing
> claims that are required and even through I commented all what my LDAP
> doesn't provide in  claim-config.xml I'm still not able to authenticate
> users:
>
> [2016-12-06 13:32:39,159] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager}
> -  User: admin exist: true
> [2016-12-06 13:32:39,161] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  Replace escape characters configured to: true
> [2016-12-06 13:32:39,161] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  Replace escape characters configured to: true
> [2016-12-06 13:32:39,204] DEBUG 
> {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager}
> -  One or more attributes you are trying to add/update are not supported by
> underlying LDAP for user : admin
> javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error
> code 17 - failedLoginAttempts: attribute type undefined]; remaining name
> 'cn=admin'
> at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3205)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2888)
> at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1408)
> at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(
> ComponentDirContext.java:257)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(
> PartialCompositeDirContext.java:167)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(
> PartialCompositeDirContext.java:156)
> at org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager.
> doSetUserClaimValues(ReadWriteLDAPUserStoreManager.java:917)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> setUserClaimValues(AbstractUserStoreManager.java:1211)
> at org.wso2.carbon.identity.governance.store.
> UserStoreBasedIdentityDataStore.store(UserStoreBasedIdentityDataStor
> e.java:72)
> at org.wso2.carbon.identity.governance.listener.
> IdentityStoreEventListener.doPreSetUserClaimValues(
> IdentityStoreEventListener.java:110)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> setUserClaimValues(AbstractUserStoreManager.java:1205)
> at org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.
> handlePostAuthentication(AccountLockHandler.java:221)
> at org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.
> handleEvent(AccountLockHandler.java:141)
> at org.wso2.carbon.identity.event.services.IdentityEventServiceImpl.
> handleEvent(IdentityEventServiceImpl.java:56)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> handleEvent(IdentityMgtEventListener.java:595)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> handleEvent(IdentityMgtEventListener.java:547)
> at org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.
> doPostAuthenticate(IdentityMgtEventListener.java:101)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.
> authenticateInternal(AbstractUserStoreManager.java:558)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.access$100(
> AbstractUserStoreManager.java:71)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.
> run(AbstractUserStoreManager.java:466)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.
> run(AbstractUserStoreManager.java:463)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(
> AbstractUserStoreManager.java:463)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.
> run(AbstractUserStoreManager.java:451)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.
> run(AbstractUserStoreManager.java:442)
> at java.security.AccessController.doPrivileged(Native Method)
> at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(
> AbstractUserStoreManager.java:442)
> at org.wso2.carbon.core.services.authentication.AuthenticationAdmin.login(
> AuthenticationAdmin.java:100)
> at 

[Dev] WSO2 IS 5.3.0-Alpha2 : Not Able to authenticate users coming from External LDAP user store

2016-12-06 Thread Hanen Ben Rhouma
Hello,

I'm facing an issue while trying to authenticate external users (coming
from an external OpenLDAP user store) through WSO2 IS. There are missing
claims that are required and even through I commented all what my LDAP
doesn't provide in  claim-config.xml I'm still not able to authenticate
users:

[2016-12-06 13:32:39,159] DEBUG
{org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager} -  User:
admin exist: true
[2016-12-06 13:32:39,161] DEBUG
{org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} -  Replace
escape characters configured to: true
[2016-12-06 13:32:39,161] DEBUG
{org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} -  Replace
escape characters configured to: true
[2016-12-06 13:32:39,204] DEBUG
{org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} -  One or
more attributes you are trying to add/update are not supported by
underlying LDAP for user : admin
javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error
code 17 - failedLoginAttempts: attribute type undefined]; remaining name
'cn=admin'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3205)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3082)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2888)
at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapCtx.java:1408)
at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_modifyAttributes(ComponentDirContext.java:257)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:167)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.modifyAttributes(PartialCompositeDirContext.java:156)
at
org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager.doSetUserClaimValues(ReadWriteLDAPUserStoreManager.java:917)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.setUserClaimValues(AbstractUserStoreManager.java:1211)
at
org.wso2.carbon.identity.governance.store.UserStoreBasedIdentityDataStore.store(UserStoreBasedIdentityDataStore.java:72)
at
org.wso2.carbon.identity.governance.listener.IdentityStoreEventListener.doPreSetUserClaimValues(IdentityStoreEventListener.java:110)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.setUserClaimValues(AbstractUserStoreManager.java:1205)
at
org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.handlePostAuthentication(AccountLockHandler.java:221)
at
org.wso2.carbon.identity.handler.event.account.lock.AccountLockHandler.handleEvent(AccountLockHandler.java:141)
at
org.wso2.carbon.identity.event.services.IdentityEventServiceImpl.handleEvent(IdentityEventServiceImpl.java:56)
at
org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.handleEvent(IdentityMgtEventListener.java:595)
at
org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.handleEvent(IdentityMgtEventListener.java:547)
at
org.wso2.carbon.identity.governance.listener.IdentityMgtEventListener.doPostAuthenticate(IdentityMgtEventListener.java:101)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateInternal(AbstractUserStoreManager.java:558)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.access$100(AbstractUserStoreManager.java:71)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.run(AbstractUserStoreManager.java:466)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager$4.run(AbstractUserStoreManager.java:463)
at java.security.AccessController.doPrivileged(Native Method)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(AbstractUserStoreManager.java:463)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.run(AbstractUserStoreManager.java:451)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager$3.run(AbstractUserStoreManager.java:442)
at java.security.AccessController.doPrivileged(Native Method)
at
org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticate(AbstractUserStoreManager.java:442)
at
org.wso2.carbon.core.services.authentication.AuthenticationAdmin.login(AuthenticationAdmin.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.axis2.transport.local.LocalTransportReceiver.processMessage(LocalTransportReceiver.java:169)
at

Re: [Dev] [DEV][MSF4J][APIM] - Handling optional form data parameters

2016-12-06 Thread Tharindu Dharmarathna
Hi Azees,

As discussed created the issue [1] and related pull request for fix [2].


[1] - https://github.com/wso2/msf4j/issues/329
[2] - https://github.com/wso2/msf4j/pull/330

On Mon, Dec 5, 2016 at 3:46 PM, Tharindu Dharmarathna 
wrote:

> Hi All,
>
> We have some issue when using msf4j with optional form data params. As we
> narrow down, this issue come from when we not sending all the params which
> we are stated in swagger model. Which is the best way to handle optional
> form params in msf4j?.
>
>
> ex:
>
>> /abc
>> file:form param (optional)
>> inlinecontent : form param (optional)
>
>
>  request with file and inline content ==> request dispatched successfully.
> request with one of above  ==> request breaked from [1].
>
>
> [1] - https://github.com/wso2/msf4j/blob/v2.1.0/core/src/
> main/java/org/wso2/msf4j/internal/router/HttpResourceModelProcessor.
> java#L176.
>
>
> Thanks
>
> *Tharindu Dharmarathna*Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94779109091 <+94%2077%20910%209091>*
>



-- 
Thanks

*Tharindu Dharmarathna*Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94779109091*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Kanapriya Kuleswararajan

2016-12-06 Thread Yashothara Shanmugarajah
Congratulations Kanapriya :)

Best Regards,
Yashothara.S
Software Engineer
WSO2
http://wso2.com
https://wso2.com/signature


On Tue, Dec 6, 2016 at 3:44 PM, Thanuja Uruththirakodeeswaran <
thanu...@wso2.com> wrote:

> Congratulations Kanapriya :)
>
> On Tue, Dec 6, 2016 at 3:22 PM, Malaka Silva  wrote:
>
>> Hi Devs,
>>
>> Its my pleasure to welcome Kanapriya Kuleswararajan as a WSO2 Committer.
>>
>> She has been working with the WSO2 Platform Extensions Team for a while
>> and has contributed to  ESB and IS product extensions,
>>
>> Kanapriya, welcome aboard and keep up the good work.
>>
>> Best Regards,
>>
>> Malaka Silva
>> Senior Technical Lead
>> M: +94 777 219 791 <+94%2077%20721%209791>
>> Tel : 94 11 214 5345
>> Fax :94 11 2145300
>> Skype : malaka.sampath.silva
>> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
>> Blog : http://mrmalakasilva.blogspot.com/
>>
>> WSO2, Inc.
>> lean . enterprise . middleware
>> https://wso2.com/signature
>> http://www.wso2.com/about/team/malaka-silva/
>> 
>> https://store.wso2.com/store/
>>
>> Don't make Trees rare, we should keep them with care
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thanuja Uruththirakodeeswaran
> Software Engineer
> WSO2 Inc.;http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 774363167 <+94%2077%20436%203167>
>
> 
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Committers += Kanapriya Kuleswararajan

2016-12-06 Thread Thanuja Uruththirakodeeswaran
Congratulations Kanapriya :)

On Tue, Dec 6, 2016 at 3:22 PM, Malaka Silva  wrote:

> Hi Devs,
>
> Its my pleasure to welcome Kanapriya Kuleswararajan as a WSO2 Committer.
>
> She has been working with the WSO2 Platform Extensions Team for a while
> and has contributed to  ESB and IS product extensions,
>
> Kanapriya, welcome aboard and keep up the good work.
>
> Best Regards,
>
> Malaka Silva
> Senior Technical Lead
> M: +94 777 219 791 <+94%2077%20721%209791>
> Tel : 94 11 214 5345
> Fax :94 11 2145300
> Skype : malaka.sampath.silva
> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
> Blog : http://mrmalakasilva.blogspot.com/
>
> WSO2, Inc.
> lean . enterprise . middleware
> https://wso2.com/signature
> http://www.wso2.com/about/team/malaka-silva/
> 
> https://store.wso2.com/store/
>
> Don't make Trees rare, we should keep them with care
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thanuja Uruththirakodeeswaran
Software Engineer
WSO2 Inc.;http://wso2.com
lean.enterprise.middleware

mobile: +94 774363167


___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] WSO2 Committers += Kanapriya Kuleswararajan

2016-12-06 Thread Malaka Silva
Hi Devs,

Its my pleasure to welcome Kanapriya Kuleswararajan as a WSO2 Committer.

She has been working with the WSO2 Platform Extensions Team for a while and
has contributed to  ESB and IS product extensions,

Kanapriya, welcome aboard and keep up the good work.

Best Regards,

Malaka Silva
Senior Technical Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
https://wso2.com/signature
http://www.wso2.com/about/team/malaka-silva/

https://store.wso2.com/store/

Don't make Trees rare, we should keep them with care
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Writing a siddhi extension for a function which produces values with different return types

2016-12-06 Thread Liangfei.Su
Megala

Is
https://docs.wso2.com/display/CEP400/Inbuilt+Functions#InbuiltFunctions-convertconvert
what you expect?

Thanks,
Ralph


On Tue, Dec 6, 2016 at 11:48 AM, Megala Uthayakumar  wrote:

>
> Hi All,
>
> In IOT analytics, we have a requirement of writing siddhi extension to get
> the value for a particular json property when the json string and property
> name are passed as parameters. The extension can be used as below,
>
> *json:getProperty("jsonString","property_name")*
>
> Since the above function is capable of returning any type
> (Bool/long/string/..)  as return values. Initially we tried it without
> defining the return types. In that case, siddhi engine threw and exception
> saying that return type of above is null and stream definitions does not
> match. After that we tried to set the return type in execute method based
> on the value. but seems like it is required to use the init method in
> siddhi extension to set the return type. Finally what we did is to use the
> third parameter which would indicate the type required for the return type
> as follow,
>
> if we need a double
>
> *json.getProperty("jsonString", "latitude", 0.0d);*
>
> if we need a long,
>
> *json.getProperty(("jsonString", "timestamp", 0l);*
>
> Is there any better way of achieving this ? or do we have a cast function
> for string, so that we can later cast the value to a desired type?
>
> Thanks.
>
> Regards,
> Megala
> --
> Megala Uthayakumar
>
> Software Engineer
> Mobile : 0779967122
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Writing a siddhi extension for a function which produces values with different return types

2016-12-06 Thread Megala Uthayakumar
This can be achieved using convert function[1].

[1]
https://docs.wso2.com/display/CEP400/Inbuilt+Functions#InbuiltFunctions-convertconvert

On Tue, Dec 6, 2016 at 9:18 AM, Megala Uthayakumar  wrote:

>
> Hi All,
>
> In IOT analytics, we have a requirement of writing siddhi extension to get
> the value for a particular json property when the json string and property
> name are passed as parameters. The extension can be used as below,
>
> *json:getProperty("jsonString","property_name")*
>
> Since the above function is capable of returning any type
> (Bool/long/string/..)  as return values. Initially we tried it without
> defining the return types. In that case, siddhi engine threw and exception
> saying that return type of above is null and stream definitions does not
> match. After that we tried to set the return type in execute method based
> on the value. but seems like it is required to use the init method in
> siddhi extension to set the return type. Finally what we did is to use the
> third parameter which would indicate the type required for the return type
> as follow,
>
> if we need a double
>
> *json.getProperty("jsonString", "latitude", 0.0d);*
>
> if we need a long,
>
> *json.getProperty(("jsonString", "timestamp", 0l);*
>
> Is there any better way of achieving this ? or do we have a cast function
> for string, so that we can later cast the value to a desired type?
>
> Thanks.
>
> Regards,
> Megala
> --
> Megala Uthayakumar
>
> Software Engineer
> Mobile : 0779967122
>



-- 
Megala Uthayakumar

Software Engineer
Mobile : 0779967122
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev