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
 
 public class InternalUserSource extends AbstractUserSourceProfile 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.UserSourceProfilePWD_EXPIRATION_BYPASS
 
- 
 - 
Constructor SummaryConstructors Constructor Description InternalUserSource(UserSourceProfileKernel delegate)InternalUserSource(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRole(java.lang.String newName, UICallback ui)voidaddUser(User user, UICallback ui)protected InternalUserRecordaddUserInternal(User user, UICallback ui, PersistenceSession session)voidalterPassword(User user, java.lang.String oldPassword, java.lang.String newPassword)voidalterUser(User user, UICallback ui)AuthenticatedUserauthenticate(AuthChallenge challenge)Called to both verify authentication for a given username/password pair, and to find the security roles for that user.static longcreateDefaultUserSource(GatewayContext context, java.lang.String userSourceProfileName, java.lang.String userSourceProfileDescription)Creates an internal user source called "default" with user "admin"/"password" and role "Administrator".static longcreateFirstUser(GatewayContext context, java.lang.String userSourceProfileName, java.lang.String userSourceProfileDescription, java.lang.String username, java.lang.String password, boolean preHashed)Creates an internal user source called "default" with the supplied username and password and role "Administrator".protected java.util.Optional<InternalUserRecord>findInternalUser(PersistenceSession session, java.lang.String uname)Looks up the internal user record keyed on username, NOT case sensitiveprotected java.lang.LongfindUserInternalId(PersistenceSession session, User user)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.voidremoveRole(java.lang.String group, UICallback ui)voidremoveUser(User user, UICallback ui)voidrenameRole(java.lang.String oldName, java.lang.String newName, UICallback ui)java.lang.StringtoString()java.lang.StringvalidatePassword(User user, java.lang.String password)Validate the given password.- 
Methods inherited from class com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfilegetName, getRoles, getUser, getUsers
 - 
Methods inherited from class com.inductiveautomation.ignition.gateway.user.UserSourceProfileKernelWrappergetCacheValidationTimeout, getContext, getManager, getProfileId, getProfileName, isLockedOut, notifyFailedAttempt, shutdown, startup
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface com.inductiveautomation.ignition.gateway.user.UserSourceProfilegetCacheValidationTimeout, getProfileId, shutdown, startup
 
- 
 
- 
- 
- 
Constructor Detail- 
InternalUserSourcepublic InternalUserSource(UserSourceProfileKernel delegate) 
 - 
InternalUserSourcepublic InternalUserSource(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge) 
 
- 
 - 
Method Detail- 
createDefaultUserSourcepublic static long createDefaultUserSource(GatewayContext context, java.lang.String userSourceProfileName, java.lang.String userSourceProfileDescription) throws java.lang.Exception Creates an internal user source called "default" with user "admin"/"password" and role "Administrator". Returns the long id of the new profile.- Throws:
- java.lang.Exception
 
 - 
createFirstUserpublic static long createFirstUser(GatewayContext context, java.lang.String userSourceProfileName, java.lang.String userSourceProfileDescription, java.lang.String username, java.lang.String password, boolean preHashed) throws java.lang.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 instance
- userSourceProfileName- The name of the internal user source profile to be created
- userSourceProfileDescription- The description of the internal user source profile to be created
- username- The username, Must not be null
- password- The password either pre-encrypted or not. Must not be null
- preHashed- true if the password is already hashed, false if it is not yet hashed
- Returns:
- The profile id.
- Throws:
- java.lang.Exception
 
 - 
authenticatepublic 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:
- PasswordExpiredException- if the user's password has expired and must be reset
- java.lang.Exception- if there was an unexpected problem encountered during authentication
 
 - 
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 interface- UserSourceProfile
- Specified by:
- getUsersin class- AbstractUserSourceProfile
- Throws:
- java.lang.Exception
 
 - 
findInternalUser@Nonnull protected java.util.Optional<InternalUserRecord> findInternalUser(PersistenceSession session, java.lang.String uname) Looks up the internal user record keyed on username, NOT case sensitive
 - 
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 interface- UserSourceProfile
- Overrides:
- getUserin class- AbstractUserSourceProfile
- Parameters:
- userName- the user name of the- Userto 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)
 
 - 
getRoles@Nonnull public java.util.Collection<java.lang.String> getRoles() throws java.lang.Exception- Specified by:
- getRolesin interface- UserSourceProfile
- Specified by:
- getRolesin class- AbstractUserSourceProfile
- 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
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getEditFlagspublic java.util.Set<UserSourceEditCapability> getEditFlags() Description copied from interface:UserSourceProfileWhich of the editing functions are supported?- Specified by:
- getEditFlagsin interface- UserSourceProfile
- Overrides:
- getEditFlagsin class- AbstractUserSourceProfile
 
 - 
validatePasswordpublic java.lang.String validatePassword(@Nonnull User user, java.lang.String password)Description copied from interface:UserSourceProfileValidate 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.
 
 - 
addUserInternalprotected InternalUserRecord addUserInternal(User user, @Nullable UICallback ui, PersistenceSession session) throws java.lang.Exception - Throws:
- java.lang.Exception
 
 - 
addUserpublic void addUser(@Nonnull User user, UICallback ui) throws java.lang.Exception- Specified by:
- addUserin interface- UserSourceProfile
- Overrides:
- addUserin class- AbstractUserSourceProfile
- Throws:
- java.lang.Exception
 
 - 
findUserInternalIdprotected java.lang.Long findUserInternalId(PersistenceSession session, User user) 
 - 
alterPasswordpublic void alterPassword(User user, java.lang.String oldPassword, java.lang.String newPassword) - Specified by:
- alterPasswordin interface- UserSourceProfile
- Overrides:
- alterPasswordin class- AbstractUserSourceProfile
 
 - 
alterUserpublic void alterUser(User user, UICallback ui) throws java.lang.Exception - Specified by:
- alterUserin interface- UserSourceProfile
- Overrides:
- alterUserin class- AbstractUserSourceProfile
- Throws:
- java.lang.Exception
 
 - 
removeUserpublic void removeUser(User user, UICallback ui) throws java.lang.Exception - Specified by:
- removeUserin interface- UserSourceProfile
- Overrides:
- removeUserin class- AbstractUserSourceProfile
- Throws:
- java.lang.Exception
 
 - 
addRolepublic void addRole(java.lang.String newName, UICallback ui)- Specified by:
- addRolein interface- UserSourceProfile
- Overrides:
- addRolein class- AbstractUserSourceProfile
 
 - 
renameRolepublic void renameRole(java.lang.String oldName, java.lang.String newName, UICallback ui)- Specified by:
- renameRolein interface- UserSourceProfile
- Overrides:
- renameRolein class- AbstractUserSourceProfile
 
 - 
removeRolepublic void removeRole(java.lang.String group, UICallback ui) throws java.lang.Exception- Specified by:
- removeRolein interface- UserSourceProfile
- Overrides:
- removeRolein class- AbstractUserSourceProfile
- Throws:
- java.lang.Exception
 
 
- 
 
-