Results 1 to 3 of 3

Thread: Problem with AcegiDigestPasswordValidationCallbackHandler

  1. #1
    Join Date
    Mar 2008
    Posts
    8

    Default Problem with AcegiDigestPasswordValidationCallbackHandler

    Hi,
    I'm using now AcegiDigestPasswordValidationCallbackHandler to ensure users authentication in my ws, i use soapui to invoke my service, so i add security element in soap:header to test my service,like this :
    HTML Code:
    <soapenv:Header>
    
     <wsse:Security soapenv:mustUnderstand="1">
           <wsse:UsernameToken  wsu:Id="UsernameToken">
    	<wsse:Username>user1</wsse:Username> 
    	<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">a5wOu6kRbAOdj9lqIlriXUy46Mg=</wsse:Password> 
    	<wsse:Nonce>ffafffee57re</wsse:Nonce> 
    	<wsu:Created>2008-04-28T17:23:57.062Z</wsu:Created>
           </wsse:UsernameToken>
      </wsse:Security>
    
    </soapenv:Header>
    .
    and here is my config ws-spring-servlet.xml:
    HTML Code:
    <beans ......>
    ....
    <bean id="wsSecurityInterceptor"
    		class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor">
    		<property name="policyConfiguration"
    			value="/WEB-INF/securityPolicy.xml" />
    		<property name="callbackHandlers">
    			<list>
    				 <ref bean="acegiDigestPasswordValidationHandler" /> 
                               </list>
    		</property>
    	</bean>
    
    <bean id="acegiDigestPasswordValidationHandler" class="org.springframework.ws.soap.security.xwss.callback.acegi.AcegiDigestPasswordValidationCallbackHandler">
    		<property name="userDetailsService" ref="userDetailsService"/>
    		</bean>
    <bean id="userDetailsService"
    		class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
    <bean id="dataSource"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql:url:3306/mydb</value>
    		</property>
    		<property name="username">
    			<value>username</value>
    		</property>
    		<property name="password">
    			<value>password</value>
    		</property>
    	</bean>
    
        <bean id="endpointMapping" .........>
    
    <property name="interceptors">
    			<list>
                             <ref bean="wsSecurityInterceptor" />
                           </list>
    		</property>
          </bean>
    
    .......
    
    
    <beans>
    
    .
    I try to generate manualy Digest from pwd,nonce, and created( To test), but evry time i get this error :
    GRAVE: WSS1408: UsernameToken Authentication Failed
    28/04/2008 17:23:30 WARN [AbstractWsSecurityInterceptor] : Could not validate request: com.sun.xml.wss.impl.WssSoapFaultException: Authentication of Username Password Token Failed; nested exception is com.sun.xml.wss.XWSSecurityException: com.sun.xml.wss.impl.WssSoapFaultException: Authentication of Username Password Token Failed.

    I used new BASE64Encoder()).encode(sha1.digest() to generate password digest with previous value of security element in header.
    I want to know which Algo used by Acegi to verify passordDigest. Second, is it a bug fixed with AcegiDigestPasswordValidationCallbackHandler : according to this post :

    http://forum.springframework.org/sho...d.php?p=177391.

    I'm using acegi 1.0.7
    spring-ws 1.5.0

    Thanks

  2. #2
    Join Date
    Mar 2008
    Posts
    8

    Default

    Hi, may i'm not clear !,
    Simply that i want to know is wich algorithme used by Acegi to verify PasswordDigest validity, And how generate it. because i'm using a service method login(login, password) which returns a passwordDigest, which will be sent after in the header of each soapMessage request. Then i'm using AcegiDigestPasswordValidationCallbackHandler to validate it. So I must know what class I use to generate this digest in method login().

    if it's not clear thank you to tell me.

    waiting ur tips, good day

  3. #3
    Join Date
    Mar 2008
    Posts
    8

    Default

    Hello, excuse me for the delay, in fact I have solved my problem, which corresponded to how to calculate the passwordDigest to pass it in the SOAPmessage.
    So this is my config in the header of the message SOAP:

    HTML Code:
    <wsse:Password type="....#PasswordDigest" > = BASE64Encoder().encode(sha1(password + nonce + createdDate ));
    
    <wsse:Nonce> =  BASE64Encoder().encode(nonce.getBytes())
    
    <wsu:Created> = createdDate 
    Regards,

Posting Permissions

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