[Dev] [Architecture] WSO2 Carbon Kernel 5.2.0-M4 Released

2017-06-01 Thread Danesh Kuruppu
WSO2 Carbon Kernel 5.2.0-M4 Released

The Carbon team is pleased to announce the release of Carbon Kernel 5.2.0-M4.
It is now available to download from here
.

*Improvements and Bug fixes*
https://github.com/wso2/carbon-kernel/milestone/10?closed=1

How to Contribute
WSO2 Carbon Kernel code is hosted in Github.
The Git repository is https://github.com/wso2/carbon-kernel/
Carbon Kernel 5.2.0-M4 release tag is
https://github.com/wso2/carbon-kernel/releases/tag/v5.2.0-m4
Please report issues at Github: https://github.com/wso2/carbon-kernel/issues

Contact Us

WSO2 Carbon developers can be contacted via following mailing lists:
WSO2 Developers List: dev@wso2.org
WSO2 Architecture List: architect...@wso2.org

You can download the released distribution from the following location.
http://wso2.com/products/carbon/

Thank you for your interest in WSO2 Carbon Kernel.

Best Regards
Carbon Team


-- 

*Danesh Kuruppu*
Senior Software Engineer | WSO2

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


Re: [Dev] Improvements to OAuth Dynamic Client Registration

2017-06-01 Thread Ishara Karunarathna
Hi Bhathiya,

On Fri, Jun 2, 2017 at 12:14 AM, Bhathiya Jayasekara 
wrote:

> Hi all,
>
> While using current DCR API of IS I observed a few things that might need
> an improvement or should be fixed.
>
> 1) When I create 2 apps with the same "client_name", it returns the same
> app with "201:Created" response. Shouldn't it throw an error saying
> "client_name" already exists?
>
This is already identified and fixed
IDENTITY-5529

> 2) We have to provide at least 1 Redirect URL in DCR request. Shouldn't
> "redirect_urls" be optional, as grant types like "password" don't need it
> at all?
>
With the current implementation OAuth App registration we expect this, So
in the DCR layer we can't make this optional. In the registration it can
send some value.
So I think this is ok.

-Ishara

>
> Thanks,
> Bhathiya
>
> On Thu, May 25, 2017 at 5:43 PM, Abilashini Thiyagarajah <
> abilashini...@cse.mrt.ac.lk> wrote:
>
>> Hi,
>>
>> I have sent a PR [1] with the completed parts. Please review.
>>
>> [1] https://github.com/wso2-extensions/identity-inbound-auth
>> -oauth/pull/373
>>
>> Thanks,
>> Abilashini
>>
>> *Thiyagarajah Abilashini*
>> Student
>> Department of Computer Science and Engineering
>> University of Moratuwa, Sri Lanka
>>
>> On 25 May 2017 at 15:27, Pushpalanka Jayawardhana  wrote:
>>
>>> Hi Abilashini,
>>>
>>> As per the discussion we had short while ago, let's prioritize
>>> implementing the APIs required for DCRM functionality.
>>>
>>> Support for multiple locales in not a critical requirement for us at the
>>> moment, hence moved that to a separate task as at [1]. You can add your
>>> current findings there so we can later attend that.
>>> You can send a PR for current progress for the issue, so that you can
>>> start working on DCRM.
>>>
>>> [1] - https://wso2.org/jira/browse/IDENTITY-5979
>>>
>>> Thanks,
>>> Pushpalanka
>>>
>>> On Thu, May 25, 2017 at 10:50 AM, Abilashini Thiyagarajah <
>>> abilashini...@cse.mrt.ac.lk> wrote:
>>>
 Hi Pushpalanka,

 Thanks for your reply. I have already referred this section to
 understand the concept. But in the specific issue, it has been mentioned
 only for redirect URI.

 To consider local specific values for all the Human-readable client
 metadata, can we fix it as a separate issue rather than including it in the
 [1].

 The problems arise on fixing this are,

1. If there are local specific values for redirect uris, should it
be added to the typical redirect uris list when building the 
 registration
