Package net.sf.basedb.core
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 Summary
Fields Modifier and Type Field Description private LoginRequest
loginRequest
private Session
session
-
Constructor Summary
Constructors Constructor Description AuthenticationContext(SessionControl sc, Session session, LoginRequest loginRequest)
-
Method Summary
Modifier and Type Method Description List<UserData>
findUsers(String restriction, QueryParameter... parameters)
Find users in the database using a "free" restriction.LoginRequest
getLoginRequest()
Get the login request information.UserData
getUserByExternalId(String id)
Load a user item from the BASE database given an external id.UserData
getUserById(int id)
Load a user item from the BASE database given an internal id.UserData
getUserByLogin(String login)
Load a user item from the BASE database given a login name.AuthenticatedUser
verifyUserInternal(LoginRequest loginRequest)
Check that the user exists and verify the password using internal authentication.Methods inherited from class net.sf.basedb.util.extensions.ClientContext
getAttribute, getCurrentExtension, getCurrentExtensionPoint, getCurrentItem, getDbControl, getSessionControl, linkAttributes, loadAttributes, setAttribute, setCurrentExtension, setCurrentExtensionPoint, setCurrentItem, storeAttributes
-
Field Details
-
session
-
loginRequest
-
-
Constructor Details
-
AuthenticationContext
AuthenticationContext(SessionControl sc, Session session, LoginRequest loginRequest)
-
-
Method Details
-
getLoginRequest
Get the login request information. -
getUserByLogin
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
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
Find users in the database using a "free" restriction. The restriction may contain named parameters but their values must be supplied asQueryParameter
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 clauseparameters
- Optional query parameters- Returns:
- A list of users (may be empty)
-
getUserById
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
Check that the user exists and verify the password using internal authentication.
-