Open vsoch opened 1 year ago
Hi! The Balsam login methods are configurable, and the client should poll the server for which method it wants to use. The example configuration in .env.example
has multiple login flows enabled, and it is attempting the preferred interactive device login flow:
export BALSAM_AUTH_LOGIN_METHODS='["password", "oauth_authcode", "oauth_device"]'
If you change that to just ["password"]
and double check that the server process is really picking up that setting (it should show up in the docker logs on server startup from this line), you should be able to sidestep having to set up OAuth!
This login method should tell the balsam login
client CLI to just ask the user for a password. You could make the access token longer lived by increasing this setting:
export BALSAM_AUTH_TOKEN_TTL=259200
For a totally headless workflow that never requires re-authenticating users interactively, this is the relevant section of the login CLI: https://github.com/argonne-lcf/balsam/blob/72a6e3d8d70759d1e4b746c8e1a75180ad303a7c/balsam/cmdline/login.py#L39-L42
you might consider adding a new subclass of the password-based client with the refresh_auth
and interactive_login
methods overriden to read the credentials from a file or environment variable instead of this: https://github.com/argonne-lcf/balsam/blob/72a6e3d8d70759d1e4b746c8e1a75180ad303a7c/balsam/client/requests_password.py#L68-L74
You would then want to update the client_class
key in ~/.balsam/client.yml
to ensure that when balsam clients start up, they use the new headless-auth subclass.
@masalim2 I'm working on this now - is there is a way to disable requiring ssl /https?
oup nevermind, I was using the -u
parameter incorrectly (for login it's the url, and for register it's the username).
@masalim2 should I also be making a new balsam/server/auth/headless_login.py? I was going to use the password_login.py, but the endpoints there seem to have an oauth flavor still.
Hi @vsoch, sorry this slipped through the cracks. Despite the name of that form parameter OAuth2PasswordRequestForm
, the implementation in password_login.py
is just a basic client-to-server HTTP POST with a username and password, no other fancy Oauth flows involved. The server just checks the password hash locally, there is no external authorzation server involved. Hopefully that is sufficient!
I've finally gotten Balsam running in my containers, but I'm having trouble understanding auth. When I do the login command, I get server errors:
And the server logs:
Probably the main issue is:
This should have been created here: https://github.com/argonne-lcf/balsam/blob/72a6e3d8d70759d1e4b746c8e1a75180ad303a7c/balsam/server/models/alembic/versions/f8fbad8262e3_initial.py#LL30C1-L30C1
Running the migration command with gunicorn as a prefix seems to exit with 1, but without, seems to do the migrations:
That seems to at least get around these issues of the server error, but now there is another bug:
Would it be possible to have a headless mode? I don't see how this would work in an automated workflow without that. Thanks!