request object.
2. If there are multiple values for a specific meta data (eg.
client_name) in different languages, then which to be considered during
registration.

 I found a library [2] which supports for language tags. Can we use it
 for the implementation?

 [1] https://wso2.org/jira/browse/IDENTITY-5879
 [2] https://www.connect2id.com/blog/language-tags-rfc-5646-for-java

 Thanks,
 Abilashini

 *Thiyagarajah Abilashini*
 Student
 Department of Computer Science and Engineering
 University of Moratuwa, Sri Lanka

 On 25 May 2017 at 09:54, Pushpalanka Jayawardhana 
 wrote:

> Hi Abilashini,
>
> This section in the specification elaborates more in this[1].
> This is not limited to redirect URI, but for all Human-readable client
> metadata.
>
> [1] - https://tools.ietf.org/html/rfc7591#section-2.2
>
> Thanks,
> Pushpalanka
>
> On Tue, May 23, 2017 at 2:09 PM, Abilashini Thiyagarajah <
> abilashini...@cse.mrt.ac.lk> wrote:
>
>> Hi all,
>>
>> I am currently working on the issue [1]. Specifically the point 4 in
>> the description, it has been mentioned as the implementation should allow
>> multiple locale-specific values for redirect URI. According to my
>> understanding on the implementation of DCR, if there are any
>> locale-specific values for the redirect URI in the registration request
>> (eg. redirect_uris#en), it will be added to the list of redirect
>> URI's while building the registration request profile. Is that the 
>> expected
>> outcome? Please provide your insights.
>>
>> [1] https://wso2.org/jira/browse/IDENTITY-5879
>>
>>
>> *Thiyagarajah Abilashini*
>> Student
>> Department of Computer Science and Engineering
>> University of Moratuwa, Sri Lanka
>>
>> On 15 May 2017 at 23:51, Maduranga Siriwardena 
>> wrote:
>>
>>> Thanks Abilashini for the PR. We will review and merge.
>>>
>>> In the mean time, please work on the other issue too.
>>>
>>> On Fri, May 12, 2017 at 1:30 PM, Abilashini Thiyagarajah <
>>> abilashini...@cse.mrt.ac.lk> wrote:
>>>
 Hi all,

 Please review - https://github.com/wso2-exte
 nsions/identity-inbound-auth-oauth/pull/353

 Best Regards,
 Ab

Re: [Dev] Extending API manager

2017-06-01 Thread Gihan Nimath
Hi Rajith & all,

My requirement is not to change the look and feel, but to customize the
product. I might be changing the publishing approaches, flow in the UI etc.

So I will have my custom code separately, then applied on top of the
product release via maven build.

Could you please give me some guidance on that?

Thank you
Gihan


On Thu, Jun 1, 2017 at 5:19 PM, Rajith Roshan  wrote:

> Hi Gihan,
>
> If your requirement is to change the UI of the store, I would recommend to
> use sub themes. Please refer following documentation[1],[2] in order to
> apply sub themes.
>
> [1] - https://docs.wso2.com/display/AM200/Adding+a+New+API+Store+Theme
> 
> [2] - http://sanjeewamalalgoda.blogspot.com/2015/01/how-to-
> add-sub-theme-to-api-manager.html
>
> Thanks!
> Rajith
>
>
> On Wed, May 31, 2017 at 10:41 PM, Gihan Nimath 
> wrote:
>
>> Dear all,
>>
>> I am working on customizing api-manager storefront. Rather than the
>> customizing the code in my fork, I am thinking about writing the
>> customization part in a separate project. Then I will be able to have a
>> maven build that will apply those changes on to the zip file generated as
>> the release of api manager.
>>
>> Is there any specific approaches that you follow in such a requirement?
>> Any advice will help me.
>>
>> Thanking you,
>> Gihan
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Rajith Roshan
> Software Engineer, WSO2 Inc.
> Mobile: +94-7 <%2B94-71-554-8430>17-064-214
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] API 2.1.0 + Identity Server 5.3.0

2017-06-01 Thread Vazquez-Hidalgo, Javier
Hi Isura,

Thanks for your response, I added the secondary user store to the API manager 
and the problem goes away ONLY if I disable SSO on the store. With SSO enabled 
I can only login with users from the primary store.

Any ideas on how to get it working with SSO?

Thanks,
Javier

