Open MohitMaliFtechiz opened 10 months ago
@pujavs This shouldn't be TUI issue. May be admin-ui queries all scripts and filter internally. I enabled DUO script on both LDAP and PostgreSQL backends. When I executed this query:
python3 /opt/jans/jans-cli/cli/config_cli.py --operation-id=get-config-scripts --endpoint-args='fieldValuePair:scriptType=person_authentication,fieldValuePair:enabled=true'
OpenDJ backend response is good as expected:
But PostgreSQL backends reponses error:
{
"cause2": "Failed to build search entries query. Key: 'scripts', expression: '(lower(doc.description) like %% || lower(doc.displayName) like %%) && doc.jansEnabled = true && doc.jansScrTyp = person_authentication'",
"cause1": "io.jans.orm.exception.EntryPersistenceException: Failed to find entries with key: 'scripts'",
"servlet": "io.jans.configapi.rest.ApiApplication",
"cause4": "org.postgresql.util.PSQLException: ERROR: operator does not exist: boolean = character varying\n Hint: No operator matches the given name and argument types. You might need to add explicit type casts.\n Position: 448",
"cause3": "com.querydsl.core.QueryException: Caught PSQLException for select "doc"."jansConfProperty", "doc"."displayName", "doc"."jansRevision", "doc"."description", "doc"."jansScrTyp", "doc"."jansModuleProperty", "doc"."inum", "doc"."jansAlias", "doc"."jansProgLng", "doc"."jansScrError", "doc"."jansScr", "doc"."jansEnabled", "doc"."jansLevel", "doc"."dn", "doc"."doc_id"\nfrom "public"."jansCustomScr" "doc"\nwhere (lower("doc"."description") like ? or lower("doc"."displayName") like ?) and ("doc"."jansEnabled" = ? and "doc"."jansScrTyp" = ?)\norder by "inum" asc, "jansLevel" asc\nlimit ?\noffset ?",
"cause0": "org.jboss.resteasy.spi.UnhandledException: io.jans.orm.exception.EntryPersistenceException: Failed to find entries with key: 'scripts'",
"message": "org.jboss.resteasy.spi.UnhandledException: io.jans.orm.exception.EntryPersistenceException: Failed to find entries with key: 'scripts'",
"url": "/jans-config-api/api/v1/config/scripts",
"status": "500"
}
See the error in config-api jetty log:
Seems orm issue, have requested @yurem for guidance
In the log there are 2 SQL Exception parts:
com.querydsl.core.QueryException: Caught PSQLException for select "doc"."jansConfProperty", "doc"."displayName", "doc"."jansRevision", "doc"."description", "doc"."jansScrTyp", "doc"."jansModuleProperty", "doc"."inum", "doc"."jansAlias", "doc"."jansProgLng", "doc"."jansScrError", "doc"."jansScr", "doc"."jansEnabled", "doc"."jansLevel", "doc"."dn", "doc"."doc_id"|from "public"."jansCustomScr" "doc"|where (lower("doc"."description") like ? or lower("doc"."displayName") like ?) and ("doc"."jansEnabled" = ? and "doc"."jansScrTyp" = ?)|order by "inum" asc, "jansLevel" asc|limit ?|offset ?
and
org.postgresql.util.PSQLException: ERROR: operator does not exist: boolean = character varying| Hint: No operator matches the given name and argument types. You might need to add explicit type casts.| Position: 448
According to the second one we compare boolean value with character varying
. I think the issue in this filter part "doc"."jansEnabled" = ?
.
Do you set boolean value or string in this filter part? Can you dump value/value_class_type of each parameter which you put into filter?
@yurem, the field and value provided are query parameter and hence passed as string. 2023-11-07 14:52:18,142 TRACE [qtp366004251-17] [io.jans.service.custom.CustomScriptService] (CustomScriptService.java:113) - CustomScript entry.getKey():jansEnabled, entry.getValue():true, entry.getValue().getClass():class java.lang.String`
Please find attached logs for both LDAP and PLSQL.
LDAP log - line#1742 configapi_script_LDAP_Line#1742.log
PLSQL Line#966 configapi_persistence_PLSQL_Line#966.log
I added strings "true" and "1" to boolean "true" conversion if column type is boolean
Describe the bug Not able to see enabled auth script in Authn
To Reproduce Steps to reproduce the behavior:
1.install jans 1.0.20.nightly 2.enable any script on jans -tui
Expected behavior all enabled script should be available on authn
Screenshots![Screenshot (16)](https://github.com/JanssenProject/jans/assets/34593983/8906e6ec-c317-4ef6-be7a-c008cf7071cf)
if we check in jans-tarp enabled script is available
Desktop (please complete the following information):