eXist-db / existdb-saml

XQuery module that implements SAML v2 single sign-on
GNU Lesser General Public License v2.1
4 stars 3 forks source link

[BUG] XDM xs:dateTimeStamp error on eXist-db 6.x.x #21

Closed adamretter closed 11 months ago

adamretter commented 1 year ago

When trying to use the current version on eXist-db 6.x.x the following error is reported:

HTTP ERROR 500 jakarta.servlet.ServletException: jakarta.servlet.ServletException: An error occurred while processing request to /exist/apps/myapp/index.html: err:XPTY0004 xs:dateTimeStamp(2023-08-25T14:22:00.502-05:00) is not a sub-type of xs:string [at line 114, column 49, source: /db/apps/existdb-saml/content/exsaml.xqm] In function: exsaml:store-authnreqid(xs:string, xs:string) [114:19:/db/apps/existdb-saml/content/exsaml.xqm] exsaml:build-saml-authnreq() [92:17:/db/apps/existdb-saml/content/exsaml.xqm] exsaml:build-authnreq-redir-url(xs:string) [53:29:/db/apps/existdb-saml/content/exsaml.xqm]

This occurs because fn:dateTime has been updated to be in compliance with the newer XQuery 3.1 definition, which causes it to return as xs:dateTimeStamp, this cannot be simply downcast to an xs:string which is what the function exsaml:store-authnreqid expects. Instead to fix this (whilst maintaining backwards compatibility) the value should be passed around as an xs:dateTime.