From: Isura Karunaratne [mailto:is...@wso2.com]
Sent: Wednesday, May 31, 2017 6:26 AM
To: Vazquez-Hidalgo, Javier
Cc: dev@wso2.org
Subject: Re: [Dev] API 2.1.0 + Identity Server 5.3.0

HI Javier,

It looks like you have not configured secondary user store in API Manager 
instance. You can get rid of the authorization issue by configuring the 
read-only secondary user store in APIM as well.

Since the Authorization handles in APIM instance, user store should be shared 
with APIM as well.

Thanks
Isura.

On Tue, May 30, 2017 at 7:18 PM, Vazquez-Hidalgo, Javier 
mailto:javier.vazquez-hida...@tdsecurities.com>>
 wrote:
Hi Isura,

In the log files, please search for “vazquj2”. That is the user who fails to 
login. I’ll send the conf files shortly. After more research it seems that APIM 
is looking user roles in UM_ROLES instead of UM_HYBRID_ROLES.

Thanks,
Javier

From: Isura Karunaratne [mailto:is...@wso2.com]
Sent: Monday, May 29, 2017 1:24 AM

To: Vazquez-Hidalgo, Javier
Cc: dev@wso2.org
Subject: Re: [Dev] API 2.1.0 + Identity Server 5.3.0

Hi Javier,

According to the apim-wso2carbon.log file, only admin user tried login to the 
APIM instance and it was a success login.  Please attach the log, once the 
store login failure occurs. Also, attach the conf folders in each products.

Thanks
Isura.

On Fri, May 26, 2017 at 8:56 PM, Vazquez-Hidalgo, Javier 
mailto:javier.vazquez-hida...@tdsecurities.com>>
 wrote:
Hi Isura,

Thanks for your help!

Attached to the email are both logs with 
“log4j.logger.org.wso2.carbon.user.core=DEBUG” enabled.

Regards,
Javier

From: Isura Karunaratne [mailto:is...@wso2.com]
Sent: Friday, May 26, 2017 3:10 AM
To: Vazquez-Hidalgo, Javier
Cc: dev@wso2.org
Subject: Re: [Dev] API 2.1.0 + Identity Server 5.3.0

Hi Javier,

We need additional information to analyze the issue. Attach the wso2carbon.log 
file after enabling the debug logs for org.wso2.carbon.user.core package as 
follows.

Add following entry to /repository/conf/log4j.properties file

log4j.logger.org.wso2.carbon.user.core=DEBUG


Thanks
Isura.

On Fri, May 26, 2017 at 12:50 AM, Vazquez-Hidalgo, Javier 
mailto:javier.vazquez-hida...@tdsecurities.com>>
 wrote:
Hello,

I’m trying to setup APIM 2.1.0 + Identity Server 5.3.0 on separate boxes, at 
this point I have all configurations in place with shared databases and I added 
a secondary User Store (Read-Only LDAP) on the Identity Server and I’m able to 
assign permissions, etc..

The problem I’m having is that when I try to login to the API Store using a 
user from the secondary user store I get the following error in the login 
screen:

“Error! Login failed. Insufficient Privileges.”

APIM Logs:
-

[2017-05-25 14:49:52,812] ERROR - JDBCAuthorizationManager Error occurred while 
accessing Java Security Manager Privilege Block
[2017-05-25 14:49:52,812] ERROR - APIStoreHostObject Login failed. Insufficient 
Privileges.

