How to test with authorization on?

127 views
Skip to first unread message

Don Morrison

unread,
Apr 11, 2022, 11:15:05 AM4/11/22
to nodeGame
So, I’ve never used the authorization stuff before, but am trying to
use it with REMOTE_DISPATCH, as you (Stefano) described in a message
last week. I’ve turned on external authorization, and set it up to
pull out a query parameter with

| function decorateClientObj(clientObj, info) {
| clientObj.externalUser = info.headers ? info.headers["id"] : "None";
| }

in auth.js. At this point I’m trying to test that things at least
start right, even though I’ve not yet tracked down what I need to do
with the registry stuff. If I type the following URL into a browser

http://localhost:8080/wroom/auth/password/?id=foo

all seems well and I am sent to the waiting room. This is with Chrome
(Version 99.0.4844.82) on Pop!_OS 21.10 (essentially Ubuntu 21.10).

I note that node also spits out to the console the following warning, though:

| [winston] Unknown logger level: (password) 0.0.0
| Client connected to waiting room: password
| NPL 1

But when I try to connect a second time in a different browser window using

http://localhost:8080/wroom/auth/password/?id=bar

I am told

| Wrong user/pwd or unauthorized access (already connected?). Attempt logged.

This time node spits nothing out to the console.

I presume this is nodeGame with authorization not liking multiple
connections from the same machine or something? How can I go about
testing this authorization stuff?

Thanks!


--
Don Morrison <d...@ringing.org>
“A vacuum flask keeps hot things hot in the winter and cold things cold
in the summer....How does it know? I’ve studied vacuum flasks for many
years and not one of them gave any clues as to their inherent seasonal
cognitive ability.” — Jasper Fforde, /Lost in a Good Book/

Don Morrison

unread,
Apr 11, 2022, 12:18:49 PM4/11/22
to nodeGame
On Mon, Apr 11, 2022 at 11:14 AM Don Morrison <d...@ringing.org> wrote:
> http://localhost:8080/wroom/auth/password/?id=foo

Ah, I think Ι now see that I didn’t understand how the URL is to be
constructed. I mistakenly thought “password” was like “auth,” and had
to be literally there. But (I think) I now see that “password” was
intended to be a placeholder of some sort. So I can successfully
connect three times and form a group which gets redirected with

http://localhost:8080/wroom/auth/foo/?id=foo
http://localhost:8080/wroom/auth/bar/?id=bar
and
http://localhost:8080/wroom/auth/glotz/?id=glotz

This seems to imply Ι can completely dispense with the ?id=<whatever>
stuff by just using URLs of the form

http://localhost:8080/wroom/auth/<whatever>/

assuming I can figure out how to pull the <whatever> out and pass it
along as part of the redirect.

Have I got that right now, or am I still confused?


--
Don Morrison <d...@ringing.org>
“Within C++, there is a much smaller and cleaner language struggling
to get out.” – Bjarne Stroustrup, /The Design and Evolution of C++/
[On his web page, Stroustrup later added “And no, that smaller and
cleaner language is not Java or C#”]

Stefano B

unread,
Apr 11, 2022, 1:47:07 PM4/11/22
to node...@googlegroups.com
That's correct. What comes after auth/ is actually the ID of the client in 'external' auth mode. 

--
You received this message because you are subscribed to the Google Groups "nodeGame" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodegame+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodegame/CAO9hiFV8d%2BtFCtmr49JrWd3UXmMcfQCGf5a7jGG73X%3DNy%3DZkuw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages