Five Stars

SOAP username in mediation route

Hi,

 

We have a mediation route deployed to our runtime (6.3.1) which has basic authenticon active. The authentication is based on the Jaas domain karaf (default installation) and works. Only I want to be able to retrieve the supplied username and determine if the user has access to this resource.

So far I added an  Authorization header to the soap call (instead of the WS username stuff) which I could parse to a talend subjob called from the route.  auth1.PNG

 

Only when deploy this errors all over the place Smiley Sad 

 

 

 

This error message:

Execution of Talend job 'expense_portal.basicauthentication_0_1.BasicAuthentication' with args:
[--context=Default,
--context_param accept-encoding=gzip,deflate,
--context_param Authorization=Basic a2FyY...............wMQ==,
 --context_param breadcrumbId=ID-ES-A-ESB-01-49219-1494881483209-1-1,
 --context_param CamelAuthentication=Subject:
 Principal: UserPrincipal[karaf]
 Principal: RolePrincipal[viewer]
 Principal: GroupPrincipal[admingroup]
 Principal: RolePrincipal[manager]
 Principal: RolePrincipal[admin]
 Principal: RolePrincipal[systembundles]
, --context_param CamelCxfMessage=
{SOAPAction=http://www.talend.org/service/MasterData, http.base.path=https://localhost, HTTP.REQUEST=Request(POST /expense/Expense)@718c7b88,
 org.apache.cxf.transport.Destination=org.apache.cxf.transport.servlet.ServletDestination@4b6ebccc, HTTP.CONFIG=org.eclipse.jetty.servlet.ServletHolder$Config@7daa54d1,
 org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@407ea915, org.apache.cxf.message.Message.QUERY_STRING=null, javax.xml.ws.wsdl.operation={http://www.talend.org/service/}MasterData, javax.xml.ws.wsdl.service={http://www.talend.org/service/}Expense, org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.DocLiteralInInterceptor.keep-parameters-wrapper=true, org.apache.cxf.security.transport.TLSSessionInfo=org.apache.cxf.security.transport.TLSSessionInfo@52bccaa9, org.apache.cxf.message.Message.ENCODING=UTF-8, HTTP.CONTEXT=ServletContext@HttpServiceContext{httpContext=DefaultHttpContext [bundle=org.apache.cxf.cxf-rt-transports-http_3.1.7 [116], contextID=default]}, Content-Type=text/xml;charset=UTF-8, org.apache.cxf.security.SecurityContext=org.apache.cxf.interceptor.security.DefaultSecurityContext@6c0a84ee, org.apache.cxf.continuations.ContinuationProvider=org.apache.cxf.transport.http.Servlet3ContinuationProvider@43a94962, org.apache.cxf.message.Message.PROTOCOL_HEADERS={accept-encoding=[gzip,deflate], Authorization=[Basic a2FyY................wMQ==], connection=[keep-alive], Content-Length=[955], content-type=[text/xml;charset=UTF-8], Host=[localhost], SOAPAction=["http://www.talend.org/service/MasterData"], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]}, org.apache.cxf.request.url=https://localhost/expense/Expense, org.apache.cxf.interceptor.DocLiteralInInterceptor.DocLiteralInInterceptor.keep-parameters-wrapper=true, Accept=null, org.apache.cxf.request.uri=/expense/Expense,
 org.apache.cxf.service.model.MessageInfo=[MessageInfo INPUT: {http://www.talend.org/service/}MasterDataRequest], org.apache.cxf.message.Message.PATH_INFO=/expense/Expense,
 org.apache.cxf.transport.https.CertConstraints=null, HTTP.RESPONSE=HTTP/1.1 200
Date: Tue, 16 May 2017 08:27:51 GMT

, soap.body.ns.context={ser=http://www.talend.org/service/, soapenv=http://schemas.xmlsoap.org/soap/envelope/}, org.apache.cxf.headers.Header.list=[], schema-validation-enabled=NONE, org.apache.cxf.request.method=POST, org.apache.cxf.async.post.response.dispatch=true, org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@762a7603], HTTP_CONTEXT_MATCH_STRATEGY=stem, http.service.redirection=null, org.apache.cxf.message.Message.BASE_PATH=/expense/Expense, javax.xml.ws.wsdl.port={http://www.talend.org/service/}ExpensePort, org.apache.cxf.configuration.security.AuthorizationPolicy=org.apache.cxf.configuration.security.AuthorizationPolicy@42f703ed, javax.xml.ws.wsdl.interface={http://www.talend.org/service/}ExpensePortType, javax.xml.ws.wsdl.description=/Expense?wsdl, org.apache.cxf.message.Message.FIXED_PARAMETER_ORDER=false}, --context_param CamelHttpCharacterEncoding=UTF-8, --context_param CamelHttpMethod=POST, --context_param CamelHttpPath=, --context_param CamelHttpUri=/expense/Expense, --context_param CamelRedelivered=true, --context_param CamelRedeliveryCounter=2, --context_param CamelRedeliveryMaxCounter=2, --context_param connection=keep-alive, --context_param Content-Type=text/xml;charset=UTF-8, --context_param Host=localhost, --context_param operationName=MasterData, --context_param operationNamespace=http://www.talend.org/service/, --context_param org.apache.cxf.headers.Header.list=[], --context_param SOAPAction=http://www.talend.org/service/MasterData, --context_param User-Agent=Apache-HttpClient/4.1.1 (java 1.5)]' failed, see stderr for details</faultstring>
 

In this you can clearly see that the user is karaf, so I was wondering which part of the exchange this is saved. Because I prefer to use the default stuff instead of creating my own. Found only some old java classes which won't work anymore. 

 

So a pointer to a (preferabel) Simple expression to retrieve the Userprincipal would be nice.

  • ESB
  • Exchange components