IS Log:
---
[2017-05-25 14:49:52,498]  INFO 
{org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  
'DOMAIN/xxx@carbon.super [-1234]' logged in at [2017-05-25 14:49:52,497-0400]

So, it seems that the user is authenticated but something is happening.

Just to be clear, the user from the secondary user store has 
“Internal/subscriber” role which should be sufficient to login.

I also created a test user in the IS primary store and assigned 
“Internal/subscriber” role and that worked fine.


Any help or pointers is appreciated.

Thanks,
Javier Vazquez




If you wish to unsubscribe from receiving commercial electronic messages from 
TD Bank Group, please click here or go to the 
following web address: www.td.com/tdoptout
Si vous souhaitez vous désabonner des messages électroniques de nature 
commerciale envoyés par Groupe Banque TD veuillez cliquer 
ici ou vous rendre à l'adresse 
www.td.com/tddesab

NOTICE: Confidential message which may be privileged. Unauthorized 
use/disclosure prohibited. If received in error, please go to 
www.td.com/legal for instructions.
AVIS : Message confidentiel dont le contenu peut être privilégié. 
Utilisation/divulgation interdites sans permission. Si reçu par erreur, prière 
d'aller au 
www.td.com/francais/avis_juridique 
pour des instructions.

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



--
Isura Dilhara Karunaratne
Senior Software Engineer | WSO2
Email: is.

Re: [Dev] Extending API manager

2017-06-01 Thread Rajith Roshan
Hi Gihan,

If your requirement is to change the UI of the store, I would recommend to
use sub themes. Please refer following documentation[1],[2] in order to
apply sub themes.

[1] - https://docs.wso2.com/display/AM200/Adding+a+New+API+Store+Theme

[2] -
http://sanjeewamalalgoda.blogspot.com/2015/01/how-to-add-sub-theme-to-api-manager.html

Thanks!
Rajith


On Wed, May 31, 2017 at 10:41 PM, Gihan Nimath 
wrote:

> Dear all,
>
> I am working on customizing api-manager storefront. Rather than the
> customizing the code in my fork, I am thinking about writing the
> customization part in a separate project. Then I will be able to have a
> maven build that will apply those changes on to the zip file generated as
> the release of api manager.
>
> Is there any specific approaches that you follow in such a requirement?
> Any advice will help me.
>
> Thanking you,
> Gihan
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-7 <%2B94-71-554-8430>17-064-214
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Identity Server extending session endpoint

2017-06-01 Thread Farasath Ahamed
On Thursday, June 1, 2017, Illia Alifanov  wrote:

> Hello, Farasath.
>
>
>
> The specific reason to implement this on top of 5.1.0  – we want to deploy
> WSO2 Identity Server on Kubernetes with WSO2 Puppet Module. As far as I
> know there isn’t ability  to do this with Identity Server 5.3.0.
>
> I hope you have approach to deploy IS 5.3.0 on Kubernetes and give me
> advice how to do so and we can discuss mentioned endpoint for 5.3.0.
>
>
>
> Regards,
>
> Illia.
>
>
>
> *From:* Farasath Ahamed [mailto:farasa...@wso2.com
> ]
> *Sent:* Wednesday, May 31, 2017 9:36 PM
> *To:* Illia Alifanov  >
> *Cc:* dev@wso2.org 
> *Subject:* Re: [Dev] Identity Server extending session endpoint
>
>
>
>
>
> On Wed, May 31, 2017 at 5:54 PM, Illia Alifanov  > wrote:
>
> Dear dev team,
>
>
>
> We talk about new endpoint for Identity Server for extending session if
> necessary
>
> https://wso2.org/jira/browse/IDENTITY-5933
>
>
>
> Would you be so kind to send me specification for this new endpoint if you
> already have prepared it
>
>
>
> As of now we haven't come up with a design or specification for this
> endpoint. If you could come up with one we can have a discussion.
>
>
>
> and I’ll try to implement it for Identity Server 5.1.0.
>
>
>
> Any specific reason you are planning to implement this on top of 5.1.0.
> The latest release is 5.3.0 so wouldn't it be better if we could implement
> on top of the latest code?
>
>
>
> Regards,
>
> Illia.
>
>
> --
>
>
> This e-mail may contain privileged and confidential information. If you
> are not the intended recipient, be aware that any use, disclosure, copying
> or distribution of this e-mail or any attachments is prohibited. If you
> have received this e-mail in error, please notify us immediately by
> returning it to the sender and delete this copy from your system. Thank you.
>
>
> ___
> Dev mailing list
> Dev@wso2.org 
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
>
> --
>
> This e-mail may contain privileged and confidential information. If you
> are not the intended recipient, be aware that any use, disclosure, copying
> or distribution of this e-mail or any attachments is prohibited. If you
> have received this e-mail in error, please notify us immediately by
> returning it to the sender and delete this copy from your system. Thank you.
>


-- 
Farasath Ahamed
Software Engineer, WSO2 Inc.; http://wso2.com
Mobile: +94777603866
Blog: blog.farazath.com
Twitter: @farazath619 

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


Re: [Dev] Identity Server extending session endpoint

2017-06-01 Thread Illia Alifanov
Hello, Farasath.

The specific reason to implement this on top of 5.1.0  – we want to deploy WSO2 
Identity Server on Kubernetes with WSO2 Puppet Module. As far as I know there 
isn’t ability  to do this with Identity Server 5.3.0.
I hope you have approach to deploy IS 5.3.0 on Kubernetes and give me advice 
how to do so and we can discuss mentioned endpoint for 5.3.0.

Regards,
Illia.

From: Farasath Ahamed [mailto:farasa...@wso2.com]
Sent: Wednesday, May 31, 2017 9:36 PM
To: Illia Alifanov 
Cc: dev@wso2.org
Subject: Re: [Dev] Identity Server extending session endpoint


On Wed, May 31, 2017 at 5:54 PM, Illia Alifanov 
mailto:illia.alifa...@eleks.com>> wrote:
Dear dev team,

We talk about new endpoint for Identity Server for extending session if 
necessary
https://wso2.org/jira/browse/IDENTITY-5933

Would you be so kind to send me specification for this new endpoint if you 
already have prepared it

As of now we haven't come up with a design or specification for this endpoint. 
If you could come up with one we can have a discussion.

and I’ll try to implement it for Identity Server 5.1.0.

Any specific reason you are planning to implement this on top of 5.1.0. The 
latest release is 5.3.0 so wouldn't it be better if we could implement on top 
of the latest code?

Regards,
Illia.



This e-mail may contain privileged and confidential information. If you are not 
the intended recipient, be aware that any use, disclosure, copying or 
distribution of this e-mail or any attachments is prohibited. If you have 
received this e-mail in error, please notify us immediately by returning it to 
the sender and delete this copy from your system. Thank you.

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




This e-mail may contain privileged and confidential information. If you are not 
the intended recipient, be aware that any use, disclosure, copying or 
distribution of this e-mail or any attachments is prohibited. If you have 
received this e-mail in error, please notify us immediately by returning it to 
the sender and delete this copy from your system. Thank you.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV] Can we bind custom interceptors in msf4j2.3.0-m2

