On Sat, Feb 25, 2012 at 2:09 PM, Amila Jayasekara <[email protected]> wrote:

> On Sat, Feb 25, 2012 at 11:09 AM, Thilina Buddhika <[email protected]>
> wrote:
> >
> >
> > On Sat, Feb 25, 2012 at 11:04 AM, Amila Jayasekara <[email protected]>
> wrote:
> >>
> >> On Sat, Feb 25, 2012 at 10:47 AM, Thilina Buddhika <[email protected]>
> >> wrote:
> >> > Hi AmilaJ,
> >> >
> >> > The existing authentication handler and authorization handler are
> mainly
> >> > used for admin services which are exposed only thru the servlet
> >> > transport.
> >> > These handlers will not process the message, if it is not an admin
> >> > service.
> >>
> >> That is true. In the case of ESB (nhttp), are we using
> >> ServletTransport or NHTTP for admin service communication ?
> >
> >
> > In ESB, we are using Servlet transport for admin service communication.
> That
> > is mainly because of the way our Carbon core functionality is implemented
> > which is coupled with the servlet transport.
>
> Hi Thilina,
>
> In that case, i guess ESB is using NHTTP transport for admin services also.
>

This is a bug in current trunk. Predeep is fixing this. nhttp transport
does not support sessions. So
Always Admin service calls should go through the serve let transport.

In a separate note we need to completely get rid of http session based
authentication and authorisation and use Basic auth or UT.

thanks,
Amila.


