Does anyone have an example on how to create an Active Directory User Source using the SDK? Using Ignition 8.1.9 but any example would be great!
I did see this post asking basically the same question but it was never fully answered. I’ve been looking in the User Source Manager but am getting lost in the abstract classes and having any example creating a user source would be really helpful (doesn’t have to be specifically Active Directory).
Directly manipulating internal state like this isn’t really a supported operation; you’re going to have some trouble with this.
In theory, if you put the right records (parent and child) in the right place with the right relationships set up, then called UserSourceManager#getProfile(long id), the (current) implementation of UserSourceManager would run through the necessary steps internally to actually create a usable profile in memory.
But with no public API to create your own, you’re reliant on internal implementation details that may change between Ignition versions.
Thanks for responding @PGriffith but that’s unfortunate to hear there’s no public API. Are there any plans to add a public API? This would be really helpful!!
I’ll spend some time trying to get the records in place but am definitely worried about the implementation changing in later versions as you said.
Do you happen to have any examples showing where/how to put the right records in the right place? Thank you in advance!
We don’t really have any plans to make this public directly, no. We might be making gateway configuration in general more configurable/accessible in 8.2, but that’s a ways out.
In general, what you’d do is open a session with the PersistenceInterface.
Then you’ll create a new instance of com.inductiveautomation.ignition.gateway.user.UserSourceProfileRecord and com.inductiveautomation.ignition.gateway.authentication.records.ADAuthProperties
Then, as long as you’ve saved the records and closed the session, you should just be able to ask the UserSourceManager for the profile with your ID and it’ll automatically start it up for you.