2017-06-01 Thread Vidura Nanayakkara
Hi Ishara,

So, can we have the support to be able to plug custom interceptors for
> microservices?


​
I
f you are asking about the dynamic interceptors similar to the dynamic
binding of filters in JAX-RS spec [1],  MSF4J currently do not support
dynamic binding of interceptors.


[1]
https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/apache_cxf_development_guide/jaxrs20filters#JAXRS20Filters-DynamicBinding

Best Regards,
Vidura Nanayakkara

On Thu, Jun 1, 2017 at 1:19 PM, Ishara Cooray  wrote:

> Thanks for the clarification Vidura.
>
> So, can we have the support to be able to plug custom interceptors for
> microservices?
>
>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> On Thu, Jun 1, 2017 at 1:02 PM, Vidura Nanayakkara 
> wrote:
>
>> Hi Ishara,
>>
>> On Thu, Jun 1, 2017 at 12:29 PM, Ishara Cooray  wrote:
>>
>>> According to the new Interceptor support in msf4j-2.3.0-m2
>>>
>>> AFAIU,
>>> We can bind interceptors for a given microservice as below.
>>>
>>> InterceptorService is the micro service that is going to be intercepted by 
>>> RequestInterceptors and Responseinterceptors annotated by
>>>
>>> @RequestInterceptor and @ResponseInterceptor
>>>
>>> @Component(
 name = "InterceptorService",
 service = Microservice.class,
 immediate = true
 )@Path("/interceptor-service")public class InterceptorService implements 
 Microservice {


 private static final Logger log = 
 LoggerFactory.getLogger(InterceptorService.class);


 /** * Method for getting the micro-service name. * * 
 @return name of the micro-service. */
 @GET
 @Path("/service-name")
 @RequestInterceptor(
 ​​
 HTTPRequestLogger.class)
 @ResponseInterceptor(HTTPResponseLogger.class)
 public String getServiceName() {
 log.info("HTTP Method Execution - getServiceName()");
 return "WSO2 Service";
 }
 }

 1. Can we use @RequestInterceptor and @ResponseInterceptor annotations
