Blue Mind
Release 1.0

net.bluemind.core
Class UserManagement

java.lang.Object
  extended by net.bluemind.core.UserManagement

public class UserManagement
extends Object

Helpers for working with userbm & domain tables. Authentication method is also here


Method Summary
 User checkCalendarUser(String calendar, String domainName)
          Returns an User if the calendar@domainName has an email and is not suspended
 void checkToken(AccessToken at)
          Checks the validity of the given session id
 Domain findDomainByName(String domainName)
          Getting Blue Mind domain from its name
 User findUser(String email)
          Find user from its email
 User findUserById(int id)
          Find user from its ID
 User findUserByLogin(String login, Domain domain)
          Find user from its domain Does not return archived (suspended) users
static UserManagement getInstance()
           
 AccessToken login(String login, String password, String origin)
          Try to valid login and password and create a Blue Mind session on success
 void logout(String sessionId)
          Close a Blue Mind session
 void removeDomainFromCache(String domainName)
          Remove Blue Mind from domain cache
 Integer resourceEntityFromEmailQuery(Connection con, String email, Integer domainId)
          Get resource ID from its email and optionally its Blue Mind domain ID
 Integer resourceIdFromEmailQuery(Connection con, String mail)
          Get resource ID from its email
 Integer userEntityFromEmailQuery(Connection con, String mail, Integer domainId)
          Getting user entity ID from user email and optionally its Blue Mind domain ID
 Integer userIdFromEmailQuery(Connection con, String mail, Integer domainId)
          Getting user ID from its email and optionally its Blue Mind domain ID
 ValidationKind validate(String login, String password, String origin)
          Try to validate a login and password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UserManagement getInstance()
Returns:
the server instance

login

public AccessToken login(String login,
                         String password,
                         String origin)
                  throws ServerFault
Try to valid login and password and create a Blue Mind session on success

Parameters:
login - Blue Mind user login
password - user password
origin - ID of service trying to get a Blue Mind session, useful for log and debug
Returns:
a Blue Mind access token if login successful
Throws:
ServerFault

validate

public ValidationKind validate(String login,
                               String password,
                               String origin)
                        throws ServerFault
Try to validate a login and password. password can be a user password or valid BM token. No Blue Mind session are created.

Parameters:
login - Blue Mind user login
password - user password
origin - ID of service trying to get a Blue Mind session, useful for log and debug
Returns:
true if login and password are valid, false otherwise
Throws:
ServerFault

checkToken

public void checkToken(AccessToken at)
                throws AuthFault
Checks the validity of the given session id

Parameters:
login -
sessionId -
Throws:
RemoteException
AuthFault

findDomainByName

public Domain findDomainByName(String domainName)
Getting Blue Mind domain from its name

Parameters:
domainName - domain name to search
Returns:
corresponding Blue Mind domain

removeDomainFromCache

public void removeDomainFromCache(String domainName)
Remove Blue Mind from domain cache

Parameters:
domainName - domain name to remove

userIdFromEmailQuery

public Integer userIdFromEmailQuery(Connection con,
                                    String mail,
                                    Integer domainId)
                             throws SQLException
Getting user ID from its email and optionally its Blue Mind domain ID

Parameters:
con - SQL connection
mail - user email
domainId - user Blue Mind domain ID or null
Returns:
user ID if user found, null otherwise
Throws:
SQLException

resourceIdFromEmailQuery

public Integer resourceIdFromEmailQuery(Connection con,
                                        String mail)
                                 throws SQLException
Get resource ID from its email

Parameters:
con - SQL connection
mail - resource email
Returns:
resource ID if resource found, null otherwise
Throws:
SQLException

resourceEntityFromEmailQuery

public Integer resourceEntityFromEmailQuery(Connection con,
                                            String email,
                                            Integer domainId)
Get resource ID from its email and optionally its Blue Mind domain ID

Parameters:
con - SQL connection
mail - resource email
domainId - resource Blue Mind domain ID or null
Returns:
resource ID if resource found, null otherwise

userEntityFromEmailQuery

public Integer userEntityFromEmailQuery(Connection con,
                                        String mail,
                                        Integer domainId)
                                 throws SQLException
Getting user entity ID from user email and optionally its Blue Mind domain ID

Parameters:
con - SQL connection
mail - user email
domainId - user Blue Mind domain ID or null
Returns:
user entity ID if user found, null otherwise
Throws:
SQLException

findUser

public User findUser(String email)
              throws ServerFault
Find user from its email

Parameters:
email - user email
Returns:
user if found, null otherwise
Throws:
ServerFault

findUserByLogin

public User findUserByLogin(String login,
                            Domain domain)
                     throws ServerFault
Find user from its domain Does not return archived (suspended) users

Parameters:
login - user login
domain - user domain
Returns:
user if found, null otherwise
Throws:
ServerFault

findUserById

public User findUserById(int id)
                  throws ServerFault
Find user from its ID

Parameters:
id - user ID
Returns:
user if ID found, null otherwise
Throws:
ServerFault

checkCalendarUser

public User checkCalendarUser(String calendar,
                              String domainName)
                       throws ServerFault
Returns an User if the calendar@domainName has an email and is not suspended

Parameters:
calendar -
domainName -
Returns:
Throws:
ServerFault

logout

public void logout(String sessionId)
Close a Blue Mind session

Parameters:
sessionId - session ID to close

Blue Mind
Release 1.0