Jasperserver Customizing external authentication password validation

0

HI,

  M performing external login authentication for my requirement. It works fine with MD5/SHA encryption. My external database encrypts and stores password  as below,

   md5(password + key):key

     where key-> randomly generated during pwd encryption.

How i can validate encrypted password as above with jasperserver ? Please help.

 

 

Thanks,

Akshatha

akshathajcta's picture
Joined: Nov 26 2013 - 1:01am
Last seen: 5 years 7 months ago

1 Answer:

0

I found answer. Created my own password validation function,placed it inside WEB-INF/lib/customized.jar file, and called that function from applicationContext-externalAuth-db.xml as below.

    <bean id="passwordValidator" class="org.springframework.security.providers.encoding.CustomizedMd5PasswordEncoder">
        <property name="encodeHashAsBase64"><value>false</value></property>
    </bean>

Pasting my customized java function,

    package org.springframework.security.providers.encoding;

    import org.springframework.security.providers.encoding.Md5PasswordEncoder;


    public class CustomizedMd5PasswordEncoder extends Md5PasswordEncoder
    {
     public boolean isPasswordValid(String encPass, String rawPass, Object salt)
     {
         String[] pass1 = encPass.split(":");
         if(pass1.length != 2)
             return false;
         String encResult= encodePassword(pass1[1]+rawPass, salt);
         if(encResult.equals(pass1[0]))
             return true;
         else
             return false;

          /* Above function is for my requirement, please make appropriate changes as you need*/
    }
    }

Refer below url for detail steps,

http://community.jaspersoft.com/questions/817932/passwordvalidator-smd5


Thanks

akshathajcta's picture
Joined: Nov 26 2013 - 1:01am
Last seen: 5 years 7 months ago
Feedback