>>> to the class level so that it will apply for every resource invocation?
>>>
>>
>> ​Yes, you can use @RequestInterceptor and @ResponseInterceptor to the
>> class level so that it will apply to every resource invocation in the
>> service.
>>
>> Example:
>>
>> @Path("/stockquote")
>>
>> @RequestInterceptor(
>> ​
>> HTTPRequestLogger.class)
>>
>> @ResponseInterceptor({HTTPResponseLogger.class, 
>> LogTextResponseInterceptor.class})
>>
>> public class StockQuoteService {
>> // Your resource methods here
>> }
>>
>> Furthermore, if you want to apply the interceptors to all the services in a 
>> micro-service in OSGi mode please refer [1] and for non-OSGi mode please 
>> refer [2] and [3].
>>
>>
>>> 2. Can we plug a custom request/response interceptors?
>>>
>>>  Can it be supported something similar to below.
>>>  We have a class called ABCRequestInterceptor which implements 
>>> RequestInterceptor
>>> and there can be classes that extends
>>>  ABCRequestInterceptor
>>>
>>> But , we bind the interceptor as
>>>
>>>  @RequestInterceptor(ABCRequestInterceptor.class)
>>>
>>> Will this bind extended Interceptors too to the InterceptorService?
>>>
>>
>> ​In this case the ABCRequestInterceptor will be the interceptor which
>> gets executed. Please note that the other interceptors which is extended
>> from this class do not get executed​ (The class you mention in the
>> annotation is taken exactly as it is)
>>
>>
>>>
>>> Thanks & Regards,
>>> Ishara Cooray
>>> Senior Software Engineer
>>> Mobile : +9477 262 9512 <+94%2077%20262%209512>
>>> WSO2, Inc. | http://wso2.com/
>>> Lean . Enterprise . Middleware
>>>
>>
>>
>> ​[1] https://github.com/wso2/msf4j/blob/release-2.3.0-m1/samples/
>> interceptor/osgi-interceptor-service/README.md​
>> [2] https://github.com/wso2/msf4j/tree/release-2.3.0-m1/samp
>> les/interceptor/fatjar-interceptor-service
>> [3] https://github.com/wso2/msf4j/blob/release-2.3.0-m1/samp
>> les/interceptor/fatjar-interceptor-service/src/main/java/
>> org/wso2/msf4j/samples/fatjarinterceptorservice/Application.java
>>
>> Best Regards,
>> Vidura Nanayakkara
>>
>> --
>> Best Regards,
>>
>> *Vidura Nanayakkara*
>> Software Engineer
>>
>> Email : vidu...@wso2.com
>> Mobile : +94 (0) 717 919277 <+94%2071%20791%209277>
>> Web : http://wso2.com
>> Blog : https://medium.com/@viduran
>> LinkedIn : https://lk.linkedin.com/in/vidura-nanayakkara
>>
>
>


-- 
Best Regards,

*Vidura Nanayakkara*
Software Engineer

Email : vidu...@wso2.com
Mobile : +94 (0) 717 919277
Web : http://wso2.com
Blog : https://medium.com/@viduran
LinkedIn : https://lk.linkedin.com/in/vidura-nanayakkara
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV] Can we bind custom interceptors in msf4j2.3.0-m2

2017-06-01 Thread Ishara Cooray
Thanks for the clarification Vidura.

So, can we have the support to be able to plug custom interceptors for
microservices?


Thanks & Regards,
Ishara Cooray
Senior Software Engineer
Mobile : +9477 262 9512
WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

On Thu, Jun 1, 2017 at 1:02 PM, Vidura Nanayakkara  wrote:

