no.sesat.search.user.service
Interface BasicUserService


public interface BasicUserService

Service class with user services. A thorough client example using the service is found in sesat-kernel/war/src/main/java/no/sesat/search/http/filters/UserFilter.java

Version:
$Id: BasicUserService.java 23 2009-06-23 16:17:24Z ssmiweve $

Field Summary
static String LOGIN_KEY_SEPARATOR
          The separator used in login keys.
 
Method Summary
 BasicUser authenticateByLogin(String login, int type, String password)
          Authenticates a user by the given username and password.
 BasicUser authenticateByLoginKey(String loginKey)
          Authenticates a user by the given cookie value.
 void deleteUser(BasicUser user)
          Method that deletes a user from the database.
 void invalidateAllLogins(BasicUser user)
          Method that invalidate all login cookies for the given user.
 void invalidateAllLogins(String loginKey)
          Method that invalidate all logins for the user belonging to the given login cookie.
 void invalidateLogin(String loginKey)
          Method that invalidate the given login cookie.
 boolean isLegalLoginKey(String loginKey)
          Returns if the given login key has correct login key syntax.
 BasicUser refreshUser(BasicUser user)
          Method that takes a user object and refreshes it from the database.
 BasicUser removeUserProperty(BasicUser user, String propertyKey)
          Removes a property for the given user.
 BasicUser setUserProperty(BasicUser user, String propertyKey, String propertyValue)
          Sets a property for the user.
 

Field Detail

LOGIN_KEY_SEPARATOR

static final String LOGIN_KEY_SEPARATOR
The separator used in login keys.

See Also:
Constant Field Values
Method Detail

authenticateByLoginKey

BasicUser authenticateByLoginKey(String loginKey)
                                 throws InvalidTokenException
Authenticates a user by the given cookie value. The authenticated user is returned, null if the wanted user is not found. If the token part of the cookie value is illegal, an exception is thrown to signal a cookie theft. After a successful authentication, the login cookie value is updated in the database and the new valid login cookie is injected into the user object that is returned.

Parameters:
loginKey - the login key to use for authentication
Returns:
the authenticated user, null if not found
Throws:
InvalidTokenException - thrown if an illegal token part is used (stacktrace is blanked out)

authenticateByLogin

BasicUser authenticateByLogin(String login,
                              int type,
                              String password)
Authenticates a user by the given username and password. The authenticated user is returned, null if the wanted user is not found. After a successful authentication, a legal login cookie value is created in the database and the new valid login cookie is injected into the user object that is returned.

Parameters:
username - the username to use for authentication
password - the password to use for authentication
Returns:
the authenticated user, null if not found

refreshUser

BasicUser refreshUser(BasicUser user)
Method that takes a user object and refreshes it from the database.

Parameters:
user - the user object to refresh
Returns:
the refreshed user

invalidateLogin

void invalidateLogin(String loginKey)
Method that invalidate the given login cookie.

Parameters:
loginKey - the login cookie to invalidate

invalidateAllLogins

void invalidateAllLogins(String loginKey)
Method that invalidate all logins for the user belonging to the given login cookie.

Parameters:
loginKey - the login cookie to invalidate all user logins

invalidateAllLogins

void invalidateAllLogins(BasicUser user)
Method that invalidate all login cookies for the given user.

Parameters:
user - the user to invalidate all logins for

deleteUser

void deleteUser(BasicUser user)
Method that deletes a user from the database.

Parameters:
user - the user to delete.

setUserProperty

BasicUser setUserProperty(BasicUser user,
                          String propertyKey,
                          String propertyValue)
Sets a property for the user.

Parameters:
user - the user to set the property to
propertyKey - the propertyKey to add
propertyValue - the propertyValue to add
Returns:
the updated user object

removeUserProperty

BasicUser removeUserProperty(BasicUser user,
                             String propertyKey)
Removes a property for the given user.

Parameters:
user - the user to remove the property from
propertyKey - the propertyKey to remove

isLegalLoginKey

boolean isLegalLoginKey(String loginKey)
Returns if the given login key has correct login key syntax.

Parameters:
loginKey - the login key to check
Returns:
if the login key has correct syntax or not


Copyright © 2009 Schibsted Søk AS. All Rights Reserved.