Results 1 to 2 of 2

Thread: Acegi and RMI Spring Remoting Type

  1. #1
    Join Date
    Sep 2005
    Location
    Asunción - Paraguay
    Posts
    8

    Default Acegi and RMI Spring Remoting Type

    Can Acegi secure spring rmi remoting?

    If it can, how exactly, I've already look at the contacts and pet clinic sample apps but im missing something.

    I already have RemoteAuthenticationProvider on my client and RemoteAuthenticationManager on the server.

    When I invoke some secure method I get the following:

    Code:
    28/12/2005 04:47:53 PM org.springframework.context.support.ResourceBundleMessageSource getResourceBundle
    ADVERTENCIA: ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale es_PY
    28/12/2005 04:47:53 PM org.springframework.remoting.support.RemoteInvocationTraceInterceptor invoke
    ADVERTENCIA: Processing of RmiServiceExporter remote call resulted in fatal exception: com.abcware.itman.invt.componente.srv.ClaseComponenteSrv.createClaseComponente
    org.acegisecurity.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext
    	at org.acegisecurity.intercept.AbstractSecurityInterceptor.credentialsNotFound(AbstractSecurityInterceptor.java:411)
    Here are my files:
    1.- On the client:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <!--
      - $Id: security-context-client.xml,v 1.2 2004/12/19 01:15:43 kdonald Exp $
      -->
    
    <beans>
        <!-- ========================= Start of BEAN POSTPROCESSORS ======================== -->
    
        <bean id="propertyPlaceholderConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="properties">
                <props>
                    <prop key="remoteServer">localhost</prop>
                    <prop key="remotePort">1199</prop>
                </props>
            </property>
            <property name="systemPropertiesModeName">
                <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
            </property>
        </bean>
    
        <!-- ========================= End of BEAN POSTPROCESSORS ========================== -->
    
    
        <!-- ========================= Start of SERVICE DEFINITIONS ========================= -->
    
        <!-- TipoComponenteSrv Remote Service Local Proxy with inner TipoComponenteSrv Remote Service invoker -->
        <bean id="tipoComponenteSrv" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
                    <property name="serviceUrl"><value>rmi://${remoteServer}:${remotePort}/TipoComponenteSrv</value></property>
                    <property name="serviceInterface"><value>com.abcware.itman.invt.componente.srv.TipoComponenteSrv</value></property>
                    <property name="remoteInvocationFactory"><ref local="remoteInvocationFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces"><value>com.abcware.itman.invt.componente.srv.TipoComponenteSrv</value></property>
        </bean>
    
        <!-- ClaseComponenteSrv Remote Service Local Proxy with inner ClaseComponenteSrv Remote Service invoker -->
        <bean id="claseComponenteSrv" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
                    <property name="serviceUrl"><value>rmi://${remoteServer}:${remotePort}/ClaseComponenteSrv</value></property>
                    <property name="serviceInterface"><value>com.abcware.itman.invt.componente.srv.ClaseComponenteSrv</value></property>
                    <property name="remoteInvocationFactory"><ref local="remoteInvocationFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces"><value>com.abcware.itman.invt.componente.srv.ClaseComponenteSrv</value></property>
        </bean>
    
        <!-- TipoAtributoSrv Remote Service Local Proxy with inner TipoAtributoSrv Remote Service invoker -->
        <bean id="tipoAtributoSrv" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
                    <property name="serviceUrl"><value>rmi://${remoteServer}:${remotePort}/TipoAtributoSrv</value></property>
                    <property name="serviceInterface"><value>com.abcware.itman.invt.componente.srv.TipoAtributoSrv</value></property>
                    <property name="remoteInvocationFactory"><ref local="remoteInvocationFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces"><value>com.abcware.itman.invt.componente.srv.TipoAtributoSrv</value></property>
        </bean>
    
        <!-- UnidadMedidaSrv Remote Service Local Proxy with inner UnidadMedidaSrv Remote Service invoker -->
        <bean id="unidadMedidaSrv" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
                    <property name="serviceUrl"><value>rmi://${remoteServer}:${remotePort}/UnidadMedidaSrv</value></property>
                    <property name="serviceInterface"><value>com.abcware.itman.invt.componente.srv.UnidadMedidaSrv</value></property>
                    <property name="remoteInvocationFactory"><ref local="remoteInvocationFactory"/></property>
                </bean>
            </property>
            <property name="proxyInterfaces"><value>com.abcware.itman.invt.componente.srv.UnidadMedidaSrv</value></property>
        </bean>
    
        <!-- ========================= End of SERVICE DEFINITIONS ========================= -->
    
    	<bean id="remoteInvocationFactory" class="org.acegisecurity.context.rmi.ContextPropagatingRemoteInvocationFactory"/>
    
    	<bean id="remoteAuthenticationProvider" class="org.acegisecurity.providers.rcp.RemoteAuthenticationProvider">
      		<property name="remoteAuthenticationManager"><ref bean="remoteAuthenticationManager"/></property>
    	</bean>
    </beans>
    2.- On the server:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
        
       <!-- ======================== AUTHENTICATION ======================= -->
    
       <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
          <property name="providers">
             <list>
                <ref local="daoAuthenticationProvider"/>
             </list>
          </property>
       </bean>
    
       <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
          <property name="userDetailsService"><ref local="jdbcDaoImpl"/></property>
          <property name="passwordEncoder"><ref local="passwordEncoder"/></property>
       </bean>
    
       <bean id="jdbcDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
          <property name="dataSource"><ref bean="acegiDataSource"/></property>
       </bean>
       
       <bean id="acegiDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       		<property name="driverClassName"><value>org.postgresql.Driver</value></property>
            <property name="username"><value>acegi</value></property>
            <property name="password"><value>acegi</value></property>
            <property name="url"><value>jdbc:postgresql://localhost:5432/itMan</value></property>
       </bean>
    
       <bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder"/>
    
       <!-- Automatically receives AuthenticationEvent messages -->
       <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener"/>
    
       <bean id="basicProcessingFilter" class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">
          <property name="authenticationManager"><ref local="authenticationManager"/></property>
          <property name="authenticationEntryPoint"><ref local="basicProcessingFilterEntryPoint"/></property>
       </bean>
    
       <bean id="basicProcessingFilterEntryPoint" class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
          <property name="realmName"><value>itMan Realm</value></property>
       </bean>
    
    	
    	<!-- Allows remote clients to check if a username/password is valid -->
    	<bean id="remoteAuthenticationManager" class="org.acegisecurity.providers.rcp.RemoteAuthenticationManagerImpl">
         	<property name="authenticationManager"><ref bean="authenticationManager"/></property>
    	</bean>	
    </beans>
    What am I missing?

    Thanks in advance!
    Diego Bendlin

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    On the client side you need to call SecurityContextHolder.getContext().setAuthenticati on(Authentication) with the credentials you wish to use when the call gets propagated to the server.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •