jitsucom / jitsu

Jitsu is an open-source Segment alternative. Fully-scriptable data ingestion engine for modern data teams. Set-up a real-time data pipeline in minutes, not days
https://jitsu.com
MIT License
3.95k stars 279 forks source link

Support simple login/register page instead of Github Auth #1062

Closed zjalicflw closed 5 months ago

zjalicflw commented 8 months ago

Currently, users cannot be added dynamically, and the recommended auth method is Github Auth, which works great. However it would be great if there was a simple auth page that can be customized.

vklimontovich commented 8 months ago

We use NextAuth under the hood, so technically it's possible. We even have a credentials authorization which can be enabled by providing TEST_CREDENTIALS=1.

That being said, we don't have nor internal resources, neither good reason to implement that. But we would welcome a contribution

kg-emid commented 8 months ago

Well the information about TEST_CREDENTIALS variable is a little bit wrong. TEST_CREDENTIALS exists indeed, however, as far as I see from sources, it expects from us to pass auth information in format login:hashed_password into that. You can pass multiple accounts, all you need is just separate them with comma, i.e. login1:pass1,login2:pass2.

To generate hashed password we can use the utility from this application which could be found here. To use it, you need to attach to container of console application, and then run command and pass desired password as an argument, i.e.

docker-compose exec console /bin/bash
npm run tool:hash 12345678

, where 12345678 - password I want to get hash for.

After that you should see the message in console with hashed password, something like that:

INFO [password-hash]: Hashing 12345678 → fdaf73a55f267b0fa16b6d0e99239b04.a0082a3069d5cd0d3032eece8481fcf740b7ae9aaf3bc92734c95a639d53491a2f88345b5a41ac93329cfa14a2a2b54dd2a5f87c8fe59463bbe4136331967ac1

After that you can use it in your .env file like that:

TEST_CREDENTIALS="test@example.com:fdaf73a55f267b0fa16b6d0e99239b04.a0082a3069d5cd0d3032eece8481fcf740b7ae9aaf3bc92734c95a639d53491a2f88345b5a41ac93329cfa14a2a2b54dd2a5f87c8fe59463bbe4136331967ac1"

Unfortunately, there is no information about TEST_CREDENTIALS variable in docs, so it took me some time to figure out how to use it. Hope it will save some time for someone :)

vklimontovich commented 8 months ago

Thanks, @kg-emid! That's how it works indeed. The reason we haven't documented it is that the purpose of this var is to run automated tests

vklimontovich commented 5 months ago

FWI, we changed our approach. Now login/password is defined by SEED_USER_EMAIL/SEED_USER_PASSWORD. Also it's possible to insert users manually to DB. See for details https://docs.jitsu.com/self-hosting/quick-start/#step-2-edit-env-file

zjalicflw commented 5 months ago

@vklimontovich Thanks, good news.