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 AuthenticatedUser
authenticate(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 PropertySet
findExtraProps(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 SRConnection
getConnection()
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 aUser
with the given user name.java.util.Collection<User>
getUsers()
Retrieve all users from this profile.protected LoggerEx
newLogger()
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.void
setAuthenticateBadgeQuery(java.lang.String authenticateBadgeQuery)
void
setAuthenticateQuery(java.lang.String string)
void
setDatasource(long id)
void
setFindUserQuery(java.lang.String findUserQuery)
void
setListContactInfoQuery(java.lang.String listContactInfoQuery)
void
setListExtraPropsQuery(java.lang.String listExtraPropsQuery)
void
setListRolesQuery(java.lang.String string)
void
setListScheduleAdjustmentsQuery(java.lang.String listScheduleAdjustmentsQuery)
void
setListUserRolesQuery(java.lang.String string)
void
setListUsersQuery(java.lang.String listUsersQuery)
java.lang.String
toString()
-
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:UserSourceProfile
Called 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:UserSourceProfile
Retrieve 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:
getUsers
in interfaceUserSourceProfile
- Specified by:
getUsers
in 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:UserSourceProfile
Fetch aUser
with 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:
getUser
in interfaceUserSourceProfile
- Overrides:
getUser
in classAbstractUserSourceProfile
- Parameters:
userName
- the user name of theUser
to fetch- Returns:
- an
Optional
User
with 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:UserSourceProfile
Which of the editing functions are supported?- Specified by:
getEditFlags
in interfaceUserSourceProfile
- Overrides:
getEditFlags
in classAbstractUserSourceProfile
-
getRoles
@Nonnull public java.util.Collection<java.lang.String> getRoles() throws java.lang.Exception
- Specified by:
getRoles
in interfaceUserSourceProfile
- Specified by:
getRoles
in 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:
toString
in classjava.lang.Object
-
-