public User login ( Credentials credentials ) throws SecurityException { //check if user is logged in already User loggedInUser = getUser ( ) ; if ( loggedInUser != null ) { logout ( ) ; //throw new SecurityException("user already logged in as '" + loggedInUser.getId() + "'"); } User user = accessManager . authenticate ( credentials ) ; if ( user != null ) { this . user = user ; userSettings = user . getSettings ( ) ; } return user ; }
Authenticates a user for a certain realm based on credentials .