Open cornernote opened 1 year ago
I added something like this in ws-server.js
, and I can get the header value. How can I write it to a tiddler?
if(request.headers['X-BasicAuth-RemoteUser']) {
console.log("set state.authenticatedUsername to "+request.headers[request.headers['X-BasicAuth-RemoteUser']]);
// what can i do here to write to the tiddler ? - this doesn't work...
self.wiki.addTiddler({
title: "$:/status/UserName",
text: request.headers[header]});
//state.authenticatedUsername = request.headers[header];
}
I got it working with a change to get-status.js
:
...
exports.handler = function(request,response,state) {
...
const header = 'X-BasicAuth-RemoteUser'.toLowerCase();
const username = header && request.headers[header] ? request.headers[header] : '';
const status = {
...
username: username,
...
}
...
}
}());
and to BrowserWSAdaptor.js
...
$tw.wiki.addTiddler(new $tw.Tiddler({title:'$:/status/IsLoggedIn', text:data.logged_in}));
$tw.wiki.addTiddler(new $tw.Tiddler({title:'$:/status/UserName', text:data.username})); // add this
...
I would like to use a header from nginx proxy to set the
$:/status/UserName
.I have nginx setup like this:
Importantly these lines:
I tried like to run node tiddlywiki with the
authenticated-user-header
option, as described here:https://tiddlywiki.com/static/WebServer%2520Parameter%253A%2520authenticated-user-header.html
Something like this:
But that doesn't seem to do anything.
I'm looking for advise on if this is possible, if so then I would also be grateful for a gentle push in the right direction.
I am running:
and using
Before posting I read issue guidelines and:
I Will Not Get Tech Support For This