Example usage for org.springframework.jdbc.datasource UserCredentialsDataSourceAdapter setPassword

List of usage examples for org.springframework.jdbc.datasource UserCredentialsDataSourceAdapter setPassword

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource UserCredentialsDataSourceAdapter setPassword.

Prototype

public void setPassword(String password) 

Source Link

Document

Set the default user's password that this adapter should use for retrieving Connections.

Usage

From source file:com.dynamobi.ws.util.LucidDBEncoder.java

public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
    String pass1 = "" + encPass;
    String pass2 = encodePassword(rawPass, salt);

    //         System.out.println("ZZZZ rawPass= [" + rawPass + "] pass1 = [" +
    //         pass1
    //         + "] pass2 = [" + pass2 + "]");

    // We were successful, update session bean.
    if (pass1.equals(pass2)) {
        WebApplicationContext wac = ContextLoader.getCurrentWebApplicationContext();

        UserCredentialsDataSourceAdapter ds = (UserCredentialsDataSourceAdapter) wac.getBean("myDataSource");
        ds.setPassword(rawPass);
    }// ww  w  .  j a v a  2 s. c o m

    return pass1.equals(pass2);
}