[OPENIDM-3857] Cannot pass along custom context when making router requests from script Created: 24/Aug/15  Updated: 06/Jun/17  Resolved: 06/Jun/17

Status: Closed
Project: OpenIDM
Component/s: Module - Scripting
Affects Version/s: OpenIDM 4.0.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Jake Feasel Assignee: Brendan Miller
Resolution: Won't Fix Votes: 0
Labels: LEWIS, release-notes
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
depends on SCRIPT-23 Represent/handle CHF/CREST contexts a... Open
is required by OPENIDM-3917 linkedView endpoint not working anymo... Closed
Sprint: OpenIDM Sprint 47


Router calls from scripts using the "openidm" object are not able to define the context to use when executing that request. This is a regression from 3.2, and it prevents things like the linkedView from preventing information leakage based on authz filter logic.

It is expected that this should work, for example:

openidm.read(resourceId, null, context.current)

Presently such a call will fail.

This can be easily demonstrated using a custom endpoint, a sample command for doing so included below:

curl -u openidm-admin:openidm-admin --data '{"type":"text/javascript", "source": "openidm.read(\"config/managed\", null, context.current);"}' 'http://localhost:8080/openidm/config/endpoint/temp' -X PUT -H 'Content-type: application/json' -H 'If-None-Match: *'

curl -u openidm-admin:openidm-admin 'http://localhost:8080/openidm/endpoint/temp'

The above will fail with this output:

{"code":500,"reason":"Internal Server Error","message":"Wrapped java.lang.NoSuchMethodException: Method not found read(String,null,LinkedHashMap) (0ACDFE3233396FE3AB3318DB0528AA596AFBF963#1) in 0ACDFE3233396FE3AB3318DB0528AA596AFBF963 at line number 1 at column number 0","detail":{"fileName":"0ACDFE3233396FE3AB3318DB0528AA596AFBF963","lineNumber":1,"columnNumber":0}}

Comment by Brendan Miller [ 26/Aug/15 ]

I have a suspicion it will take a form of https://bugster.forgerock.org/jira/browse/CHF-27 to satisfy this requirement.

Comment by Brendan Miller [ 12/Feb/16 ]

Added to the SCRIPT-23 backlog

Comment by Brendan Miller [ 10/Mar/16 ]

See also this mailing list question

Comment by Brendan Miller [ 06/Jun/17 ]

This is currently broken for javascript since 3.1/4.0 post-CREST3.  As a workaround, groovy can be used.

Generated at Sun Sep 27 20:25:08 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.