inblockio / aqua-docker-mediawiki

Apache License 2.0
0 stars 1 forks source link

Upgrade to SIWE (Single Sign on with Ethereum) #4

Closed FantasticoFox closed 6 months ago

FantasticoFox commented 8 months ago

Requirement: Upgrade the Mediawiki container built process to include a working SIWE (https://github.com/spruceid/siwe) Outcome: alpha-1.0.4 release with the SIWE and OIDC plugin implemented in the container.

Context:

it-spiderman commented 7 months ago

With these commits, MW side is good

Load OIDC dependencies https://github.com/inblockio/aqua-docker-mediawiki/pull/5

Fix connection https://github.com/inblockio/aqua-PKC/commit/3276f063fb15f95c7755582ecadce7cb43976ab7

This will make sure that OIDC extension has all dependencies and is configured correctly.

This requires siwe-oidc domain to be added to /etc/hosts on the local machine. Its not nice, i know, ill try to work around this requirement, but for now, as we need to make call to SIWE from both the browser and inside the container, its needed

Im having trouble with getting the IdP to work. I only get white screen, with no errors in docker logs.

I can confirm that it receives the request from wiki, which looks good to me

/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A9352%2Findex.php%2FSpecial%3APluggableAuthLogin&client_id=siwe&nonce=360ada8e44cb7d5adde7d2ac99035e28&state=d615a4e62e3fbf7097473c60d7bd08fb&scope=openid+profile+openid

I found very little of the non-library docu on SIWE, so not sure how to proceed there. Maybe with these changes, you guys can get further in getting SIWE itself working

FantasticoFox commented 7 months ago

We are running into two issues:

FantasticoFox commented 7 months ago

@rht raised an issue https://github.com/spruceid/siwe-oidc/issues/86

it-spiderman commented 7 months ago

I was able to look into the domain resolution issue. Problem is that OIDC will make calls to SIWE container both inside the container and outside (browser redirects). Issue with this working with localhost is that localhost is not available inside the pkc container.

Thing that fails is this: https://github.com/jumbojett/OpenID-Connect-PHP/blob/master/src/OpenIDConnectClient.php#L621 It tries to contact it on localhost insdie the container, which wont work. I dont see a good solution to this, but some ideas are:

As for the other issue, how do you even get to users being created? Even if i hack siwe-oidc in the hosts file, i still get a white page when arriving to siwe. What do i need to do?

rht commented 7 months ago

patch the openid-connect-php lib so that it uses different domains for in and out calls (i can probably do that), but its a hack, and subject to breaking if library code changes

I prefer this option, because forking the SIWE requires us to maintain a Docker image, and seems to require more maintenance than maintaining a fork which requires occasional rebase of 2-3 lines of change to OpenID-Connect-PHP and the https://github.com/wikimedia/mediawiki-extensions-OpenIDConnect.

FantasticoFox commented 7 months ago

I agree with @rht and in addition to this, this is in your realm of expertise which makes it actionable.

FantasticoFox commented 7 months ago

@rht opened https://github.com/spruceid/siwe-oidc/issues/88 to resolve the whitepage issue caused by the SIWE docker container upgrade

it-spiderman commented 7 months ago

@rht are the issues with usernames also happening to you?

rht commented 7 months ago

I haven't tested, but I have observed that the first one happened to @FantasticoFox 's laptop, but not the second one.

it-spiderman commented 7 months ago

First one is more important. Please test when you get a chance

it-spiderman commented 7 months ago

No entry in etc/hosts will be requried with these patches https://github.com/inblockio/aqua-PKC/pull/130 https://github.com/inblockio/aqua-docker-mediawiki/pull/6

FantasticoFox commented 6 months ago

Done and working