> Cos, if i try to get the HTTPServletRequest i get null but if i try to
> get TRANSPORT_HEADERS i get a map of transport headers. (i believe if
> we are using servlet transport we will not get TRANSPORT_HEADER
> property within message context).
>
> Can u please point to me to exact code where we check whether it is an
> admin service and switching to servlet transport ? I tried to find it
> but couldnt find a pointer.
>
> Then i can further narrow down the issue. Also pasting the exact
> exception in [1]. Seems like stack originates from
> org.apache.synapse.transport.nhttp...
>
> Thank you
> AmilaJ
>
> [1]
>
> TID: [] [WSO2 ESB] [2012-02-24 17:25:45,228] ERROR {java.lang.Class} -
>  System failure.null {java.lang.Class}
> java.lang.NullPointerException
>        at
> org.wso2.carbon.server.admin.module.handler.AuthorizationHandler.doAuthorization(AuthorizationHandler.java:99)
>        at
> org.wso2.carbon.server.admin.module.handler.AuthorizationHandler.invoke(AuthorizationHandler.java:81)
>        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
>        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
>        at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
>        at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:662)
> TID: [] [WSO2 ESB] [2012-02-24 17:25:45,238] ERROR
> {org.apache.axis2.engine.AxisEngine} -  System failure.
> {org.apache.axis2.engine.AxisEngine}
> org.apache.axis2.AxisFault: System failure.
>        at
> org.wso2.carbon.server.admin.module.handler.AuthorizationHandler.invoke(AuthorizationHandler.java:88)
>        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
>        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
>        at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
>        at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:662)
> TID: [] [WSO2 ESB] [2012-02-24 17:25:45,239] ERROR
> {org.apache.synapse.transport.nhttp.ServerWorker} -  Error processing
> POST request  {org.apache.synapse.transport.nhttp.ServerWorker}
> org.apache.axis2.AxisFault: System failure.
>        at
> org.wso2.carbon.server.admin.module.handler.AuthorizationHandler.invoke(AuthorizationHandler.java:88)
>        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
>        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
>        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
>        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
>        at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:408)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:259)
>        at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:662)
>
>
> >
> > Thanks,
> > Thilina
> >
> >
> >> I am not getting this error for other servers (AS, IS etc ...) but
> >> only getting for ESB. Thus while debugging i found that
> >> HTTPServletRequest is null for admin service call MessageContexts in
> >> ESB. (Please see the debug screen shots attached).
> >>
> >> If we are using same servlet transport for admin service communication
> >> in ESB, how HTTPServletRequest is getting null ?
> >>
> >> Thanks
> >> AmilaJ
> >>
> >> >
> >> > So with nhttp transport, it is not required to process the message at
> >> > these
> >> > two handlers.
> >> >
> >> > Thanks,
> >> > Thilina
> >> >
> >> >
> >> > On Sat, Feb 25, 2012 at 10:35 AM, Amila Jayasekara <[email protected]>
> >> > wrote:
> >> >>
> >> >> On Sat, Feb 25, 2012 at 10:20 AM, Thilina Buddhika <
> [email protected]>
> >> >> wrote:
> >> >> > Hi Amila,
> >> >> >
> >> >> > Just for my information, Where have we used this particular code ?
> >> >>
> >> >> @Thilina,
> >> >>
> >> >> We have used code like below in AuthorizationHandler as well as in
> >> >> existing AuthetnicationHandler.
> >> >>
> >> >> @carbon-dev
> >> >> Also did we verify ESB functionality after Tomcat OSGIfication ? If
> so
> >> >> was that verification successful ? Cos, ideally a user should not be
> >> >> able to login to ESB as HttpServletRequest in message context is
> null.
> >> >> Should throw a NullpoionterException in AuthenticationHandler.
> >> >>
> >> >> Thanks
> >> >> AmilaJ
> >> >>
> >> >>
> >> >>
> >> >> >
> >> >> > Thanks,
> >> >> > Thilina
> >> >> >
> >> >> > On Fri, Feb 24, 2012 at 10:59 PM, Amila Jayasekara <
> [email protected]>
> >> >> > wrote:
> >> >> >>
> >> >> >> Hi All,
> >> >> >>
> >> >> >> For certain operations we get HttpServletRequest as follows,
> >> >> >>
> >> >> >> HttpServletRequest request = (HttpServletRequest) msgContext
> >> >> >>                .getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
> >> >> >>
> >> >> >>        HttpSession httpSession = request.getSession(false);
> >> >> >> ...
> >> >> >>
> >> >> >> But above will not be valid when it comes nhttp (ESB) transport.
> >> >> >> Thus
> >> >> >> we have logic written assuming that if HttpServletRequest is null
> >> >> >> handle request for NHTTP transport.
> >> >> >>
> >> >> >> As per current trunk if we try to get HttpServletRequest within
> ESB
> >> >> >> we
> >> >> >> get null. But the situation is different in previous releases.
> >> >> >> (3.2.2
> >> >> >> and before). So in 3.2.2 ESB if i execute above code i will get an
> >> >> >> implementation of HttpServletRequest. Thus the exact
> implementation
> >> >> >> is
> >> >> >> org.wso2.carbon.core.transports.metering.MeteredServletRequest.
> >> >> >>
> >> >> >> I believe difference between trunk and 3.2.2 is after Tomcat
> >> >> >> OSGIfication.
> >> >> >>
> >> >> >> I am bit confused about this. What should be the correct
> >> >> >> implementation here? (should HttpServletRequest be null for nhttp
> or
> >> >> >> should it have a value ?). Also how nhttp is getting a servlet
> >> >> >> request
> >> >> >> ?
> >> >> >>
> >> >> >> Due to this certain logic breaks as we get a HttpServletRequest
> >> >> >> object
> >> >> >> in NHTTP transport. (cos - we write logic thinking that
> >> >> >> HttpServletRequest is null for nhttp transport)
> >> >> >>
> >> >> >> Really appreciate your feedback as i am stuck on this.
> >> >> >>
> >> >> >> Thank you
> >> >> >> Regards,
> >> >> >> AmilaJ
> >> >> >>
> >> >> >> --
> >> >> >> Mobile : +94773330538
> >> >> >>
> >> >> >> _______________________________________________
> >> >> >> Carbon-dev mailing list
> >> >> >> [email protected]
> >> >> >> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Thilina Buddhika
> >> >> > Associate Technical Lead
> >> >> > WSO2 Inc. ; http://wso2.com
> >> >> > lean . enterprise . middleware
> >> >> >
> >> >> > phone : +94 77 44 88 727
> >> >> > blog : http://blog.thilinamb.com
> >> >> >
> >> >> > _______________________________________________
> >> >> > Carbon-dev mailing list
> >> >> > [email protected]
> >> >> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Mobile : +94773330538
> >> >> _______________________________________________
> >> >> Carbon-dev mailing list
> >> >> [email protected]
> >> >> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > Thilina Buddhika
> >> > Associate Technical Lead
> >> > WSO2 Inc. ; http://wso2.com
> >> > lean . enterprise . middleware
> >> >
> >> > phone : +94 77 44 88 727
> >> > blog : http://blog.thilinamb.com
> >> >
> >> > _______________________________________________
> >> > Carbon-dev mailing list
> >> > [email protected]
> >> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >> >
> >>
> >>
> >>
> >> --
> >> Mobile : +94773330538
> >> _______________________________________________
> >> Carbon-dev mailing list
> >> [email protected]
> >> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
> >
> >
> >
> > --
> > Thilina Buddhika
> > Associate Technical Lead
> > WSO2 Inc. ; http://wso2.com
> > lean . enterprise . middleware
> >
> > phone : +94 77 44 88 727
> > blog : http://blog.thilinamb.com
> >
> > _______________________________________________
> > Carbon-dev mailing list
> > [email protected]
> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
> >
>
>
>
> --
> Mobile : +94773330538
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>



-- 
*Amila Suriarachchi*

Software Architect
WSO2 Inc. ; http://wso2.com
lean . enterprise . middleware

phone : +94 71 3082805
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to