Class AuthenticationContext

java.lang.Object
net.sf.basedb.util.extensions.ClientContext
net.sf.basedb.core.AuthenticationContext

public class AuthenticationContext extends ClientContext
Gives authentication implementations limited access to the database.
Since:
3.3
Author:
Nicklas
Last modified
$Date $
  • Field Details

    • session

      private final Session session
    • loginRequest

      private final LoginRequest loginRequest
  • Constructor Details

  • Method Details

    • getLoginRequest

      public LoginRequest getLoginRequest()
      Get the login request information.
    • getUserByLogin

      public UserData getUserByLogin(String login)
      Load a user item from the BASE database given a login name.
      Parameters:
      login - The login for the user
      Returns:
      A UserData object or null if there is no user
    • getUserByExternalId

      public UserData getUserByExternalId(String id)
      Load a user item from the BASE database given an external id.
      Parameters:
      id - The external id for the user
      Returns:
      A UserData object or null if there is no user
    • findUsers

      public List<UserData> findUsers(String restriction, QueryParameter... parameters)
      Find users in the database using a "free" restriction. The restriction may contain named parameters but their values must be supplied as QueryParameter objects. IMPORTANT! Do not insert user-data into the restriction string since it may open up for SQL injection attacks.
      Parameters:
      restriction - A HQL restriction put in the WHERE clause
      parameters - Optional query parameters
      Returns:
      A list of users (may be empty)
    • getUserById

      public UserData getUserById(int id)
      Load a user item from the BASE database given an internal id.
      Parameters:
      id - The internal id for the user
      Returns:
      A UserData object or null if there is no user
    • verifyUserInternal

      public AuthenticatedUser verifyUserInternal(LoginRequest loginRequest)
      Check that the user exists and verify the password using internal authentication.