Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Genesis API Tokens #169

Open
MarcoHuebner opened this issue Dec 10, 2024 · 4 comments
Open

Support Genesis API Tokens #169

MarcoHuebner opened this issue Dec 10, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@MarcoHuebner
Copy link
Collaborator

MarcoHuebner commented Dec 10, 2024

Currently, the check_credentials function, called during selecting the database select_db_by_credentials (both in db), requires username and password to be set. However, this logic does not support token-based authentication for the GENESIS databases.

Suggestion(s):

  • Distinguish between username and token e.g. via an is_token(username) function (by the length of the username...?) OR
  • add a get_token(db_name) function.
@MarcoHuebner MarcoHuebner added the bug Something isn't working label Dec 10, 2024
@bergnerjonas bergnerjonas self-assigned this Dec 23, 2024
@bergnerjonas
Copy link
Collaborator

I think there are a couple of options here:

  1. Check if the username is a token via length: the tokens have a length of 32 according to the documentation. The only edge case I see is Zensus, here the username can be any E-Mail address, which might be 32 characters long.
  2. Use the authentication endpoint (/helloworld/logincheck) and check the response. However, this would require parsing the response text itself (both authentication success and failure return 200 status codes) and might break everything if the api response changes.

Although option 2 seems to be the cleaner approach, I prefer option 1 for simplicity reasons. What do you think @pmayd ?

@pmayd
Copy link
Collaborator

pmayd commented Dec 23, 2024

I was first thinking one would be enough and simplistic but then I thought that the user should get an info if the credentials he or she entered are invalid so I think we should actually call check login for any new set_credentials and check what the user entered. This will not help if the user is changing the config directly but I think that is fine as this requires advanced knowledge anyway. So I would actually prefer to make this part of the set_credentials function

@bergnerjonas
Copy link
Collaborator

I was first thinking one would be enough and simplistic but then I thought that the user should get an info if the credentials he or she entered are invalid so I think we should actually call check login for any new set_credentials and check what the user entered. This will not help if the user is changing the config directly but I think that is fine as this requires advanced knowledge anyway. So I would actually prefer to make this part of the set_credentials function

Alright I will give it a try :)

@bergnerjonas
Copy link
Collaborator

I opened a PR that addresses this issue: #177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants