Class InternalUserSource
java.lang.Object
com.inductiveautomation.ignition.gateway.user.UserSourceProfileKernelWrapper
com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfile
com.inductiveautomation.ignition.gateway.authentication.impl.InternalUserSource
- All Implemented Interfaces:
UserSourceProfile
,UserSourceProfileKernel
- Direct Known Subclasses:
ADInternalHybridUserSource
This user source stores users, groups, extended properties, and contact info inside the internal database. It is fully compliant with the user-source editing capabilities of Ignition.
Relevant persistent records:
-
Field Summary
Fields inherited from interface com.inductiveautomation.ignition.gateway.user.UserSourceProfile
PWD_EXPIRATION_BYPASS
-
Constructor Summary
ConstructorsConstructorDescriptionInternalUserSource
(UserSourceProfileKernel delegate) InternalUserSource
(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRole
(String newName, UICallback ui) void
addUser
(User user, UICallback ui) protected InternalUserRecord
addUserInternal
(User user, UICallback ui, PersistenceSession session) void
alterPassword
(User user, String oldPassword, String newPassword) void
alterUser
(User user, UICallback ui) authenticate
(AuthChallenge challenge) Called to both verify authentication for a given username/password pair, and to find the security roles for that user.static long
createDefaultUserSource
(GatewayContext context, String userSourceProfileName, String userSourceProfileDescription) Creates an internal user source called "default" with user "admin"/"password" and role "Administrator".static long
createFirstUser
(GatewayContext context, String userSourceProfileName, String userSourceProfileDescription, String username, String password, boolean preHashed) Creates an internal user source called "default" with the supplied username and password and role "Administrator".protected Optional<InternalUserRecord>
findInternalUser
(PersistenceSession session, String uname) Looks up the internal user record keyed on username, NOT case sensitiveprotected Long
findUserInternalId
(PersistenceSession session, User user) Which of the editing functions are supported?getRoles()
Fetch aUser
with the given user name.getUsers()
Retrieve all users from this profile.void
removeRole
(String group, UICallback ui) void
removeUser
(User user, UICallback ui) void
renameRole
(String oldName, String newName, UICallback ui) toString()
validatePassword
(User user, String password) Validate the given password.Methods inherited from class com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfile
getName, getRoles, getUser, getUsers
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
-
Constructor Details
-
InternalUserSource
-
InternalUserSource
public InternalUserSource(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge)
-
-
Method Details
-
createDefaultUserSource
public static long createDefaultUserSource(GatewayContext context, String userSourceProfileName, String userSourceProfileDescription) throws Exception Creates an internal user source called "default" with user "admin"/"password" and role "Administrator". Returns the long id of the new profile.- Throws:
Exception
-
createFirstUser
public static long createFirstUser(GatewayContext context, String userSourceProfileName, String userSourceProfileDescription, String username, String password, boolean preHashed) throws Exception Creates an internal user source called "default" with the supplied username and password and role "Administrator". Returns the long id of the new profile.- Parameters:
context
- The GatewayContext instanceuserSourceProfileName
- The name of the internal user source profile to be createduserSourceProfileDescription
- The description of the internal user source profile to be createdusername
- The username, Must not be nullpassword
- The password either pre-encrypted or not. Must not be nullpreHashed
- true if the password is already hashed, false if it is not yet hashed- Returns:
- The profile id.
- Throws:
Exception
-
authenticate
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:
PasswordExpiredException
- if the user's password has expired and must be resetException
- if there was an unexpected problem encountered during authentication
-
getUsers
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:
Exception
-
findInternalUser
@Nonnull protected Optional<InternalUserRecord> findInternalUser(PersistenceSession session, String uname) Looks up the internal user record keyed on username, NOT case sensitive -
getUser
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:
Exception
- if there is an unexpected problem fetching the user with the given user name- See Also:
-
getRoles
- 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:
Exception
-
toString
-
getEditFlags
Description copied from interface:UserSourceProfile
Which of the editing functions are supported?- Specified by:
getEditFlags
in interfaceUserSourceProfile
- Overrides:
getEditFlags
in classAbstractUserSourceProfile
-
validatePassword
Description copied from interface:UserSourceProfile
Validate the given password. Note that this doesn't mean it checks to see if this password matches the user's current password. Rather, it means that this password would be an acceptable new password for the user.- Returns:
- A i18n key for the error message describing why the password is invalid, or null if the password is valid.
-
addUserInternal
protected InternalUserRecord addUserInternal(User user, @Nullable UICallback ui, PersistenceSession session) throws Exception - Throws:
Exception
-
addUser
- Specified by:
addUser
in interfaceUserSourceProfile
- Overrides:
addUser
in classAbstractUserSourceProfile
- Throws:
Exception
-
findUserInternalId
-
alterPassword
- Specified by:
alterPassword
in interfaceUserSourceProfile
- Overrides:
alterPassword
in classAbstractUserSourceProfile
-
alterUser
- Specified by:
alterUser
in interfaceUserSourceProfile
- Overrides:
alterUser
in classAbstractUserSourceProfile
- Throws:
Exception
-
removeUser
- Specified by:
removeUser
in interfaceUserSourceProfile
- Overrides:
removeUser
in classAbstractUserSourceProfile
- Throws:
Exception
-
addRole
- Specified by:
addRole
in interfaceUserSourceProfile
- Overrides:
addRole
in classAbstractUserSourceProfile
-
renameRole
- Specified by:
renameRole
in interfaceUserSourceProfile
- Overrides:
renameRole
in classAbstractUserSourceProfile
-
removeRole
- Specified by:
removeRole
in interfaceUserSourceProfile
- Overrides:
removeRole
in classAbstractUserSourceProfile
- Throws:
Exception
-