0

I'm working on using an XQuery re-writer script to automate the login for a Single Sign-On solution. I'm starting with the Admin App Server at port 8001. In the App Server configuration I have:

Set authentication = application-level
Set url rewriter = rewriter.xqy

I have also set the following rewriter.xqy script at the root Admin/ directory on the server. As you can see, just as a simple test, I'm attempting to programmatically login as user "Austin" (a valid user).

xquery version "1.0-ml";

import module namespace rest = "http://marklogic.com/appservices/rest"
    at "/MarkLogic/appservices/utils/rest.xqy";

import module namespace config = "http://marklogic.com/admin/endpoint-config"
    at "/endpoints/config.xqy";

xdmp:login("Austin")

(rest:rewrite($config:OPTIONS,"uri"),xdmp:get-request-url())[1]

However, after recycling the webserver, I keep getting the following error when browsing to the Admin UI. As soon as I remove the xdmp line, the error goes away, and I can get straight in.

500: Internal Server Error XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected QName_ In /rewriter.xqy on line 9

As another test, I tried to log some messages using xdmp:log("test"), but those lines are also failing. Any clue why xdmp scripts are not running successfully?

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Ryan Miller
  • 315
  • 8
  • 18
  • the syntax error is because you need a comma separating the sequence of two commands 1. the `xdmp:login()` and 2. the other sequence of commands executing rest:rewrite() and xdmp:get-request-url() in which the first item is returned. So, add a comma `,` after the login – Mads Hansen Jan 25 '21 at 19:30
  • Does this answer your question? [Errors attempting to run XQuery scripts for single sign on into MarkLogic](https://stackoverflow.com/questions/65816993/errors-attempting-to-run-xquery-scripts-for-single-sign-on-into-marklogic) – Mads Hansen Jan 25 '21 at 19:31

0 Answers0