Package net.sf.basedb.core
Class AuthenticationContext
java.lang.Object
net.sf.basedb.util.extensions.ClientContext
net.sf.basedb.core.AuthenticationContext
Gives authentication implementations limited access to the database.
- Since:
- 3.3
- Author:
- Nicklas
- Last modified
- $Date $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAuthenticationContext
(SessionControl sc, Session session, LoginRequest loginRequest) -
Method Summary
Modifier and TypeMethodDescriptionfindUsers
(String restriction, QueryParameter... parameters) Find users in the database using a "free" restriction.Get the login request information.Load a user item from the BASE database given an external id.getUserById
(int id) Load a user item from the BASE database given an internal id.getUserByLogin
(String login) Load a user item from the BASE database given a login name.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.
-