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.UserSourceProfile
PWD_EXPIRATION_BYPASS
-
-
Constructor Summary
Constructors Constructor Description InternalUserSource(UserSourceProfileKernel delegate)
InternalUserSource(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRole(java.lang.String newName, UICallback ui)
void
addUser(User user, UICallback ui)
void
alterPassword(User user, java.lang.String oldPassword, java.lang.String newPassword)
void
alterUser(User user, UICallback ui)
AuthenticatedUser
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)
Creates an internal user source called "default" with user "admin"/"password" and role "Administrator".static long
createFirstUser(GatewayContext context, java.lang.String username, java.lang.String password, boolean preEncrypted)
Creates an internal user source called "default" with the supplied username and password and role "Administrator".protected java.lang.Long
findUserInternalId(PersistenceSession session, User user)
protected java.util.List<ContactInfo>
getContactInfoForUser(PersistenceSession session, InternalUserRecord user)
java.util.Set<UserSourceEditCapability>
getEditFlags()
Which of the editing functions are supported?@NotNull java.util.Collection<java.lang.String>
getRoles()
protected java.util.List<java.lang.String>
getRolesForUser(PersistenceSession session, InternalUserRecord user)
protected java.util.List<ScheduleAdjustment>
getScheduleAdjustmentsForUser(PersistenceSession session, InternalUserRecord user)
@NotNull java.util.Collection<User>
getUsers()
Retrieve all users from this profile.protected void
loadExtendedUserProperties(PersistenceSession session, InternalUserRecord userRec, PropertySet user)
protected void
loadUserProperties(InternalUserRecord userRec, User user)
void
removeRole(java.lang.String group, UICallback ui)
void
removeUser(User user, UICallback ui)
void
renameRole(java.lang.String oldName, java.lang.String newName, UICallback ui)
java.lang.String
toString()
java.lang.String
validatePassword(User user, java.lang.String password)
Validate the given password.-
Methods inherited from class com.inductiveautomation.ignition.gateway.user.AbstractUserSourceProfile
getName, getUser
-
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 Detail
-
InternalUserSource
public InternalUserSource(UserSourceProfileKernel delegate)
-
InternalUserSource
public InternalUserSource(UserSourceProfileKernel kernel, int pwdHistory, int pwdMinLength, int pwdComplexity, int pwdMaxAge)
-
-
Method Detail
-
createDefaultUserSource
public static long createDefaultUserSource(GatewayContext context) 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
-
createFirstUser
public static long createFirstUser(GatewayContext context, java.lang.String username, java.lang.String password, boolean preEncrypted) 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 instanceusername
- The username, Must not be nullpassword
- The password either pre-encrypted or not. Must not be null- Returns:
- The profile id.
- Throws:
java.lang.Exception
-
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
-
getUsers
@NotNull public @NotNull java.util.Collection<User> 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.
-
loadUserProperties
protected void loadUserProperties(InternalUserRecord userRec, User user)
-
getRolesForUser
protected java.util.List<java.lang.String> getRolesForUser(PersistenceSession session, InternalUserRecord user)
-
getContactInfoForUser
protected java.util.List<ContactInfo> getContactInfoForUser(PersistenceSession session, InternalUserRecord user)
-
getScheduleAdjustmentsForUser
protected java.util.List<ScheduleAdjustment> getScheduleAdjustmentsForUser(PersistenceSession session, InternalUserRecord user)
-
loadExtendedUserProperties
protected void loadExtendedUserProperties(PersistenceSession session, InternalUserRecord userRec, PropertySet user)
-
getRoles
@NotNull public @NotNull java.util.Collection<java.lang.String> getRoles() throws java.lang.Exception
- Returns:
- a collection of all possible role names for this profile. May be empty
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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
-
validatePassword
public java.lang.String validatePassword(@Nonnull User user, java.lang.String password)
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.
-
addUser
public void addUser(User user, UICallback ui) throws java.lang.Exception
- Specified by:
addUser
in interfaceUserSourceProfile
- Overrides:
addUser
in classAbstractUserSourceProfile
- Throws:
java.lang.Exception
-
findUserInternalId
protected java.lang.Long findUserInternalId(PersistenceSession session, User user)
-
alterPassword
public void alterPassword(User user, java.lang.String oldPassword, java.lang.String newPassword)
- Specified by:
alterPassword
in interfaceUserSourceProfile
- Overrides:
alterPassword
in classAbstractUserSourceProfile
-
alterUser
public void alterUser(User user, UICallback ui) throws java.lang.Exception
- Specified by:
alterUser
in interfaceUserSourceProfile
- Overrides:
alterUser
in classAbstractUserSourceProfile
- Throws:
java.lang.Exception
-
removeUser
public void removeUser(User user, UICallback ui) throws java.lang.Exception
- Specified by:
removeUser
in interfaceUserSourceProfile
- Overrides:
removeUser
in classAbstractUserSourceProfile
- Throws:
java.lang.Exception
-
addRole
public void addRole(java.lang.String newName, UICallback ui)
- Specified by:
addRole
in interfaceUserSourceProfile
- Overrides:
addRole
in classAbstractUserSourceProfile
-
renameRole
public void renameRole(java.lang.String oldName, java.lang.String newName, UICallback ui)
- Specified by:
renameRole
in interfaceUserSourceProfile
- Overrides:
renameRole
in classAbstractUserSourceProfile
-
removeRole
public void removeRole(java.lang.String group, UICallback ui) throws java.lang.Exception
- Specified by:
removeRole
in interfaceUserSourceProfile
- Overrides:
removeRole
in classAbstractUserSourceProfile
- Throws:
java.lang.Exception
-
-