Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Is it possible to have a configuration table (like some extensions have) in a custom authenticator extension ?
I have the code and metadata posted below, which via annotations defines a configuration table on the authenticator. The extension is imported sucessfully, and the authenticator works as expected, the only problem is that the configuration page is missing.
What am I doing wrong?
Thanks,
Joao Pinto
@ThingworxConfigurationTableDefinitions(
tables={
@ThingworxConfigurationTableDefinition(name="ConfigTableExample1",
description="Example 1 config table", isMultiRow=false,
dataShape = @ThingworxDataShapeDefinition( fields = {
@ThingworxFieldDefinition(name="field1",description="",baseType=
"STRING"),
@ThingworxFieldDefinition(name="columnD",description="",baseType=
"USERNAME")}
)
)
}
)
public class TestAuthenticator extends CustomAuthenticator {
...
}
metadata.xml :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Entities>
<ExtensionPackages>
<ExtensionPackage dependsOn="" description="" minimumThingWorxVersion="6.6.0" name="Test Authenticator" packageVersion="1.0" vendor="xx">
<JarResources>
<FileResource description="" file="testauthenticator.jar" type="JAR"/>
</JarResources>
</ExtensionPackage>
</ExtensionPackages>
<Authenticators>
<Authenticator aspect.isEditableExtensionObject="true" className="auths.TestAuthenticator" description="" enabled="true" name="MyAuthenticator" priority="1" />
</Authenticators>
</Entities>
Hi, for this kind of question you may also want to post in Developer Community. I don't have the answer but you may get better visibility there.
Thanks! I will post there.
I don't think you can add a configuration table directly to an authenticator, but you could have a thing/thing template (dependent on design criteria) that is created automatically when you import your extension and have the configuration on the thing and then reference the thing configuration in your authenticator.
This is actually a bug that we already have documented and just needs to get prioritized. We do allow config tables on Authenticators and currently this works for Authenticators defined in the metadata.xml. That could be your workaround.
If that doesn't work for you, another work around would have to be figured out based on your design choices. Something like what Keri Wright proposed or having your Authenticator tie into the entity lifecycle(override initializeEntity()) and dynamically add your configuration table.
Thanks for your help Brian, how can I define a configuration table in the metadata.xml ?
Joao,
The best way to look at it to define it is to export out the ThingworxMobileAuthorizationAuthenticator in xml and use that code as reference. When using the code delete out the line in between configuration changes.
Also, I added in my auth class the following, after the imports:
@ThingworxConfigurationTableDefinitions(tables = {
@ThingworxConfigurationTableDefinition(name = "DebugStatusSetup", description = "Status of Debug Flag", isMultiRow = false, dataShape = @ThingworxDataShapeDefinition(fields = {
@ThingworxFieldDefinition(name = "DebugLoggingOn", description = "Turns Debug Logging On or Off", baseType = "STRING"),}) ) })
Hope this helps,
Keri