@@ -27,7 +27,6 @@ module namespace whoami = "http://exist-db.org/modules/ns/who-am-i";
2727
2828import module namespace sm = "http://exist-db.org/xquery/securitymanager" ;
2929import module namespace login = "http://exist-db.org/example/modules/ns/login" ;
30- import module namespace jwt="http://existsolutions.com/ns/jwt" ;
3130
3231
3332declare namespace rest="http://exquery.org/ns/restxq" ;
@@ -44,13 +43,15 @@ Get the details of the current user.
4443declare
4544 %rest:GET
4645 %rest:path("/example/who-am-i" )
46+ %rest:header-param("Bearer" , "{$bearer}" )
4747 %rest:header-param("Authorization" , "{$authorization}" )
4848 %rest:cookie-param("auth_token" , "{$authToken}" )
4949 %rest:cookie-param("auth_nonce" , "{$authNonce}" )
5050 %rest:produces("application/json" )
5151 %output:media-type("application/json" )
5252 %output:method("json" )
5353function whoami:get (
54+ $bearer as xs:string*,
5455 $authorization as xs:string*,
5556 $authToken as xs:string*,
5657 $authNonce as xs:string*
@@ -83,15 +84,10 @@ as map(*)
8384 return map:merge ((
8485 map {
8586 "authorization" : $authorization,
87+ "bearer" : $bearer,
8688 "auth_token" : $authToken,
8789 "auth_nonce" : $authNonce,
8890 "id" : $user,
89- "jwt" :
90- try {
91- jwt:read ($authToken, "AhgfQQUXsh58rsk4ukaAv9zcy9KS-JVWpvWdfGI_Uv_dOfbx5ZY3QZ_Toxyyc4bc" , 5000 )
92- } catch * {
93- map { 'error' : fn:true () }
94- },
9591 "groups" : array {
9692 for $group in $groups
9793 let $name-map := map { "id" : $group }
0 commit comments