Excellent!

On Wed, Feb 27, 2013 at 4:47 PM, Nishanth Aravamudan
<[email protected]> wrote:
> In my environment, I am authenticating users against an LDAP server. The CLI
> does not currently allow users to authenticate, though, so provide an example
> site_rpc_client_lib that does.
>
> Signed-off-by: Nishanth Aravamudan <[email protected]>
>
> ---
> Note, an additional change to the cli is necessary to allow a username
> to be specified, sent separately. Perhaps update the commit message if
> they are both merged to indicate the reference.
>
> diff --git a/contrib/site_rpc_client_lib.py b/contrib/site_rpc_client_lib.py
> new file mode 100644
> index 0000000..b509cee
> --- /dev/null
> +++ b/contrib/site_rpc_client_lib.py
> @@ -0,0 +1,26 @@
> +"""
> +This module provides site-local authorization headers for Apache.
> +It asks the end-user for a password, rather than assuming no password
> +is necessary.

Perhaps a note explaining to the user that he'd need to drop this file
in the cli/ dir for it to work?

> +"""
> +
> +__author__ = '[email protected] (Nish Aravamudan)'

We have not been using the __author__ attribute in source files for a
while, what we're doing these days is to have a @author in the
docstring, would you please change that?

> +import getpass, os, base64
> +
> +
> +def authorization_headers(username, server):
> +    """
> +    Ask the user for their password, rather than assuming they don't
> +    need one.
> +
> +    @returns A dictionary of authorization headers to pass in to get_proxy().
> +    """
> +    if not username:
> +        if 'AUTOTEST_USER' in os.environ:
> +            username = os.environ['AUTOTEST_USER']
> +        else:
> +            username = getpass.getuser()
> +    password = getpass.getpass('Enter the password for %s: ' % username)
> +    base64string = base64.encodestring('%s:%s' % (username,password))[:-1]
> +    return {'AUTHORIZATION' : 'Basic %s' % base64string}
>
> _______________________________________________
> Autotest-kernel mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/autotest-kernel



-- 
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to