> Hi Ishara,
>
> On Thu, Jun 1, 2017 at 12:29 PM, Ishara Cooray  wrote:
>
>> According to the new Interceptor support in msf4j-2.3.0-m2
>>
>> AFAIU,
>> We can bind interceptors for a given microservice as below.
>>
>> InterceptorService is the micro service that is going to be intercepted by 
>> RequestInterceptors and Responseinterceptors annotated by
>>
>> @RequestInterceptor and @ResponseInterceptor
>>
>> @Component(
>>> name = "InterceptorService",
>>> service = Microservice.class,
>>> immediate = true
>>> )@Path("/interceptor-service")public class InterceptorService implements 
>>> Microservice {
>>>
>>>
>>> private static final Logger log = 
>>> LoggerFactory.getLogger(InterceptorService.class);
>>>
>>>
>>> /** * Method for getting the micro-service name. * * 
>>> @return name of the micro-service. */
>>> @GET
>>> @Path("/service-name")
>>> @RequestInterceptor(
>>> ​​
>>> HTTPRequestLogger.class)
>>> @ResponseInterceptor(HTTPResponseLogger.class)
>>> public String getServiceName() {
>>> log.info("HTTP Method Execution - getServiceName()");
>>> return "WSO2 Service";
>>> }
>>> }
>>>
>>> 1. Can we use @RequestInterceptor and @ResponseInterceptor annotations
>> to the class level so that it will apply for every resource invocation?
>>
>
> ​Yes, you can use @RequestInterceptor and @ResponseInterceptor to the
> class level so that it will apply to every resource invocation in the
> service.
>
> Example:
>
> @Path("/stockquote")
>
> @RequestInterceptor(
> ​
> HTTPRequestLogger.class)
>
> @ResponseInterceptor({HTTPResponseLogger.class, 
> LogTextResponseInterceptor.class})
>
> public class StockQuoteService {
> // Your resource methods here
> }
>
> Furthermore, if you want to apply the interceptors to all the services in a 
> micro-service in OSGi mode please refer [1] and for non-OSGi mode please 
> refer [2] and [3].
>
>
>> 2. Can we plug a custom request/response interceptors?
>>
>>  Can it be supported something similar to below.
>>  We have a class called ABCRequestInterceptor which implements 
>> RequestInterceptor
>> and there can be classes that extends
>>  ABCRequestInterceptor
>>
>> But , we bind the interceptor as
>>
>>  @RequestInterceptor(ABCRequestInterceptor.class)
>>
>> Will this bind extended Interceptors too to the InterceptorService?
>>
>
> ​In this case the ABCRequestInterceptor will be the interceptor which gets
> executed. Please note that the other interceptors which is extended from
> this class do not get executed​ (The class you mention in the annotation is
> taken exactly as it is)
>
>
>>
>> Thanks & Regards,
>> Ishara Cooray
>> Senior Software Engineer
>> Mobile : +9477 262 9512 <+94%2077%20262%209512>
>> WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>
>
> ​[1] https://github.com/wso2/msf4j/blob/release-2.3.0-m1/samples/
> interceptor/osgi-interceptor-service/README.md​
> [2] https://github.com/wso2/msf4j/tree/release-2.3.0-m1/
> samples/interceptor/fatjar-interceptor-service
> [3] https://github.com/wso2/msf4j/blob/release-2.3.0-m1/
> samples/interceptor/fatjar-interceptor-service/src/main/
> java/org/wso2/msf4j/samples/fatjarinterceptorservice/Application.java
>
> Best Regards,
> Vidura Nanayakkara
>
> --
> Best Regards,
>
> *Vidura Nanayakkara*
> Software Engineer
>
> Email : vidu...@wso2.com
> Mobile : +94 (0) 717 919277 <+94%2071%20791%209277>
> Web : http://wso2.com
> Blog : https://medium.com/@viduran
> LinkedIn : https://lk.linkedin.com/in/vidura-nanayakkara
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [DEV] Can we bind custom interceptors in msf4j2.3.0-m2

2017-06-01 Thread Vidura Nanayakkara
Hi Ishara,

On Thu, Jun 1, 2017 at 12:29 PM, Ishara Cooray  wrote:

> According to the new Interceptor support in msf4j-2.3.0-m2
>
> AFAIU,
> We can bind interceptors for a given microservice as below.
>
> InterceptorService is the micro service that is going to be intercepted by 
> RequestInterceptors and Responseinterceptors annotated by
>
> @RequestInterceptor and @ResponseInterceptor
>
> @Component(
>> name = "InterceptorService",
>> service = Microservice.class,
>> immediate = true
>> )@Path("/interceptor-service")public class InterceptorService implements 
>> Microservice {
>>
>>
>> private static final Logger log = 
>> LoggerFactory.getLogger(InterceptorService.class);
>>
>>
>> /** * Method for getting the micro-service name. * * @return 
>> name of the micro-service. */
>> @GET
>> @Path("/service-name")
>> @RequestInterceptor(
>> ​​
>> HTTPRequestLogger.class)
>> @ResponseInterceptor(HTTPResponseLogger.class)
>> public String getServiceName() {
>> log.info("HTTP Method Execution - getServiceName()");
>> return "WSO2 Service";
>> }
>> }
>>
>> 1. Can we use @RequestInterceptor and @ResponseInterceptor annotations
> to the class level so that it will apply for every resource invocation?
>

