Authenticating from the console
The 4Suite repository command line tools ask the user to authenticate by asking for the username and password, and also ask for the target repository server and port. Python programs can also be written to ask for such authentication (see section below).
Typing in credentials for each command or program invokation can get tedious. One shortcut for this is 4ss agent, which asks the user for this information once and then spawns a sub-shell in which users do not need to re-authenticate.
There is also 4ss login, which saves the user's password and only requires the user to identify himself in future, rather than also providing the password.
See this post for a brief mention of how one can maintain remote sites from the command line.
Setting up the environment for authentication for the repository
In the Python API, you can get a repository instance if you have the authentication information using
from Ft.Server.Client import Core repo = Core.GetRepository(uname, passwd_hash, host, port)
There is also a utility API that checks for authentication information perhaps provided by a 4ss agent shell or through 4ss login.
from Ft.Server import Client repo = Client.SmartLogin()
SmartLogin can take an option argument which is a dictionary of parameters. You can also get just these parameters as provided by the environment, if any using a similar API
from Ft.Server import Client auth_info Client.GetAuthentication()
Further notes
Jeremy Kloth explains why 4ss login is set up the way it is:
Since there can be multiple users within a single repository, the 4ss command-line still requires a username to determine which entry in the password file to use. To get around this, add the "--username=<repo-user>" to the command-line.
Comments
Just use SHA encoding to generate the passwd_hash used in the example above: <code> .. passwd_hash = sha.new("my_password").hexdigest() .. </code>
