Ben,
Thanks again for your help. I switched my filters to the right order, but still no success. I also am unsure as to whether I am setting the BASIC authentication headers on the HttpInvokter client proxy. With Hessian, I would just do:
Code:
Method method = mgr.getClass().getMethod("setUsername", new Class[] { String.class });
method.invoke(mgr, new Object[] { getUsername() });
method = mgr.getClass().getMethod("setPassword", new Class[] { String.class });
method.invoke(mgr, new Object[] { getPassword() });
However, org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean has no such methods.
So currently, I am just doing:
Code:
AuthenticationManager authenticationManager = (AuthenticationManager)appCtx.getBean("authenticationManager");
UsernamePasswordAuthenticationToken request = new UsernamePasswordAuthenticationToken(getUsername(),
getPassword());
Authentication result = authenticationManager.authenticate(request);
It is at the last line above (the authenticate call) that I am crashing with the exception: A valid SecureContext was not provided in the RequestContext
The following is from my client applicationContext.xml:
Code:
<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
<property name="providers">
<list>
<ref bean="remoteAuthenticationProvider"/>
</list>
</property>
</bean>
<bean id="remoteAuthenticationProvider" class="net.sf.acegisecurity.providers.rcp.RemoteAuthenticationProvider">
<property name="remoteAuthenticationManager"><ref bean="remoteAuthenticationManager"/></property>
</bean>
<bean id="remoteAuthenticationManager" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceInterface"><value>net.sf.acegisecurity.providers.rcp.RemoteAuthenticationManager</value></property>
<property name="serviceUrl"><value>${graceAdmin.serviceUrl}/Grace/Remote/RemoteAuthenticationManager</value></property>
</bean>
<!-- Proxy for my business logic object -->
<bean id="sampleManager" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl"><value>${graceAdmin.serviceUrl}/Grace/Remote/SampleManager</value></property>
<property name="serviceInterface"><value>org.dm.daniel.grace.business.SampleManager</value></property>
</bean>
The following is my web.xml (I tried the HttpSessionIntegrationFilter class to no avail, so it is back to the AutoIntegrationFilter):
Code:
<web-app>
<display-name>Grace Web</display-name>
<description>Grace Web Services (currently only exposes remote methods).</description>
<!-- Filters for Acegi Security -->
<filter>
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.AutoIntegrationFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- End of Filters for Acegi Security -->
<!-- Listener to initialize the spring application context -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
Servlet that dispatches request to registered handlers (Controller
implementations).
Has its own application context, by default defined in
"{servlet-name}-servlet.xml", i.e. "remote-servlet.xml".
-->
<servlet>
<servlet-name>remote</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- All remote method calls use the URL path /Remote -->
<servlet-mapping>
<url-pattern>/Remote/*</url-pattern>
<servlet-name>remote</servlet-name>
</servlet-mapping>
</web-app>
The following is from my remote-servlet.xml:
Code:
<bean name="/SampleManager" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service"><ref bean="sampleManager"/></property>
<property name="serviceInterface">
<value>org.dm.daniel.grace.business.SampleManager</value>
</property>
</bean>
<bean name="/RemoteAuthenticationManager" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
<property name="service"><ref bean="remoteAuthenticationManager"/></property>
<property name="serviceInterface"><value>net.sf.acegisecurity.providers.rcp.RemoteAuthenticationManager</value></property>
</bean>
My server's applicationContext.xml has stayed the same as above, with the exception of the HessianExporter.
I haven't yet gone to your CVS to get the net.sf.acegisecurity.httpinvoker.AuthenticationSim pleHttpInvoker since it seems we should be able to do this with the current version.
Thanks again for all of your help, Ben.