ome.security
Class PasswordUtil

java.lang.Object
  extended by ome.security.PasswordUtil

public abstract class PasswordUtil
extends Object

Static methods for dealing with password hashes and the "password" table. Used primarily by AdminImpl

Since:
3.0-Beta1
Author:
Josh Moore, josh.moore at gmx.de
See Also:
SecuritySystem, AdminImpl

Constructor Summary
PasswordUtil()
           
 
Method Summary
static void changeUserPasswordById(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, Long id, String password)
           
static String generateRandomPasswd()
           
static String getDnById(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, Long id)
           
static String getUserPasswordHash(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, Long id)
           
static void main(String[] args)
          Main method which takes exactly one argument, passes it to preparePassword(String) and prints the results on System.out.
static String passwordDigest(String clearText)
          Creates an MD5 hash of the given clear text and base64 encodes it.
static String preparePassword(String newPassword)
           
static List<String> userGroups(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, String name)
           
static Long userId(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc, String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordUtil

public PasswordUtil()
Method Detail

main

public static void main(String[] args)
Main method which takes exactly one argument, passes it to preparePassword(String) and prints the results on System.out. This is used by the build system to define the "@ROOTPASS@" placeholder in data.sql.


generateRandomPasswd

public static String generateRandomPasswd()

getDnById

public static String getDnById(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                               Long id)

changeUserPasswordById

public static void changeUserPasswordById(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                                          Long id,
                                          String password)

getUserPasswordHash

public static String getUserPasswordHash(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                                         Long id)

userId

public static Long userId(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                          String name)

userGroups

public static List<String> userGroups(org.springframework.jdbc.core.simple.SimpleJdbcOperations jdbc,
                                      String name)

preparePassword

public static String preparePassword(String newPassword)

passwordDigest

public static String passwordDigest(String clearText)
Creates an MD5 hash of the given clear text and base64 encodes it.

To do:
This should almost certainly be configurable as to encoding, algorithm, character encoding, and possibly even the implementation in general.


OmeroJava Api

Version: Beta-4.1.1-r5927-b91

Copyright © 2009 The University of Dundee. All Rights Reserved.