Re: DefaultCryptoCoverageChecker property checkFaults

2014-01-23 Thread José Manuel Prieto
Hi Colm,

I make a new very simple example.
https://drive.google.com/file/d/0B9NfBsCykkXqX0wwbExSZEpEeEU/edit?usp=sharing

Steps:
1.- in server folder:  mvn install. Generate a war file
2.- Clean tomcat webapps/ old example, work/Catalina/*, temp/*. It solve a
problem with server.jks and signed headers.
3.- Start tomcat.
4.- deploy war in tomcat.
5.- in
CXF_checkFault/client/src/test/java/es/test/cxf/checkfault/client/ClientTest.java
read comments and run tests.

RESUME:
When: property name=checkFaults value=true/property
Exception because the response header is not signed. Thats OK.

When: property name=checkFaults value=false/property
Only SoapException reponses are OK
Server Response OK, is returned in the test as null or 0.

Thanks for your time
JMPrieto


2014/1/21 Colm O hEigeartaigh cohei...@apache.org

 It seems the testcase is missing a dependency:

 [ERROR] Failed to execute goal on project identidad-paxaseMock: Could not
 resolve dependencies for project

 es.depontevedra.soap.interoperabilidad.identidad:identidad-paxaseMock:war:0.0.1:
 Could not find artifact

 es.depontevedra.soap.interoperabilidad.identidad:identidad-cliente_xunta_identidad:jar:0.0.1
 in central (http://repo.maven.apache.org/maven2) - [Help 1]


 In addition, I noticed that you are mixing CXF versions. The root CXF
 version is 2.7.8, but in the pom for identidad-paxaseMock you have:

 dependency
 groupIdorg.apache.cxf/groupId
 artifactIdcxf-rt-bindings-http/artifactId
 version2.5.11/version
 /dependency

  dependency
 groupIdorg.apache.cxf/groupId
 artifactIdcxf-common-schemas/artifactId
 version2.3.11/version
 /dependency

 Colm.


 On Thu, Jan 16, 2014 at 6:52 AM, José Manuel Prieto 
 joseman...@prietopalacios.net wrote:

  Sorry, I explain:
  1.- Start Tomcat.
  2.- In folder identidad-paxaseMock run: mvn install. It generate a war
  file.
  3.- Deploy war file in Tomcat.
  4.- In folder identidad-cliente_xunta:
  - src/main/resources/spring/spring-client_paxase: it has the
  property checkFaults.
  - Test to run (TestNG):
  -
 
 
 es.depontevedra.soap.interoperabilidad.identidad.paxase.ClientPaxase.consultarIdentidad_prueba
  (OK)
  -
 
 
 es.depontevedra.soap.interoperabilidad.identidad.paxase.ClientPaxase.consultarIdentidad_excepcion.
  (SoapFault, but test must OK)
  5.- Change property checkFault and run again the tests.
 
  thanks
  JMPrieto
 
 
  2014/1/15 José Manuel Prieto joseman...@prietopalacios.net
 
   Hi coheigea,
   I left a project in Google Drive:
  
  
  
 
 https://drive.google.com/file/d/0B9NfBsCykkXqNWhielRla0ZiY00/edit?usp=sharing
  
   thanks
   JMPrieto
  
  
   2014/1/15 Colm O hEigeartaigh cohei...@apache.org
  
   Could you create a test-case that shows the problem?
  
   Colm.
  
  
   On Wed, Jan 15, 2014 at 9:23 AM, José Manuel Prieto 
   joseman...@prietopalacios.net wrote:
  
Unsolved
   
I followed this steps:
0.- Create diferent calls in spring file to
   DefaultCryptoCoverageChecker,
ref, bean, property -- no changes
1.- I create a custom Interceptor -- no changes
public class CustomDefaultCryptoCoverageChecker extends
DefaultCryptoCoverageChecker {
   
public CustomDefaultCryptoCoverageChecker(){
setCheckFaults(false);
}
}
   
2.- Change jaxb library version: form jaxb-impl:2.2.5-2 to
jaxb-impl:2.1.13. -- no changes
3.- Change spring library version form spring:3.0.5.RELEASE to
spring:3.2.6.RELEASE -- no changes
4.- Continuing the trace, I get to:
DocLiteralInInterceptor.handleMessage(Message message){
   ...
   o = dr.read(p, xmlReader); call to --
DataReaderImpl.read(MessagePartInfo part, T reader)
   ...
}
   
DataReaderImpl.read(MessagePartInfo part, T reader){
   return JAXBEncoderDecoder.unmarshall(createUnmarshaller(),
 reader,
   part,
 unwrapJAXBElement);
}
   
Who instance JAXB? spring?.
Why only one parameter change my wolrd?
   
thanks for readme
JMPrieto
   
   
   
2014/1/14 José Manuel Prieto joseman...@prietopalacios.net
   
 Hello,

 If I put property checkFaults=false (in sringframework
 application
 context file), only SoapFault Messages runs as expected.
 My service return a Response object. The service response is 200
  (OK),
 send me a Response (I see it, in the server-log), my client
 obtain a
 Response object but, all atributes to null.

 I trace until to SoapHeaderInterceptor.handleMessage(Message m).
  This
 methods contains:
 public void handleMessage(Message m) throws Fault {
 SoapMessage message = (SoapMessage) m;
 SoapVersion soapVersion = message.getVersion();
 

Any CXF examples that show SAML usage with IDP

2014-01-23 Thread rareddy
Hi,

While reading this page on CXF SSO 
http://cxf.apache.org/docs/saml-web-sso.html
http://cxf.apache.org/docs/saml-web-sso.html  , it is mentioned it has
been tested with number of other IDP providers like Picketlink, Shibboleth,
OpenAM etc. 

Are these testcases or examples any where that I can access? I have need to
implement a SP, I would like to use CXF and verify its usage.

Thank you.

Ramesh..



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Any-CXF-examples-that-show-SAML-usage-with-IDP-tp5739033.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Any CXF examples that show SAML usage with IDP

2014-01-23 Thread Sergey Beryozkin
Can you please try CXF OAuth2 in Google - it should point you to a 
demo shipped with Talend ESB - the demo shows 'plain' and SAML Web SSO 
variant (where Shibboleth is used by default)


If you don't find then I'll send you a link

Sergey
On 23/01/14 17:41, rareddy wrote:

Hi,

While reading this page on CXF SSO
http://cxf.apache.org/docs/saml-web-sso.html
http://cxf.apache.org/docs/saml-web-sso.html  , it is mentioned it has
been tested with number of other IDP providers like Picketlink, Shibboleth,
OpenAM etc.

Are these testcases or examples any where that I can access? I have need to
implement a SP, I would like to use CXF and verify its usage.

Thank you.

Ramesh..



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Any-CXF-examples-that-show-SAML-usage-with-IDP-tp5739033.html
Sent from the cxf-user mailing list archive at Nabble.com.




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


Re: How to ignore namespaces when calling Response.readEntity() with JAXB object

2014-01-23 Thread rehmanadil...@gmail.com


Sent from my HTC

- Reply message -
From: Mandy Warren mandys.in...@gmail.com
To: users@cxf.apache.org users@cxf.apache.org
Subject: How to ignore namespaces when calling Response.readEntity() with JAXB 
object
Date: Wed, Jan 22, 2014 10:54 PM


Thanks very much for the clear explanation, using the namespaceMap fixed it for 
us!

Sent from a mobile device

 On 21 Jan 2014, at 11:20, Sergey Beryozkin sberyoz...@gmail.com wrote:
 
 Hi Mandy
 
 Please see comments inline
 On 20/01/14 21:49, Mandy Warren wrote:
 
 Hi,
 
 We have a Rest service which returns a JSON or XML response if all goes
 well and a JSON / XML Errors object if a problem occurs. The Errors
 object has been created using xjc ie. by generating a JAXB class from a
 Schema.
 
 Our JAXB provider looks like this:
JAXBElementProvider jaxbElementProvider = new JAXBElementProvider
 ();
 
 In our JSON provider we have specified no namespaces should be used in the
 response:-
JSONProvider jsonProvider = new
 org.apache.cxf.jaxrs.provider.json.JSONProvider();
 it is set to false by default
jsonProvider.setDropRootElement(false);
 the supportUnwrapped is used when reading only
jsonProvider.setSupportUnwrapped(true);
 Ignoring namespaces is only effective on the write side
jsonProvider.setIgnoreNamespaces(true);
jsonProvider.setSchemaHandler(schemaHandler);
jsonProvider.setValidateOutput(true);
 
 
 In our integration tests we have code as follows:-
 
assertEquals(400, response.getStatus());
Errors errors = response.readEntity(Errors.class);
assertEquals(ABC_001, errors.getError().get(0).getCode());
 
 ie. we are asserting we get the correct HTTP status code back and that we
 get an Errors object containing an Error with a specific sub error code.
 
 This works fine when using XML as the mime type but when using JSON, our
 code fails at the line: Errors errors = response.readEntity(Errors.class)
 with the following exception:
 
 javax.ws.rs.MessageProcessingException: javax.ws.rs.BadRequestException:
 com.sun.istack.SAXParseException2; columnNumber: 0; unexpected element
 (uri:, local:ns2.Errors). Expected elements are 
 {http://www.xx.com/schema/framework/ErrorV01}Errors
at org.apache.cxf.jaxrs.impl.ResponseImpl.doReadEntity
 (ResponseImpl.java:335)
at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity
 (ResponseImpl.java:286)
at org.apache.cxf.jaxrs.impl.ResponseImpl.readEntity
 (ResponseImpl.java:276)
 
 Is there anyway to get the response.readEntity() method to ignore
 namespaces?
 It depends on what exactly you'd to do with the JSON payload.
 Do you plan the server to return a namespace-qualified JSON ? This is rarely 
 used in practice, AFAIK, at least when we have say a browser based client, it 
 can indeed be handy when working with CXF clients as the namespace info can 
 be used to unmarshall.
 
 In the trace above, what happens is that the server-based JSONProvider adds a 
 'ns2' prefix by default and the client one, finding no namespace map (the one 
 which would tell it to interpret 'ns2' as a prefix for 
 http://www.xx.com/schema/framework/ErrorV01) passes it as is to JAXB and we 
 have a failure.
 
 The easiest way to fix it is to have a client side JSONProvider set up with a 
 namespaceMap property, which will have a 
 ns1:http://www.xx.com/schema/framework/ErrorV01 pair added to it.
 
 The other option is actually configure the server side to ignore the 
 namespaces, - this will simplify reading the response for non-CXF clients, 
 while on the client side you can setup JSONProvider with an 
 inTransformElements map containing a 
 '*:{http://www.xx.com/schema/framework/ErrorV01}*' pair, see
 
 http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CustomizingJAXBXMLandJSONinputandoutput
 
 HTH, Sergey
 
 Many thanks
 
 Mandy
 
 
 -- 
 Sergey Beryozkin
 
 Talend Community Coders
 http://coders.talend.com/
 
 Blog: http://sberyozkin.blogspot.com


Re: Any CXF examples that show SAML usage with IDP

2014-01-23 Thread rareddy
Thank you Sergey for the tip and the example.

Here is what I found

https://github.com/Talend/tesb-rt-se/tree/master/examples/cxf/jaxrs-oauth2

Thanks

Ramesh..



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Any-CXF-examples-that-show-SAML-usage-with-IDP-tp5739033p5739044.html
Sent from the cxf-user mailing list archive at Nabble.com.