Closed mosheduminer closed 5 years ago
Thanks for opening your first issue 🦁 Your feedback, is the most valuable thing besides PRs 💚
Ah thanks, I've copied the Dockerfile from the oauth2-auth branch to master. Can you retry? :-)
Thanks, it's up and running now. Hopefully I'll be able to contribute something in the next few days.
I think running the front-end via Docker Compose is not even necessary. So instead of running the front-end via docker-compose, maybe it is better or simpler to run with npm or yarn, such that the changes are automatically reflected. I'll change this in the READ ME I think :-)
I'm super new to the front-end stuff and currently I'm reading a book about TypeScript, so any help is super awesome :)
Just merged the oauth2-auth branch into master. Let me know if you're running into problems, please :-)
In regards to the recent changes:
But maybe we could change the Dockerfile to include the whole application as a volume, rather than copying everything in the image (which might be better for the production build!?).
And regarding the Keycloak configuration I hope this helps to the the OAuth2 authentification stuff working:
I've added list item 13 in the README. As we also need a user with all rights to communicate with the SirixDB HTTP-Server in the future :)
@mosheduminer we need to have a Keycloak server, as well as the SirixDB HTTP-Server running (for instance as docker containers). However, I have no idea how it would work without the support of the host network via Docker :(
Yes, you definitely need a user, but the redirect to Keycloak should work at least. Maybe for Windows users it might be better to start the standalone.bat from Keycloak, import the Sirix realm and add an admin user for testing. There's some documentation for the REST-API as well:
https://sirix.io/rest-api.html
I'm currently writing an article for dev.to how I got authentication with Nuxt.js + external REST API Server (SirixDB HTTP-Server) + Keycloak to run.
This might be helpful hopefully:
In general, our workflow is as follows:
/login
route to login in the first place/login
route has a simple Button, which issues a request to the SirixDB HTTP-server. Nuxt.js generates a unique, unguessable state
and a redirect_uri
, which Nuxt.js sends to the login
route as URL parameters. code
and checks the state
parameter for validityPOST
HTTP-request to the /token
endpoint on the SirixDB HTTP-Server with the code
parameter, the redirect_uri
again, which is the same callback route. Additionally it sends a response_type
which we set to code, such that Nuxt.js expects a JWT access token@JohannesLichtenberger, sorry if I wasn't clear about the server issue. In commit ddb6f892fea764afee0fbf2f7fb28c34cbed8276 the line "Start the SirixDB HTTP-Server: sudo docker-compose up -d server
" was removed. It seems to me that it was removed by accident.
As for authentication, the redirect does work. The problem is that when I try to view any page other than the callback page, I get the login page again.
Ah, please rebuild your server image and first of all pull the changes I did to SirixVerticle in the rest-api bundle.
I had to change a few things until I figured out what was wrong. The state parameters are mismatched I think between what Nuxt.js initially created and SirixDB created another state parameter. I think Nuxt.js should rise an error or maybe it does, but I had to look at the source code and it silently returns from the method
Oh and the change to the README was meant like this, such that we can develope the Nuxt.js front-end without a running Docker container.
Then start the SirixDB HTTP-server with:
sudo docker-compose up -d server
I figured out my problem with auth. It seems that localhost:9443/token
is not getting redirected. Although I did find an extension that does redirect the host, it seems that the call does not follow the redirect, but rather ends with a 307 internal redirect code.
I fixed this by changing every mention of localhost:9443
in the source code to 192.168.99.101:9443
(my docker host). I wasn't able to change localhost:8080 in the source code, so I am using switcheroo to redirect to the docker host.
@mosheduminer Where is localhost:8080 hardcoded?
Maybe you can change it in the sirix-conf.json file?
{
"https.port": 9443,
"keycloak.url": "http://localhost:8080/auth/realms/sirixdb",
"auth.path": "http://localhost:8080/auth/realms/sirixdb/protocol/openid-connect/auth",
"token.path": "/token",
"client.secret": "2e54cfdf-909b-47ca-b385-4c44886f04f0",
"oAuthFlowType" : "AUTH_CODE",
"redirect.uri" : "http://localhost:3005/callback"
}
Here the redirect.uri shouldn't have an effect as it's specified by Nuxt.js already
I tried that but it had no effect. I am now running into the following upon attempting to load the table:
Uncaught (in promise) TypeError: request.upload.addEventListener is not a function
at dispatchXhrRequest (commons.app.js:171)
at new Promise (<anonymous>)
at xhrAdapter (commons.app.js:32)
at dispatchRequest (commons.app.js:640)
I'm going to try to come back to this later.
Hmm strange.
Yes, basically the whole front-end as of now is at a very early stage (and we didn't implement any SirixDB HTTP-Server API calls as of now). Don't know where this error comes from :(
I'm just reading a book about TypeScript, so that I hope I'll be able to put myself much more work into the front-end, as I think it's crucial to show what's possible with SirixDB :-)
@JohannesLichtenberger I setup an ubuntu virtual machine, and got the same Uncaught (in promise) TypeError: request.upload.addEventListener is not a function
error. Are you getting this error? Maybe something in the recent commits is causing it?
As far as I can tell, the issue comes from mockjs - see https://github.com/nuysoft/Mock/issues/127, but I'm confused as to why this worked before. Additionally, there is a pull request from years back to solve the problem, but it was never merged.
@mosheduminer woohoo, even setup an Ubuntu Virtual machine :-)
As of today I'm for one week in holidays without a laptop, sadly.
Maybe you have an idea about this: https://cmty.app/nuxt/auth-module/issues/c445
@JohannesLichtenberger enjoy your holiday! On the off chance that you still want to discuss code... the solution would seem to be to implement a custom scheme as described here. If you want I can try to implement it.
Hmm, it would be a great addition. Even more so, if this could be merged into the Nuxt.js auth module as a new official provider ;-) but if not for us it would be great, indeed. Thus, we don't need the SirixDB HTTP-Server to basically act as a proxy. Should only be needed for instance for pure SPAs, which don't have a running Node.js server. BTW maybe we can move our discussion to the forum, which is somehow very rarely used. But I think Discourse is a really great forum :-)
The JWT tokens to be sent by Axios for manipulating or reading resources in SirixDB can then still be verified by the SirixDB HTTP-Server to check authorization :-)
Okay I've opened a discussion on discourse.
I'm trying to set up the project following https://github.com/sirixdb/sirix-web-frontend#project-setup, when I run step 14, I get the following message:
I am running docker toolbox on windows 10.