Class DatabaseExpertUserSource
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.user.UserSourceProfileKernelWrapper
-
- com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfile
-
- com.inductiveautomation.ignition.gateway.authentication.impl.DatabaseExpertUserSource
-
- All Implemented Interfaces:
UserSourceProfile,UserSourceProfileKernel
- Direct Known Subclasses:
ADtoDBHybridAuthenticator
public class DatabaseExpertUserSource extends AbstractUserSourceProfile
This Authenticator uses a database and SQL queries to authenticate users and retrieve roles
-
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.ignition.gateway.user.UserSourceProfile
PWD_EXPIRATION_BYPASS
-
-
Constructor Summary
Constructors Constructor Description DatabaseExpertUserSource(UserSourceProfileKernel kernel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticatedUserauthenticate(AuthChallenge challenge)Called to both verify authentication for a given username/password pair, and to find the security roles for that user.protected java.util.List<ContactInfo>findContactInfo(SRConnection con, java.lang.String uname)protected PropertySetfindExtraProps(SRConnection con, java.lang.String uname)protected java.util.List<java.lang.String>findRoles(java.sql.Connection con, java.lang.String uname)protected java.util.List<ScheduleAdjustment>findScheduleAdjustment(SRConnection con, java.lang.String uname)protected SRConnectiongetConnection()java.util.Set<UserSourceEditCapability>getEditFlags()Which of the editing functions are supported?java.util.Collection<java.lang.String>getRoles()java.util.Optional<User>getUser(java.lang.String userName)Fetch aUserwith the given user name.java.util.Collection<User>getUsers()Retrieve all users from this profile.protected LoggerExnewLogger()protected voidset(User user, Property<java.lang.String> prop, Dataset dataset, java.lang.String colName)Tries to extract information out of the dataset at row zero.voidsetAuthenticateBadgeQuery(java.lang.String authenticateBadgeQuery)voidsetAuthenticateQuery(java.lang.String string)voidsetDatasource(long id)voidsetFindUserQuery(java.lang.String findUserQuery)voidsetListContactInfoQuery(java.lang.String listContactInfoQuery)voidsetListExtraPropsQuery(java.lang.String listExtraPropsQuery)voidsetListRolesQuery(java.lang.String string)voidsetListScheduleAdjustmentsQuery(java.lang.String listScheduleAdjustmentsQuery)voidsetListUserRolesQuery(java.lang.String string)voidsetListUsersQuery(java.lang.String listUsersQuery)java.lang.StringtoString()-
Methods inherited from class com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfile
addRole, addUser, alterPassword, alterUser, getName, getRoles, getUser, getUsers, removeRole, removeUser, renameRole
-
Methods inherited from class com.inductiveautomation.ignition.gateway.user.UserSourceProfileKernelWrapper
getCacheValidationTimeout, getContext, getManager, getProfileId, getProfileName, isLockedOut, notifyFailedAttempt, shutdown, startup
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.ignition.gateway.user.UserSourceProfile
getCacheValidationTimeout, getProfileId, shutdown, startup, validatePassword
-
-
-
-
Constructor Detail
-
DatabaseExpertUserSource
public DatabaseExpertUserSource(UserSourceProfileKernel kernel)
-
-
Method Detail
-
newLogger
protected LoggerEx newLogger()
-
set
protected void set(User user, Property<java.lang.String> prop, Dataset dataset, java.lang.String colName)
Tries to extract information out of the dataset at row zero. If the column doesn't exist, fails silently
-
authenticate
public AuthenticatedUser authenticate(AuthChallenge challenge) throws java.lang.Exception
Description copied from interface:UserSourceProfileCalled to both verify authentication for a given username/password pair, and to find the security roles for that user.- Returns:
- An AuthenticatedUser that contains the user's roles if authentication succeeded, or null if it did not.
- Throws:
java.lang.Exception
-
findRoles
@Nonnull protected java.util.List<java.lang.String> findRoles(java.sql.Connection con, java.lang.String uname) throws java.lang.Exception- Throws:
java.lang.Exception
-
findContactInfo
@Nonnull protected java.util.List<ContactInfo> findContactInfo(SRConnection con, java.lang.String uname) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findScheduleAdjustment
protected java.util.List<ScheduleAdjustment> findScheduleAdjustment(SRConnection con, java.lang.String uname) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findExtraProps
protected PropertySet findExtraProps(SRConnection con, java.lang.String uname) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getUsers
@Nonnull public java.util.Collection<User> getUsers() throws java.lang.Exception
Description copied from interface:UserSourceProfileRetrieve all users from this profile. This can execute slowly (block) if need be. It will be called periodically by the manager and the results will be cached. Users from failover sources will be returned if hard failover is configured and triggered.- Specified by:
getUsersin interfaceUserSourceProfile- Specified by:
getUsersin classAbstractUserSourceProfile- Throws:
java.lang.Exception
-
getUser
@Nonnull public java.util.Optional<User> getUser(java.lang.String userName) throws java.lang.Exception
Description copied from interface:UserSourceProfileFetch aUserwith the given user name. If more than one user exists with the given user name, the first user returned from the underlying data source is returned. Failover sources will be queried if hard failover is configured and the primary sources are unable to fetch the user due to an error. Failover sources will also be queried if soft failover is configured and the user is not found in the primary sources.- Specified by:
getUserin interfaceUserSourceProfile- Overrides:
getUserin classAbstractUserSourceProfile- Parameters:
userName- the user name of theUserto fetch- Returns:
- an
OptionalUserwith the given user name. the user may be from a failover user source (checkUser.getProfileName()to confirm) - Throws:
java.lang.Exception- if there is an unexpected problem fetching the user with the given user name- See Also:
UserSourceProfile.getUser(String, String)
-
getEditFlags
public java.util.Set<UserSourceEditCapability> getEditFlags()
Description copied from interface:UserSourceProfileWhich of the editing functions are supported?- Specified by:
getEditFlagsin interfaceUserSourceProfile- Overrides:
getEditFlagsin classAbstractUserSourceProfile
-
getRoles
@Nonnull public java.util.Collection<java.lang.String> getRoles() throws java.lang.Exception- Specified by:
getRolesin interfaceUserSourceProfile- Specified by:
getRolesin classAbstractUserSourceProfile- Returns:
- a collection of all possible role names for this profile. May be empty. Roles from failover sources will be returned if hard failover is configured and triggered.
- Throws:
java.lang.Exception
-
getConnection
protected SRConnection getConnection() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
setDatasource
public void setDatasource(long id)
-
setAuthenticateQuery
public void setAuthenticateQuery(java.lang.String string)
-
setAuthenticateBadgeQuery
public void setAuthenticateBadgeQuery(java.lang.String authenticateBadgeQuery)
-
setListRolesQuery
public void setListRolesQuery(java.lang.String string)
-
setListUserRolesQuery
public void setListUserRolesQuery(java.lang.String string)
-
setListExtraPropsQuery
public void setListExtraPropsQuery(java.lang.String listExtraPropsQuery)
-
setListContactInfoQuery
public void setListContactInfoQuery(java.lang.String listContactInfoQuery)
-
setListScheduleAdjustmentsQuery
public void setListScheduleAdjustmentsQuery(java.lang.String listScheduleAdjustmentsQuery)
-
setFindUserQuery
public void setFindUserQuery(java.lang.String findUserQuery)
-
setListUsersQuery
public void setListUsersQuery(java.lang.String listUsersQuery)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-