Skip to content

Commit 00d0643

Browse files
committed
Adding bearere header parameter
1 parent 57b7421 commit 00d0643

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ db/logs/
55
nginx/nginx-repo*
66
/nginx/configs/openid_connect_configuration.conf
77
/nginx/nginx-openid-connect
8+
/db/nginx_logs

backend/xar/src/main/xar-resources/modules/who-am-i.xqm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ module namespace whoami = "http://exist-db.org/modules/ns/who-am-i";
2727

2828
import module namespace sm = "http://exist-db.org/xquery/securitymanager";
2929
import module namespace login = "http://exist-db.org/example/modules/ns/login";
30-
import module namespace jwt="http://existsolutions.com/ns/jwt";
3130

3231

3332
declare namespace rest="http://exquery.org/ns/restxq";
@@ -44,13 +43,15 @@ Get the details of the current user.
4443
declare
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")
5353
function 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 }

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
ports:
1111
- "80:80"
1212
volumes:
13-
- $PWD/db/nginx_logs:/var/logs/nginx/
13+
- $PWD/db/nginx_logs:/var/log/nginx/
1414
client:
1515
build:
1616
dockerfile: Dockerfile

0 commit comments

Comments
 (0)