Question
· Mar 14

How to select X.509 Credentials as a custom Business Process Setting

I have created a custom Business Process setting called X509CredentialAlias in which I load the name of the credential alias to use for some background processes. I have looked through EnsPortal.Component but do not see an option for selecting X509 certs stored within IRIS. How might I adjust this setting to query all X509 certs saved within IRIS and offer a drop-down selection to the user within the business process? Similar to the EnsPortal.Component.sslConfigSelector. 

 

You can see in the above X509CredentialAlias that I am manually typing the credential alias name. This is where I would like to have a dropdown list similar to the SSL selector above.

 

 

 

Product version: IRIS 2021.2
Discussion (7)2
Log in or sign up to continue

Create an object that extends %String, and override the VALUELIST with a class method that returns a string with comma-separated values.

Example:

Class App.X509CredentialAlias Extends %String
{

Parameter VALUELIST = {..GetValueList()};
ClassMethod GetValueList() As %String
{
	Set sql = "SELECT LIST(Alias) As ValueList FROM %SYS.X509Credentials"
	Set resultSet = ##class(%SQL.Statement).%ExecDirect(,sql)

	If (resultSet.%Next())
	{
		Return ","_resultSet.ValueList
	}
	Return ""
}

}

Your BPL property must be the type of the created object

Class App.bp.Test Extends Ens.BusinessProcessBPL [ ClassType = persistent, ProcedureBlock ]
{

Property Example As App.X509CredentialAlias;
Parameter SETTINGS = "Example:App";
/*
 my BPL
*/
}

This worked perfectly. I had  modify the string output of GetValueList() to wrap the list in quotes like this:  ",Flight Vector,test"

ClassMethod GetValueList() As %String
{
	Set sql = "SELECT LIST(Alias) As ValueList FROM %SYS.X509Credentials"
	Set resultSet = ##class(%SQL.Statement).%ExecDirect(,sql)

	If (resultSet.%Next())
	{   
		Return $char(34) _ "," _ resultSet.ValueList _ $char(34)
	}
	Return ""
}

I now have an issue with the App settings list within the Business Process not updating once a cert is removed from the certificate credentials manager. If I add a cert, it reflects in the list but once removed, the cert alias stays in the settings list. Any ideas on how I can update the property list that's being stored to reflect the current list state?

What am I missing here?

Class ECUH.BPL.ClassMethods.X509CredentialAlias Extends %String
{

Parameter VALUELIST As COSEXPRESSION = "..GetValueList()";

ClassMethod GetValueList() As %String
{
	Set sql = "SELECT LIST(Alias) As ValueList FROM %SYS.X509Credentials"
	Set resultSet = ##class(%SQL.Statement).%ExecDirect(,sql)

	If (resultSet.%Next())
	{
		Return $char(34) _ "," _ resultSet.ValueList _ $char(34)
	}
	Return ""
}

}

This currently returns:

 

Not sure I understand how a method can be passed into a COSEXPRESSION even after reading the ref. materials.