Announcement Announcement Module
Collapse
No announcement yet.
Cxf jax-rs Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cxf jax-rs

    Hi,
    Not sure if this is the right server for this but I am having a problem with configuring WS Security with cxf. I have the following crx-config.xml

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterce ptor"/>
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterc eptor"/>

    <bean id="myPasswordCallback"
    class="com.ceg.online.membership.spring.controller s.ServerPasswordCallback"/>

    <jaxrs:server id="helloworldrs" address="/">

    <jaxrs:inInterceptors>
    <ref bean="logInbound"/>
    <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInt erceptor">
    <constructor-arg>
    <map>
    <entry key="action" value="UsernameToken" />
    <entry key="passwordType" value="PasswordText" />
    <entry key="passwordCallbackRef"><ref bean="myPasswordCallback"/></entry>
    </map>
    </constructor-arg>
    </bean>

    </jaxrs:inInterceptors>
    <jaxrs:outInterceptors>
    <ref bean="logOutbound"/>
    </jaxrs:outInterceptors>
    <jaxrs:serviceBeans>
    <ref bean="membershipSession" />
    </jaxrs:serviceBeans>
    </jaxrs:server>


    password callback file looks like

    public class ServerPasswordCallback implements CallbackHandler {

    private static final String BUNDLE_LOCATION = "com.company.auth.authServer";
    private static final String PASSWORD_PROPERTY_NAME = "auth.manager.password";

    private static String password;
    static {
    //final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_LOCATION);
    //password = bundle.getString(PASSWORD_PROPERTY_NAME);
    password="jeff";
    }

    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

    WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

    if (pc.getIdentifer().equals("joe") ) {
    if (!pc.getPassword().equals("password")) {
    throw new IOException("wrong password");
    }
    }


    }

    }


    now I am getting a class cast exception java.lang.ClassCastException: org.apache.cxf.message.XMLMessage which I suspect it's because I need a different config for Restful web services. So can someone please help me with this driving me crazy. I don't see any examples for rest config. Also I was wondering with Spring 3.0 support for rest is it even worth while to use CXF or should I just use spring.


    thanks
    Jeff
Working...
X