Re: Camel 3.0.1 Jetty HTTP Basic Authentication - configuration in a route following the doc doesn't work
I was changing my DSL as following http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> http://camel.apache.org/schema/blueprint";> http://0.0.0.0:8182/hello?handlers=securityHandler"; /> Seems that the class org.eclipse.jetty.util.security.Constraint has been replaced with org.eclipse.jetty.util.security.Constraint in Jetty9. Now I'm getting an error org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor Jean-Baptiste Onofre hat am 5. April 2020 06:58 > geschrieben: > > > Hi > > I guess the documentation is not aligned with jetty version actually used. > You are using Karaf 4.2.8 ? > > Camel jetty feature uses the jetty version provided by pax-web/karaf, so the > documentation is not maybe correct for 9.4.22/27. > > Regards > JB > > > Le 4 avr. 2020 à 10:08, Gerald Kallas a écrit : > > > > Dear community, > > > > I've configured a route as following snippet (following the documentation > > https://camel.apache.org/components/latest/jetty-component.html) > > > > http://www.osgi.org/xmlns/blueprint/v1.0.0"; > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > > xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 > > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; > > > > xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> > > > > > class="org.eclipse.jetty.http.security.Constraint"> > > > > > > > > > > > > > class="org.eclipse.jetty.security.ConstraintMapping"> > > > > > > > > > > > class="org.eclipse.jetty.security.ConstraintSecurityHandler"> > > > > > class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/> > > > > > > > > > > > > > > > > > > > xmlns="http://camel.apache.org/schema/blueprint?handlers=securityHandler";> > > > > > > http://0.0.0.0:8182/hello"; /> > > > > > > > > > > > > > > First of all I got > > > > Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] > > osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)] > > > > Seems also that the construct > > > > > > > > > > > > > > > > is wrong and has been changed from the syntax part. > > > > Could someone post a valid example for this? And .. how to resolve the > > missing bundle? > > > > Thanks in advance > > Gerald
Re: Camel 3.0.1 Jetty HTTP Basic Authentication - configuration in a route following the doc doesn't work
Hi JB, I'm using Karaf 4.2.7 w/ Camel 3.0.1 Best Gerald > Jean-Baptiste Onofre hat am 5. April 2020 06:58 > geschrieben: > > > Hi > > I guess the documentation is not aligned with jetty version actually used. > You are using Karaf 4.2.8 ? > > Camel jetty feature uses the jetty version provided by pax-web/karaf, so the > documentation is not maybe correct for 9.4.22/27. > > Regards > JB > > > Le 4 avr. 2020 à 10:08, Gerald Kallas a écrit : > > > > Dear community, > > > > I've configured a route as following snippet (following the documentation > > https://camel.apache.org/components/latest/jetty-component.html) > > > > http://www.osgi.org/xmlns/blueprint/v1.0.0"; > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > > xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 > > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; > > > > xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> > > > > > class="org.eclipse.jetty.http.security.Constraint"> > > > > > > > > > > > > > class="org.eclipse.jetty.security.ConstraintMapping"> > > > > > > > > > > > class="org.eclipse.jetty.security.ConstraintSecurityHandler"> > > > > > class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/> > > > > > > > > > > > > > > > > > > > xmlns="http://camel.apache.org/schema/blueprint?handlers=securityHandler";> > > > > > > http://0.0.0.0:8182/hello"; /> > > > > > > > > > > > > > > First of all I got > > > > Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] > > osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)] > > > > Seems also that the construct > > > > > > > > > > > > > > > > is wrong and has been changed from the syntax part. > > > > Could someone post a valid example for this? And .. how to resolve the > > missing bundle? > > > > Thanks in advance > > Gerald
Re: Camel 3.0.1 Jetty HTTP Basic Authentication - configuration in a route following the doc doesn't work
Hi I guess the documentation is not aligned with jetty version actually used. You are using Karaf 4.2.8 ? Camel jetty feature uses the jetty version provided by pax-web/karaf, so the documentation is not maybe correct for 9.4.22/27. Regards JB > Le 4 avr. 2020 à 10:08, Gerald Kallas a écrit : > > Dear community, > > I've configured a route as following snippet (following the documentation > https://camel.apache.org/components/latest/jetty-component.html) > > http://www.osgi.org/xmlns/blueprint/v1.0.0"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; > > xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> > >class="org.eclipse.jetty.http.security.Constraint"> > > > > > >class="org.eclipse.jetty.security.ConstraintMapping"> > > > > >class="org.eclipse.jetty.security.ConstraintSecurityHandler"> > >class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/> > > > > > > > > >xmlns="http://camel.apache.org/schema/blueprint?handlers=securityHandler";> > > > http://0.0.0.0:8182/hello"; /> > > > > > > > First of all I got > > Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] > osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)] > > Seems also that the construct > > > > > > > > is wrong and has been changed from the syntax part. > > Could someone post a valid example for this? And .. how to resolve the > missing bundle? > > Thanks in advance > Gerald
Re: Camel 3.0.1 Jetty HTTP Basic Authentication - configuration in a route following the doc doesn't work
You just need to install corresponding osgi bundle which has the missing dependency into the karaf Just Google around for that particular osgi dependency. You can use command "osgi:install " Btw, this question should be posted on forums for fuse or service mix Cheers Reji On Sat, 4 Apr 2020, 04:08 Gerald Kallas, wrote: > Dear community, > > I've configured a route as following snippet (following the documentation > https://camel.apache.org/components/latest/jetty-component.html) > > http://www.osgi.org/xmlns/blueprint/v1.0.0"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; > xmlns:ext=" > http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> > > class="org.eclipse.jetty.http.security.Constraint"> > > > > > > class="org.eclipse.jetty.security.ConstraintMapping"> > > > > > class="org.eclipse.jetty.security.ConstraintSecurityHandler"> > > class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/> > > > > > > > > > http://camel.apache.org/schema/blueprint?handlers=securityHandler";> > > > http://0.0.0.0:8182/hello"; /> > > > > > > > First of all I got > > Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] > osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)] > > Seems also that the construct > > > > > > > > is wrong and has been changed from the syntax part. > > Could someone post a valid example for this? And .. how to resolve the > missing bundle? > > Thanks in advance > Gerald >
Camel 3.0.1 Jetty HTTP Basic Authentication - configuration in a route following the doc doesn't work
Dear community, I've configured a route as following snippet (following the documentation https://camel.apache.org/components/latest/jetty-component.html) http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"; xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0";> http://camel.apache.org/schema/blueprint?handlers=securityHandler";> http://0.0.0.0:8182/hello"; /> First of all I got Unresolved requirements: [[WEBISP001.xml [264](R 264.12)] osgi.wiring.package; (osgi.wiring.package=org.eclipse.jetty.http.security)] Seems also that the construct is wrong and has been changed from the syntax part. Could someone post a valid example for this? And .. how to resolve the missing bundle? Thanks in advance Gerald
Re: HTTP Basic Authentication
Hello, Are you using the http component? http://camel.apache.org/http.html There is a section on authentication there. Example: from("http://examples.com/rest/hello?"; + "authMethod=Basic" + "&authUsername=User" + "&authPassword=Password") .to("mock:answer"); On Thu, Oct 1, 2015 at 1:29 PM, zied123456 wrote: > Hello, > I try to send request to a webservice with camel and i dont found how to > set > httplogin and httppass with > POJO i can do this: > > final String s = my_httpLogin+":"+my_httpPwd; > final byte[] authBytes = s.getBytes(StandardCharsets.UTF_8); > final String encoded = Base64.getEncoder().encodeToString(authBytes); > > and i set it in the header like this: > > con.setRequestProperty("Authorization", "Basic " + encoded); > > How can i do this with Camel Route ? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5772150.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Kind regards Joakim Bjørnstad
Re: HTTP Basic Authentication
Hello, I try to send request to a webservice with camel and i dont found how to set httplogin and httppass with POJO i can do this: final String s = my_httpLogin+":"+my_httpPwd; final byte[] authBytes = s.getBytes(StandardCharsets.UTF_8); final String encoded = Base64.getEncoder().encodeToString(authBytes); and i set it in the header like this: con.setRequestProperty("Authorization", "Basic " + encoded); How can i do this with Camel Route ? -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5772150.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Please setup the option of httpClient.authenticationPreemptive to be true. You can find more information here[1] by searching authenticationPreemptive. [1]https://camel.apache.org/http -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On October 30, 2014 at 2:52:55 AM, sharathbabuk (sharathba...@hotmail.com) wrote: > The preemptive authentication with HTTPS does not seem to work with > "Camel-Http" > It works only with "camel-http4" > > But I have a limitation on my container ( websphere application server 7.x ) > so cannot use "camel-http4" - does anyone know if this should work with > "camel-http" ?? > > == here is my camel XML DSL == > > > > > > password="{{ssl.store.pass}}" /> > > > > > POST > > > application/json > > > > uri="https:{{host}}{{auditWs.url}}?sslContextParameters=sslContextParameters%26authUsername={{auditWsAuthUsername}}%26authPassword={{auditWsAuthPassword}}%26authenticationPreemptive=true%26bridgeEndpoint=true%26throwExceptionOnFailure=false" > > > > === > I get a 401 ERROR when I use "camel-http" > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5758314.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: HTTP Basic Authentication
The preemptive authentication with HTTPS does not seem to work with "Camel-Http" It works only with "camel-http4" But I have a limitation on my container ( websphere application server 7.x ) so cannot use "camel-http4" - does anyone know if this should work with "camel-http" ?? == here is my camel XML DSL == POST application/json http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5758314.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Which version of Camel are you using? Can you try the latest release Camel 2.13.2? If I remember right, there is an issue of setting up the camel-cxfrs endpoint interceptors which was fixed recently. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 12, 2014 at 1:54:48 PM, sayed_india (sayed.abdulis...@gmail.com) wrote: > Hello, > Sorry I was referring to the Java Interceptor code above mentioned which > works fine for CXF SOAP. > > Cann't we make it for CXF-REST? > > Thanks, > Sayed > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756392.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: HTTP Basic Authentication
Hello, Sorry I was referring to the Java Interceptor code above mentioned which works fine for CXF SOAP. Cann't we make it for CXF-REST? Thanks, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756392.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Hello, Thanks a lot for the response.Will try and let you know. please share a sample code snippet. However the same code works for me at server side for CXF-SOAP so why not for CXF-REST ? Regards, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756346.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
The configuration only work for the client side, if you want to enable the HTTP Basic Authentication on the server side, you need to setup the Jetty ServletContextHandler for it. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 9, 2014 at 1:26:41 PM, sayed_india (sayed.abdulis...@gmail.com) wrote: > Hello, > > Pls find below my query of CXF-RS with Basic authentication: > > public void configure() throws Exception { > System.out.println("inside route"); > Map properties = new HashMap(); > AuthorizationPolicy authPolicy = new AuthorizationPolicy(); > authPolicy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_BASIC); > authPolicy.setUserName("test"); > authPolicy.setPassword("test"); > authPolicy.setAuthorization("true"); > > // properties.put(AuthorizationPolicy.class.getName(), authPolicy); > > properties.put("org.apache.cxf.configuration.security.AuthorizationPolicy", > authPolicy); > > CxfRsEndpoint myCxfEp = > (CxfRsEndpoint)getContext().getEndpoint("cxfrs:http://0.0.0.0:9090?resourceClasses=com.test.CompanyService&bindingStyle=SimpleConsumer";); > > myCxfEp.configureProperties(properties); > from(myCxfEp) > > ... > > I have tested it using SOAPUI doesn't ask for any authentication. > > Please suggest .. > > Thanks, > Sayed > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756208.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: HTTP Basic Authentication
Hello, Pls find below my query of CXF-RS with Basic authentication: public void configure() throws Exception { System.out.println("inside route"); Map properties = new HashMap(); AuthorizationPolicy authPolicy = new AuthorizationPolicy(); authPolicy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_BASIC); authPolicy.setUserName("test"); authPolicy.setPassword("test"); authPolicy.setAuthorization("true"); // properties.put(AuthorizationPolicy.class.getName(), authPolicy); properties.put("org.apache.cxf.configuration.security.AuthorizationPolicy", authPolicy); CxfRsEndpoint myCxfEp = (CxfRsEndpoint)getContext().getEndpoint("cxfrs:http://0.0.0.0:9090?resourceClasses=com.test.CompanyService&bindingStyle=SimpleConsumer";); myCxfEp.configureProperties(properties); from(myCxfEp) ... I have tested it using SOAPUI doesn't ask for any authentication. Please suggest .. Thanks, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756208.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Hello Experts, Pls share me the CXF-REST code reference to use the above Java Authentication: Not getting an idea how to include this BasicAuthAuthorizationInterceptor in REST end point either in Spring or Java DSL: Spring End point: http://localhost:9090?resourceClasses=com.test.Service"/> Java End Point: from("cxfrs:http://0.0.0.0:9090?resourceClasses=com.test.Service&bindingStyle=SimpleConsumer";).. Need a quick solution. Thanks and Regards, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756154.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Hello, I tried with the code shared ,seems working fine at server end for CXF-SOAP as tested through SOAPUI tool. Please share the code for CXF REST Service. However I need a Java client to call the service. Tried many options but gives me errors. Please send me a sample Java main client to test the authentication. My CXF end point declaration: http://localhost:9050/service/EmployeeDetailsService"; serviceClass="in.ns.com.EmployeeDetailsPort" wsdlURL="META-INF/wsdl/webservice.wsdl" > - java client: -- public static void main(String[] args) throws Exception { URL url = new URL(WS_URL); QName qname = new QName("http://com.ns.in";, "EmployeeDetailsPortService"); Service service = Service.create(url, qname); EmployeeDetailsPort hello = service.getPort(EmployeeDetailsPort.class); BindingProvider port =(BindingProvider)service.getPort(EmployeeDetailsPort.class); port.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user-id"); port.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "test"); System.out.println(hello.employeeDetailsOpr( new FindEmpRequest("123"))); Error:Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: A WebService annotation is not present on class: in.ns.com.EmployeeDetailsPort Thanks and regards, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756117.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
One thing should be point out, CXF uses Http URL Connector which is from JDK by default. If you are using CXF 2.7.x and enable the async http client setting, it will use the Apache Http Client 4.x to send the request. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, October 29, 2013 at 6:46 PM, alexey-s wrote: > You'll be surprised. CXF uses the same library Apache HttpComponents. > CXF client initially twice sends an HTTP request. The first request without > authorization. Second with authorization. > > For a GET request such behavior is acceptable. For a POST request is very > bad. > > > Aleksey > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742348.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
RE: HTTP Basic Authentication
Rules of the game sets the other side - http server. Two requests are always bad, whether it's on an external authentication server, or proxy server. It is necessary to send a file size of 1 MByte. Length of HTTP request is about 1.3 MByte. Two queries will give 2.6 MByte. Aleksey -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742354.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: HTTP Basic Authentication
Hi, it happens by design: " Generally, preemptive authentication can be considered less * secure than a response to an authentication challenge * and therefore discouraged." (see https://hc.apache.org/httpcomponents-client-4.3.x/httpclient/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java) Regards, Tom -Original Message- From: alexey-s [mailto:alex...@mail.ru] Sent: Dienstag, 29. Oktober 2013 11:47 To: users@camel.apache.org Subject: Re: HTTP Basic Authentication You'll be surprised. CXF uses the same library Apache HttpComponents. CXF client initially twice sends an HTTP request. The first request without authorization. Second with authorization. For a GET request such behavior is acceptable. For a POST request is very bad. Aleksey -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742348.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
You'll be surprised. CXF uses the same library Apache HttpComponents. CXF client initially twice sends an HTTP request. The first request without authorization. Second with authorization. For a GET request such behavior is acceptable. For a POST request is very bad. Aleksey -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742348.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
I just captured the http request and response and found some thing interesting. When camel-http send the request to back end server which is protected with HTTP Basic Authentication, HttpClient sends a request without Authentication inform first, then it sends the request with the Authentication header when it get the 401 response. If you just want to camel-http send the request with the Authentication header, you can set url like this. from("direct:endpoint").to("http://localhost:8081?authMethod=Basic&authUsername=user1&authPassword=pwd&httpClient.authenticationPreemptive=true";); -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, October 29, 2013 at 5:13 PM, Willem jiang wrote: > I did a quick test with the camel trunk ( I think it’s same with last camel > release 2.12.1), the HTTP Basic Authentication setting is work out of box. > > from("direct:endpoint").to("http://localhost:8081?authMethod=Basic&authUsername=user1&authPassword=pwd”); > > I think you need to double check if the authPassword setting, It should be a > plaint text. > > -- > Willem Jiang > > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > > > On Tuesday, October 29, 2013 at 1:03 AM, martin11 wrote: > > > Hi Christian, > > > > I tried to use HTTP auth options: > > > > .to("http://{{server}}:{{port}}/{{address}}?authMethod=Basic&authUsername={{user}}&authPassword={{password}}";) > > > > But it fails again: > > > > INFO - Basic authentication scheme selected > > DEBUG - Took 1889 millis to send to: > > Endpoint[http://172.24.40.110:5985/wsman?authMethod=Basic&authPassword=**&authUsername=Administrator] > > INFO - basic authentication scheme selected > > INFO - No credentials available for BASIC 'WSMAN'@172.24.40.110:5985 > > DEBUG - Took 45 millis to send to: Endpoint[http://172.24.40.110:5985/wsman] > > ERROR - Failed delivery for (MessageId: ID-asgard-47899-1382979475336-0-11 > > on ExchangeId: ID-asgard-47899-1382979475336-0-9). Exhausted after delivery > > attempt: 1 caught: > > org.apache.camel.component.http.HttpOperationFailedException: HTTP operation > > failed invoking http://172.24.40.110:5985/wsman with statusCode: 401 > > > > > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742320.html > > Sent from the Camel - Users mailing list archive at Nabble.com > > (http://Nabble.com). > > > >
Re: HTTP Basic Authentication
I did a quick test with the camel trunk ( I think it’s same with last camel release 2.12.1), the HTTP Basic Authentication setting is work out of box. from("direct:endpoint").to("http://localhost:8081?authMethod=Basic&authUsername=user1&authPassword=pwd”); I think you need to double check if the authPassword setting, It should be a plaint text. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, October 29, 2013 at 1:03 AM, martin11 wrote: > Hi Christian, > > I tried to use HTTP auth options: > > .to("http://{{server}}:{{port}}/{{address}}?authMethod=Basic&authUsername={{user}}&authPassword={{password}}";) > > But it fails again: > > INFO - Basic authentication scheme selected > DEBUG - Took 1889 millis to send to: > Endpoint[http://172.24.40.110:5985/wsman?authMethod=Basic&authPassword=**&authUsername=Administrator] > INFO - basic authentication scheme selected > INFO - No credentials available for BASIC 'WSMAN'@172.24.40.110:5985 > DEBUG - Took 45 millis to send to: Endpoint[http://172.24.40.110:5985/wsman] > ERROR - Failed delivery for (MessageId: ID-asgard-47899-1382979475336-0-11 > on ExchangeId: ID-asgard-47899-1382979475336-0-9). Exhausted after delivery > attempt: 1 caught: > org.apache.camel.component.http.HttpOperationFailedException: HTTP operation > failed invoking http://172.24.40.110:5985/wsman with statusCode: 401 > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742320.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com). >
Re: HTTP Basic Authentication
Hi Christian, I tried to use HTTP auth options: .to("http://{{server}}:{{port}}/{{address}}?authMethod=Basic&authUsername={{user}}&authPassword={{password}}";) But it fails again: INFO - Basic authentication scheme selected DEBUG - Took 1889 millis to send to: Endpoint[http://172.24.40.110:5985/wsman?authMethod=Basic&authPassword=**&authUsername=Administrator] INFO - basic authentication scheme selected INFO - No credentials available for BASIC 'WSMAN'@172.24.40.110:5985 DEBUG - Took 45 millis to send to: Endpoint[http://172.24.40.110:5985/wsman] ERROR - Failed delivery for (MessageId: ID-asgard-47899-1382979475336-0-11 on ExchangeId: ID-asgard-47899-1382979475336-0-9). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http://172.24.40.110:5985/wsman with statusCode: 401 -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5742320.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Martin is using the http component, not the CXF component... Did you checked [1]? You can set the auth options per endpoint. [1] http://camel.apache.org/http.html Best, Christian - Software Integration Specialist Apache Member V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer Apache Incubator PMC Member https://www.linkedin.com/pub/christian-mueller/11/551/642 On Sat, Oct 26, 2013 at 5:44 AM, contactreji wrote: > Hi > > I used a interceptor approach. The java code for interceptor is as follows > > *package outotec.com.mes.bw.copper_recovery_perc;* > *import java.io.IOException;* > *import java.io.OutputStream;* > *import java.net.HttpURLConnection;* > *import java.util.Arrays;* > *import java.util.List;* > *import java.util.Map;* > *import org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;* > *import org.apache.cxf.configuration.security.AuthorizationPolicy;* > *import org.apache.cxf.endpoint.Endpoint;* > *import org.apache.cxf.interceptor.Fault;* > *import org.apache.cxf.message.Exchange;* > *import org.apache.cxf.message.Message;* > *import org.apache.cxf.transport.Conduit;* > *import org.apache.cxf.ws.addressing.EndpointReferenceType;* > *import org.apache.log4j.Logger;* > *import org.springframework.beans.factory.annotation.Required;* > * > * > */*** > * * CXF Interceptor that provides HTTP Basic Authentication validation.* > * * * > * * Based on the concepts outline here:* > * * > http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication* > * ** > * * @author CDail* > * */* > *public class BasicAuthAuthorizationInterceptor extends > SoapHeaderInterceptor {* > * > * > *protected Logger log = Logger.getLogger(getClass());* > ** > */** Map of allowed users to this system with their corresponding > passwords. */* > *private Map users;* > ** > *@Required* > *public void setUsers(Map users) {* > *this.users = users;* > *}* > ** > *@Override public void handleMessage(Message message) throws Fault {* > *// This is set by CXF* > *AuthorizationPolicy policy = > message.get(AuthorizationPolicy.class);* > ** > *// If the policy is not set, the user did not specify credentials* > *// A 401 is sent to the client to indicate that authentication is > required* > *if (policy == null) {* > *if (log.isDebugEnabled()) {* > *log.debug("User attempted to log in with no > credentials");* > *}* > *sendErrorResponse(message, > HttpURLConnection.HTTP_UNAUTHORIZED);* > *return;* > *}* > ** > *if (log.isDebugEnabled()) {* > *log.debug("Logging in use: " + policy.getUserName());* > *}* > ** > *// Verify the password* > *String realPassword = users.get(policy.getUserName());* > *if (realPassword == null || > !realPassword.equals(policy.getPassword())) {* > *log.error("Invalid username or password for user: " + > policy.getUserName());* > * * > *sendErrorResponse(message, HttpURLConnection.HTTP_FORBIDDEN);* > *}* > *}* > ** > *private void sendErrorResponse(Message message, int responseCode) {* > *Message outMessage = getOutMessage(message);* > *outMessage.put(Message.RESPONSE_CODE, responseCode);* > ** > *// Set the response headers* > *Map> responseHeaders =* > *(Map List>)message.get(Message.PROTOCOL_HEADERS);* > *if (responseHeaders != null) {* > *responseHeaders.put("WWW-Authenticate", Arrays.asList(new > String[]{"Basic realm=realm"}));* > *responseHeaders.put("Content-Length", Arrays.asList(new > String[]{"0"}));* > *}* > *message.getInterceptorChain().abort();* > *try {* > *getConduit(message).prepare(outMessage);* > *close(outMessage);* > *} catch (IOException e) {* > *log.warn(e.getMessage(), e);* > *}* > *}* > ** > *private Message getOutMessage(Message inMessage) {* > *Exchange exchange = inMessage.getExchange();* > *Message outMessage = exchange.getOutMessage();* > *if (outMessage == null) {* > *Endpoint endpoint = exchange.get(Endpoint.class);* > *outMessage = endpoint.getBinding().createMessage();* > *exchange.setOutMessage(outMessage);* > *}* > *outMessage.putAll(inMessage);* > *return outMessage;* &
Re: HTTP Basic Authentication
Hi I used a interceptor approach. The java code for interceptor is as follows *package outotec.com.mes.bw.copper_recovery_perc;* *import java.io.IOException;* *import java.io.OutputStream;* *import java.net.HttpURLConnection;* *import java.util.Arrays;* *import java.util.List;* *import java.util.Map;* *import org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor;* *import org.apache.cxf.configuration.security.AuthorizationPolicy;* *import org.apache.cxf.endpoint.Endpoint;* *import org.apache.cxf.interceptor.Fault;* *import org.apache.cxf.message.Exchange;* *import org.apache.cxf.message.Message;* *import org.apache.cxf.transport.Conduit;* *import org.apache.cxf.ws.addressing.EndpointReferenceType;* *import org.apache.log4j.Logger;* *import org.springframework.beans.factory.annotation.Required;* * * */*** * * CXF Interceptor that provides HTTP Basic Authentication validation.* * * * * * Based on the concepts outline here:* * * http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication* * ** * * @author CDail* * */* *public class BasicAuthAuthorizationInterceptor extends SoapHeaderInterceptor {* * * *protected Logger log = Logger.getLogger(getClass());* ** */** Map of allowed users to this system with their corresponding passwords. */* *private Map users;* ** *@Required* *public void setUsers(Map users) {* *this.users = users;* *}* ** *@Override public void handleMessage(Message message) throws Fault {* *// This is set by CXF* *AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);* ** *// If the policy is not set, the user did not specify credentials* *// A 401 is sent to the client to indicate that authentication is required* *if (policy == null) {* *if (log.isDebugEnabled()) {* *log.debug("User attempted to log in with no credentials");* *}* *sendErrorResponse(message, HttpURLConnection.HTTP_UNAUTHORIZED);* *return;* *}* ** *if (log.isDebugEnabled()) {* *log.debug("Logging in use: " + policy.getUserName());* *}* ** *// Verify the password* *String realPassword = users.get(policy.getUserName());* *if (realPassword == null || !realPassword.equals(policy.getPassword())) {* *log.error("Invalid username or password for user: " + policy.getUserName());* * * *sendErrorResponse(message, HttpURLConnection.HTTP_FORBIDDEN);* *}* *}* ** *private void sendErrorResponse(Message message, int responseCode) {* *Message outMessage = getOutMessage(message);* *outMessage.put(Message.RESPONSE_CODE, responseCode);* ** *// Set the response headers* *Map> responseHeaders =* *(Map>)message.get(Message.PROTOCOL_HEADERS);* *if (responseHeaders != null) {* *responseHeaders.put("WWW-Authenticate", Arrays.asList(new String[]{"Basic realm=realm"}));* *responseHeaders.put("Content-Length", Arrays.asList(new String[]{"0"}));* *}* *message.getInterceptorChain().abort();* *try {* *getConduit(message).prepare(outMessage);* *close(outMessage);* *} catch (IOException e) {* *log.warn(e.getMessage(), e);* *}* *}* ** *private Message getOutMessage(Message inMessage) {* *Exchange exchange = inMessage.getExchange();* *Message outMessage = exchange.getOutMessage();* *if (outMessage == null) {* *Endpoint endpoint = exchange.get(Endpoint.class);* *outMessage = endpoint.getBinding().createMessage();* *exchange.setOutMessage(outMessage);* *}* *outMessage.putAll(inMessage);* *return outMessage;* *}* ** *private Conduit getConduit(Message inMessage) throws IOException {* *Exchange exchange = inMessage.getExchange();* *EndpointReferenceType target = exchange.get(EndpointReferenceType.class);* *Conduit conduit =* *exchange.getDestination().getBackChannel(inMessage, null, target);* *exchange.setConduit(conduit);* *return conduit;* *}* ** *private void close(Message outMessage) throws IOException {* *OutputStream os = outMessage.getContent(OutputStream.class);* *os.flush();* *os.close();* *}* *}* And I configured my endpoint (in my case, its a web service CXF endpoint) as shown below. * * *http://10.43.25.123:8181/mes/myWebserviceEndPoint"* * serviceClass="my.package.serviceClassImpl"* * wsdlURL="wsdl/myWSDL.wsdl"* * serviceName="p1:serviceNameFromWsdl"* * xmlns:p1="my.sample.webservice.wsdl.targetNamespace" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soa
HTTP Basic Authentication
Hello, I`m trying to set BASIC Authentication on HTTP component (camel ver. 2.11.0). I know that I can use header settings like this one: .setHeader("Authorization", constant("Basic base64string")) and it works fine. But I`m looking for more elegant way to setup basic auth. Something like in CXF spring bean and http:authorization properties. - 1st test --- So I tried to use HttpClientConfigurer: and in route: .to("http://{{server}}:{{port}}/{{address}}?httpClientConfigurerRef=myHttpConfig";) I got an error: INFO - basic authentication scheme selected INFO - No credentials available for BASIC 'WSMAN'@172.24.40.110:5985 org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http://172.24.40.110:5985/wsman with statusCode: 401 Why is not set BASIC credentials? - 2nd test --- I also try other way: and in route: .to("http://{{server}}:{{port}}/{{address}}";) I got an error: INFO - Basic authentication scheme selected java.io.IOException: Server returned HTTP response code: 400 for URL: http://172.24.40.110:5985/wsman What is the correct configuration for http basic authentication? Thanks for any advice. -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
t; definitions from URL [bundle://324.0:0/META-INF/spring/camel-cxf.xml] > 09:34:15,741 | ERROR | xtenderThread-36 | ContextLoaderListener > | > 113 - org.springframework.osgi.extender - 1.2.1 | Application context > refresh failed > > (OsgiBundleXmlApplicationContext(bundle=com.outotec.mes-bw-copper_recovery_perc_ssl, > config=osgibundle:/META-INF/spring/*.xml)) > org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line > 39 in XML document from URL > [bundle://324.0:0/META-INF/spring/camel-cxf.xml] > is invalid; nested exception is org.xml.sax.SAXParseException: > cvc-datatype-valid.1.2.3: > '{http://es0sreao:8181/mes/bw/MEStoBW_CopperRecoveryPercentage_JAAS}.8181' > is not a valid value of union type 'ParameterizedInt'. > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)[105:org.springframework.beans:3.0.7.RELEASE] > at > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[105:org.springframework.beans:3.0.7.RELEASE] > * > > Could you please let me know what is the exact value to be entered for > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738725.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: camel-cxf and HTTP BASIC authentication
Hi Christian I have followed your steps and made my coade as follows * http://server:8181/mes/bw/Service_Endpoint"; serviceClass="company.pi.mes.id56.copperrecovery.ImplementationClass" wsdlURL="wsdl/myWSDL.wsdl" serviceName="p1:ServiceClasses" endpointName="p1:HTTPS_Port" xmlns:p1="urn:company:pi:mes:id56:Task" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; /> http://es0sreao:8181/mes/bw/Service_Endpoint}.8181";> .*.* .*40_.* .*_RSA_WITH_DES_CBC_SHA.* .*_RSA_WITH_3DES_EDE_CBC_SHA.* org.apache.karaf.jaas.modules.RolePrincipal * While deployment I am getting following exception in log * 09:34:15,721 | INFO | xtenderThread-36 | XmlBeanDefinitionReader | 105 - org.springframework.beans - 3.0.7.RELEASE | Loading XML bean definitions from URL [bundle://324.0:0/META-INF/spring/camel-cxf.xml] 09:34:15,741 | ERROR | xtenderThread-36 | ContextLoaderListener| 113 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.outotec.mes-bw-copper_recovery_perc_ssl, config=osgibundle:/META-INF/spring/*.xml)) org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 39 in XML document from URL [bundle://324.0:0/META-INF/spring/camel-cxf.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.3: '{http://es0sreao:8181/mes/bw/MEStoBW_CopperRecoveryPercentage_JAAS}.8181' is not a valid value of union type 'ParameterizedInt'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)[105:org.springframework.beans:3.0.7.RELEASE] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[105:org.springframework.beans:3.0.7.RELEASE] * Could you please let me know what is the exact value to be entered for -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738725.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
Hi Christain.. Could you please guide us with the details of dependencies added. Would be really helpful fi you could post the copy of your POM file. Reji -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738715.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
We use the following engine factory configuration to configure our Jetty server (placed in our bundle-context.xml Spring DM configuration) .*.* .*40_.* .*_RSA_WITH_DES_CBC_SHA.* .*_RSA_WITH_3DES_EDE_CBC_SHA.* In our bundle-context-osgi Spring DM configuration which is used in Karaf, we defined the "securityHandler" as following: org.apache.karaf.jaas.modules.RolePrincipal Edit the ${KARAF_HOME}/etc/users.properties file and add the user: user=password,our-role-name For our unit tests, we are using a different "securityHandler" configuration: The "jetty-realm.properties" fooks like this one: user: password,our-role-name We are creating our test client like this one: String url = "https://localhost:7071/foo/services/BarService";; List> outInterceptors = new ArrayList>(); LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor(); outInterceptors.add(loggingOutInterceptor); JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setBus(BusFactory.getDefaultBus()); factory.setOutInterceptors(outInterceptors); factory.setServiceClass(SemprisEaiAIG.class); factory.setAddress(url); factory.setUsername("user"); factory.setPassword("password"); BarService serviceClient = (BarService) factory.create(); serviceClient.doSomething(...); Hope this helps. Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Mon, Sep 2, 2013 at 10:02 PM, Christian Müller < christian.muel...@gmail.com> wrote: > Yes, we got it working. I can post the relevant code snippets here > tomorrow. > > Best, > Christian > - > > Software Integration Specialist > > Apache Camel committer: https://camel.apache.org/team > V.P. Apache Camel: https://www.apache.org/foundation/ > Apache Member: https://www.apache.org/foundation/members.html > > https://www.linkedin.com/pub/christian-mueller/11/551/642 > > > On Tue, Aug 27, 2013 at 9:00 PM, contactreji wrote: > >> Hi Christian.. did you get a work around the problem? >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738071.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> > >
Re: camel-cxf and HTTP BASIC authentication
Yes, we got it working. I can post the relevant code snippets here tomorrow. Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Tue, Aug 27, 2013 at 9:00 PM, contactreji wrote: > Hi Christian.. did you get a work around the problem? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738071.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: camel-cxf and HTTP BASIC authentication
Hi Christian.. did you get a work around the problem? -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738071.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Thanks for the reply. The problem got resolved after adding httpClient.authenticationPreemptive=true -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5729500p5729680.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Hi Not sure if you can configure the http client to follow redirects, that may allow the http client to detect the redirect and provide the credentials for basic auth after the redirect. On Wed, Mar 20, 2013 at 1:37 PM, cgsk wrote: > Hi There, > > I am using Jetty endpoint exposed which invokes a external service using > HTTP component and the external service requires a Basic Auth. So I am > passing the query parameters as below: > > bridgeEndpoint=true&authMethod=Basic&throwExceptionOnFailure=false&authUsername=username&authPassword=authPassword > > It works fine in Firefox, but when invoked using Chrome, it discards the > Basic auth params and it does a retry again with Basic Auth params added in > the retry call. Any idea about why there is difference in Chrome compared to > Firefox? Do we need add any additional param in camel http call to handle > this? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5729500.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: camel-cxf and HTTP BASIC authentication
Thank you all for your valuable suggestions. I will try it out and report back. Best, Christian On Wed, Jul 18, 2012 at 9:07 AM, Willem Jiang wrote: > Hi Christian, > > I'm afraid you have configure the interceptor yourself, or write some > configuration to setup Jetty server as others show you. > > If you are using ServiceMix you can try out the Sergey shows > JAASLoginInterceptor, and setup right context name for you to use. > > Here is an configuration[1] which is shows in Blueprint, but I think you > can use it in Spring at same time. > > [1]https://github.com/**fusesource/fuse/blob/master/** > examples/secure-rest/src/main/**resources/OSGI-INF/blueprint/** > blueprint.xml<https://github.com/fusesource/fuse/blob/master/examples/secure-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml> > > > On 7/18/12 5:30 AM, Christian Müller wrote: > >> Thanks Yogesh for taking time for my question. >> >> The information in [1] only helps for the client site (unit testing), but >> I >> have to provide this service (the server part). >> The information in [2] and [3] are useful how to implement such kind of >> CXF >> interceptor, but I still hope there is an existing solution in CXF or >> Jetty >> which doesn't force me to implement this. May be only a simple >> PasswordCallback or so... >> >> [1] >> http://cxf.apache.org/docs/**client-http-transport-** >> including-ssl-support.html<http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html> >> [2] >> http://chrisdail.com/2008/03/**31/apache-cxf-with-http-basic-** >> authentication/<http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/> >> [3] >> http://chrisdail.com/2008/08/**13/http-basic-authentication-** >> with-apache-cxf-revisited/<http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/> >> >> Best, >> Christian >> >> On Tue, Jul 17, 2012 at 9:45 PM, ychawla ** >> wrote: >> >> Hi Christian, >>> What about adding an HTTP Conduit to your CXF bean? >>> >>> http://cxf.apache.org/docs/**client-http-transport-** >>> including-ssl-support.html<http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html> >>> >>> Is your requirement for inbound or outbound HTTP basic auth? Depending >>> on >>> your container, you might be able to do this at the Apache HTTPD or >>> Tomcat >>> layer as well. >>> >>> Thanks, >>> Yogesh >>> >>> -- >>> View this message in context: >>> http://camel.465427.n5.nabble.**com/camel-cxf-and-HTTP-BASIC-** >>> authentication-**tp5716163p5716169.html<http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html> >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> > > -- > Willem > --** > FuseSource > Web: http://www.fusesource.com > Blog: > http://willemjiang.blogspot.**com<http://willemjiang.blogspot.com>(English) > http://jnn.javaeye.com (Chinese) > Twitter: willemjiang > Weibo: willemjiang > > >
Re: camel-cxf and HTTP BASIC authentication
Hi Christian, I'm afraid you have configure the interceptor yourself, or write some configuration to setup Jetty server as others show you. If you are using ServiceMix you can try out the Sergey shows JAASLoginInterceptor, and setup right context name for you to use. Here is an configuration[1] which is shows in Blueprint, but I think you can use it in Spring at same time. [1]https://github.com/fusesource/fuse/blob/master/examples/secure-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml On 7/18/12 5:30 AM, Christian Müller wrote: Thanks Yogesh for taking time for my question. The information in [1] only helps for the client site (unit testing), but I have to provide this service (the server part). The information in [2] and [3] are useful how to implement such kind of CXF interceptor, but I still hope there is an existing solution in CXF or Jetty which doesn't force me to implement this. May be only a simple PasswordCallback or so... [1] http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html [2] http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ [3] http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ Best, Christian On Tue, Jul 17, 2012 at 9:45 PM, ychawla wrote: Hi Christian, What about adding an HTTP Conduit to your CXF bean? http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html Is your requirement for inbound or outbound HTTP basic auth? Depending on your container, you might be able to do this at the Apache HTTPD or Tomcat layer as well. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang
Re: camel-cxf and HTTP BASIC authentication
Are you using a pax-web based endpoint (address like "/foo") or a full CXF controlled Jetty port? (http://0.0.0.0:8080/foo) For the former, you'd have to look into how you can configure the pax-web stuff. I'm not really sure. For the latter, you would need to configure stuff into the jetty instance. You can use one of the CXF system tests as an example: http://svn.apache.org/repos/asf/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http_jetty/ See the jettyBasicAuthServer.xml and jetty-realm.properties files as examples. That said, not sure how will that would work in OSGi. Dan On Tuesday, July 17, 2012 11:30:29 PM Christian Müller wrote: > Thanks Yogesh for taking time for my question. > > The information in [1] only helps for the client site (unit testing), but > I have to provide this service (the server part). > The information in [2] and [3] are useful how to implement such kind of > CXF interceptor, but I still hope there is an existing solution in CXF or > Jetty which doesn't force me to implement this. May be only a simple > PasswordCallback or so... > > [1] > http://cxf.apache.org/docs/client-http-transport-including-ssl-support.htm > l [2] > http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ > [3] > http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf- > revisited/ > > Best, > Christian > > On Tue, Jul 17, 2012 at 9:45 PM, ychawla wrote: > > Hi Christian, > > What about adding an HTTP Conduit to your CXF bean? > > > > http://cxf.apache.org/docs/client-http-transport-including-ssl-support.h > > tml > > > > Is your requirement for inbound or outbound HTTP basic auth? Depending > > on your container, you might be able to do this at the Apache HTTPD or > > Tomcat layer as well. > > > > Thanks, > > Yogesh > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authenticatio > > n-tp5716163p5716169.html Sent from the Camel - Users mailing list > > archive at Nabble.com. -- Daniel Kulp dk...@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
Re: camel-cxf and HTTP BASIC authentication
Hi On 17/07/12 22:30, Christian Müller wrote: Thanks Yogesh for taking time for my question. The information in [1] only helps for the client site (unit testing), but I have to provide this service (the server part). The information in [2] and [3] are useful how to implement such kind of CXF interceptor, but I still hope there is an existing solution in CXF or Jetty which doesn't force me to implement this. May be only a simple PasswordCallback or so... May be JAASLoginInterceptor ? In the simplest case you will only need to set up a JAAS context name on it: http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/security/JAASLoginInterceptor.java HTH, Sergey [1] http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html [2] http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ [3] http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ Best, Christian On Tue, Jul 17, 2012 at 9:45 PM, ychawlawrote: Hi Christian, What about adding an HTTP Conduit to your CXF bean? http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html Is your requirement for inbound or outbound HTTP basic auth? Depending on your container, you might be able to do this at the Apache HTTPD or Tomcat layer as well. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
Thanks Yogesh for taking time for my question. The information in [1] only helps for the client site (unit testing), but I have to provide this service (the server part). The information in [2] and [3] are useful how to implement such kind of CXF interceptor, but I still hope there is an existing solution in CXF or Jetty which doesn't force me to implement this. May be only a simple PasswordCallback or so... [1] http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html [2] http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ [3] http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ Best, Christian On Tue, Jul 17, 2012 at 9:45 PM, ychawla wrote: > Hi Christian, > What about adding an HTTP Conduit to your CXF bean? > > http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html > > Is your requirement for inbound or outbound HTTP basic auth? Depending on > your container, you might be able to do this at the Apache HTTPD or Tomcat > layer as well. > > Thanks, > Yogesh > > -- > View this message in context: > http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: camel-cxf and HTTP BASIC authentication
Just re-read your message and you have a ServiceMix requirement so Tomcat and Apache HTTPD wouldn't work. I saw some blog entries that talks about an interceptor based approach that might help: http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716173.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
Hi Christian, What about adding an HTTP Conduit to your CXF bean? http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html Is your requirement for inbound or outbound HTTP basic auth? Depending on your container, you might be able to do this at the Apache HTTPD or Tomcat layer as well. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html Sent from the Camel - Users mailing list archive at Nabble.com.
camel-cxf and HTTP BASIC authentication
We are in the process of migrating an existing project to Camel. One of the requirements is to support HTTP BASIC authentication. What's the (easiest) way to do this? I thought this could be done by configuring Jetty (in jetty.xml) but didn't found an example which doesn't use a web.xml file to fulfill this. Afterwards, I was looking for an CXF (Inbound) Interceptor to do it. Again without look. :-( Is it really required to write my own Interceptor to support this standard? We are using ServiceMix 4.4.1 with Camel 2.8.0. Thanks in advance, Christian
Re: HTTP basic authentication for cxf endpoint
Please check out the CXF http client configuer[1], and add these in your beans.xml http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"; xmlns:security="http://cxf.apache.org/configuration/security"; xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd";> [1]http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html Willem On 9/30/10 7:43 PM, xiaotao183 wrote: Hi, I am looking for a way that I could possibly inject the http basic authentication credential to cxf endpoint to invoke a remote ws which has http basic authentication enabled. Here is the beans.xml http://camel.apache.org/schema/spring";> http://localhost:8080/greeting";> Here is the actual camel route from("timer://javaTimer?fixedRate=true&period=2000").log(LoggingLevel.INFO, "Sending a ping!") .process(new Processor() { public void process(Exchange ex) throws Exception { ex.getIn().setHeader(CxfConstants.OPERATION_NAME, "greetClient"); MessageContentsList list = new MessageContentsList(); list.add(0, "hi"); ex.getIn().setBody(list); } }).to("cxf:bean:thebean").process(new Processor() { public void process(Exchange ex) throws Exception { System.out.println(ex); } }); Thanks -- Willem -- Open Source Integration: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: http://twitter.com/willemjiang
Re: HTTP basic authentication for cxf endpoint
Hi, You need to configure a bus object with https and inject it into your cxfEndpoint. Please check out the example below. For more details check out the bus configuration section of your CXF documentation. There is no need to explicitly inject the bus into the endpoint. The presence of a bus object in Spring automatically overrides the need for creation of the default bus. Cheers, Ashwin... == http://localhost:8080/greeting"/> - - Ashwin Karpe Apache Camel Committer & Sr Principal Consultant FUSESource (a Progress Software Corporation subsidiary) http://fusesource.com http://fusesource.com Blog: http://opensourceknowledge.blogspot.com http://opensourceknowledge.blogspot.com - -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-basic-authentication-for-cxf-endpoint-tp3046867p3047032.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-http: basic authentication and query parameter "username"
Hi Matteo, Did you receive my reply mail and try the solution of setting the message header with the Exchange.HTTP_QUERY just like this ? from("timer://foo?fixedRate=true&delay=0&period=1") .setHeader(Exchange.HTTP_QUERY, "username=YOUR_NAME") .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword";) .setHeader(FileComponent.HEADER_FILE_NAME,"get_user_info.xml").to("file:target/google"); Willem Matteo Redaelli wrote: The problem is that I should manage 2 "username" parameters! 1)the first is a query parameter add in the remote url: it will be used to retreive info about that user 2) but, for basic authentication, camel also requires a parameter with the same name "username" ... and the username for the basic authentication is always different from the username I need to put in the url query.. ychawla wrote: Hi Matteo, Did you check out this link: http://camel.apache.org/http.html It has info on connecting using basic auth. This example show a poll from google that you can adapt to meet your needs. Below is polls your URL and then write the result to a file: from("timer://foo?fixedRate=true&delay=0&period=1") .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword";) .setHeader(FileComponent.HEADER_FILE_NAME, "get_user_info.xml").to("file:target/google"); or in Spring http://camel.apache.org/schema/spring"; trace="true"> http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword"/> Cheers, Yogesh Matteo Redaelli wrote: Hello With camel-http I'd like to retreive an xml document from an url like http://remoteserver.location/get_user_info.xml?username=matteo BUT that url requires a basic authentication where do I have to set basic auth params (username and password) and where my query parameter "username"?? I read about adding params in url or setting up header variable Exchange.HTTP_QUERY .. Thanks in advance Matteo http://www.redaelli.org
Re: camel-http: basic authentication and query parameter "username"
Hi, Can you try to set the second username paramerters by setting the message header with name of Exchange.HTTP_QUERY? Willem Matteo Redaelli wrote: The problem is that I should manage 2 "username" parameters! 1)the first is a query parameter add in the remote url: it will be used to retreive info about that user 2) but, for basic authentication, camel also requires a parameter with the same name "username" ... and the username for the basic authentication is always different from the username I need to put in the url query.. ychawla wrote: Hi Matteo, Did you check out this link: http://camel.apache.org/http.html It has info on connecting using basic auth. This example show a poll from google that you can adapt to meet your needs. Below is polls your URL and then write the result to a file: from("timer://foo?fixedRate=true&delay=0&period=1") .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword";) .setHeader(FileComponent.HEADER_FILE_NAME, "get_user_info.xml").to("file:target/google"); or in Spring http://camel.apache.org/schema/spring"; trace="true"> http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword"/> Cheers, Yogesh Matteo Redaelli wrote: Hello With camel-http I'd like to retreive an xml document from an url like http://remoteserver.location/get_user_info.xml?username=matteo BUT that url requires a basic authentication where do I have to set basic auth params (username and password) and where my query parameter "username"?? I read about adding params in url or setting up header variable Exchange.HTTP_QUERY .. Thanks in advance Matteo http://www.redaelli.org
Re: camel-http: basic authentication and query parameter "username"
The problem is that I should manage 2 "username" parameters! 1)the first is a query parameter add in the remote url: it will be used to retreive info about that user 2) but, for basic authentication, camel also requires a parameter with the same name "username" ... and the username for the basic authentication is always different from the username I need to put in the url query.. ychawla wrote: > > Hi Matteo, > Did you check out this link: > > http://camel.apache.org/http.html > > It has info on connecting using basic auth. This example show a poll from > google that you can adapt to meet your needs. Below is polls your URL and > then write the result to a file: > > from("timer://foo?fixedRate=true&delay=0&period=1") > > .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword";) > .setHeader(FileComponent.HEADER_FILE_NAME, > "get_user_info.xml").to("file:target/google"); > > or in Spring > > http://camel.apache.org/schema/spring"; > trace="true"> > > > uri="http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword"/> > > > > > Cheers, > Yogesh > > > Matteo Redaelli wrote: >> >> Hello >> >> With camel-http I'd like to retreive an xml document from an url like >> >> http://remoteserver.location/get_user_info.xml?username=matteo >> >> BUT that url requires a basic authentication >> >> where do I have to set basic auth params (username and password) and >> where my query parameter "username"?? I read about adding params in url >> or setting up header variable Exchange.HTTP_QUERY .. >> >> Thanks in advance >> Matteo >> http://www.redaelli.org >> >> > > -- View this message in context: http://old.nabble.com/camel-http%3A-basic-authentication-and-query-parameter-%22username%22-tp27714288p27714426.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-http: basic authentication and query parameter "username"
Hi Matteo, Did you check out this link: http://camel.apache.org/http.html It has info on connecting using basic auth. This example show a poll from google that you can adapt to meet your needs. Below is polls your URL and then write the result to a file: from("timer://foo?fixedRate=true&delay=0&period=1") .to("http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword";) .setHeader(FileComponent.HEADER_FILE_NAME, "get_user_info.xml").to("file:target/google"); or in Spring http://camel.apache.org/schema/spring"; trace="true"> http://remoteserver.location/get_user_info.xml?username=matteo&password=matteosPassword"/> Cheers, Yogesh Matteo Redaelli wrote: > > Hello > > With camel-http I'd like to retreive an xml document from an url like > > http://remoteserver.location/get_user_info.xml?username=matteo > > BUT that url requires a basic authentication > > where do I have to set basic auth params (username and password) and > where my query parameter "username"?? I read about adding params in url or > setting up header variable Exchange.HTTP_QUERY .. > > Thanks in advance > Matteo > http://www.redaelli.org > > -- View this message in context: http://old.nabble.com/camel-http%3A-basic-authentication-and-query-parameter-%22username%22-tp27714288p27714294.html Sent from the Camel - Users mailing list archive at Nabble.com.
camel-http: basic authentication and query parameter "username"
Hello With camel-http I'd like to retreive an xml document from an url like http://remoteserver.location/get_user_info.xml?username=matteo BUT that url requires a basic authentication where do I have to set basic auth params (username and password) and where my query parameter "username"?? I read about adding params in url or setting up header variable Exchange.HTTP_QUERY .. Thanks in advance Matteo http://www.redaelli.org -- View this message in context: http://old.nabble.com/camel-http%3A-basic-authentication-and-query-parameter-%22username%22-tp27714288p27714288.html Sent from the Camel - Users mailing list archive at Nabble.com.