​Yes, you can use @RequestInterceptor and @ResponseInterceptor to the class
level so that it will apply to every resource invocation in the service.

Example:

@Path("/stockquote")

@RequestInterceptor(
​
HTTPRequestLogger.class)

@ResponseInterceptor({HTTPResponseLogger.class,
LogTextResponseInterceptor.class})

public class StockQuoteService {
// Your resource methods here
}

Furthermore, if you want to apply the interceptors to all the services
in a micro-service in OSGi mode please refer [1] and for non-OSGi mode
please refer [2] and [3].


> 2. Can we plug a custom request/response interceptors?
>
>  Can it be supported something similar to below.
>  We have a class called ABCRequestInterceptor which implements 
> RequestInterceptor
> and there can be classes that extends
>  ABCRequestInterceptor
>
> But , we bind the interceptor as
>
>  @RequestInterceptor(ABCRequestInterceptor.class)
>
> Will this bind extended Interceptors too to the InterceptorService?
>

​In this case the ABCRequestInterceptor will be the interceptor which gets
executed. Please note that the other interceptors which is extended from
this class do not get executed​ (The class you mention in the annotation is
taken exactly as it is)


>
> Thanks & Regards,
> Ishara Cooray
> Senior Software Engineer
> Mobile : +9477 262 9512 <+94%2077%20262%209512>
> WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>


​[1]
https://github.com/wso2/msf4j/blob/release-2.3.0-m1/samples/interceptor/osgi-interceptor-service/README.md
​
[2]
https://github.com/wso2/msf4j/tree/release-2.3.0-m1/samples/interceptor/fatjar-interceptor-service
[3]
https://github.com/wso2/msf4j/blob/release-2.3.0-m1/samples/interceptor/fatjar-interceptor-service/src/main/java/org/wso2/msf4j/samples/fatjarinterceptorservice/Application.java

Best Regards,
Vidura Nanayakkara

-- 
Best Regards,

*Vidura Nanayakkara*
Software Engineer

Email : vidu...@wso2.com
Mobile : +94 (0) 717 919277
Web : http://wso2.com
Blog : https://medium.com/@viduran
LinkedIn : https://lk.linkedin.com/in/vidura-nanayakkara
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [DEV] Can we bind custom interceptors in msf4j2.3.0-m2

2017-06-01 Thread Ishara Cooray
According to the new Interceptor support in msf4j-2.3.0-m2

AFAIU,
We can bind interceptors for a given microservice as below.

InterceptorService is the micro service that is going to be
intercepted by RequestInterceptors and Responseinterceptors annotated
by

@RequestInterceptor and @ResponseInterceptor

@Component(
> name = "InterceptorService",
> service = Microservice.class,
> immediate = true
> )@Path("/interceptor-service")public class InterceptorService implements 
> Microservice {
>
>
> private static final Logger log = 
> LoggerFactory.getLogger(InterceptorService.class);
>
>
> /** * Method for getting the micro-service name. * * @return 
> name of the micro-service. */
> @GET
> @Path("/service-name")
> @RequestInterceptor(HTTPRequestLogger.class)
> @ResponseInterceptor(HTTPResponseLogger.class)
> public String getServiceName() {
> log.info("HTTP Method Execution - getServiceName()");
> return "WSO2 Service";
> }
> }
>
> 1. Can we use @RequestInterceptor and @ResponseInterceptor annotations to
the class level so that it will apply for every resource invocation?

2. Can we plug a custom request/response interceptors?

 Can it be supported something similar to below.
 We have a class called ABCRequestInterceptor which implements
RequestInterceptor
and there can be classes that extends
 ABCRequestInterceptor

But , we bind the interceptor as

 @RequestInterceptor(ABCRequestInterceptor.class)

Will this bind extended Interceptors too to the InterceptorService?


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