#NEWLINE# def _password_auth( username , password , project_name = None , user_domain_name = None , project_domain_name = None , trust_id = None ) : #NEWLINE# #INDENT# "Return a password auth plugin object.\n\n    :param username: the user to authenticate as.\n\n    :param password: the user's password.\n\n    :param project_name: the project(ex. tenant) name to scope the auth.\n\n    :param user_domain_name: the domain the user belongs to.\n\n    :param project_domain_name: the domain the project belongs to.\n\n    :param trust_id: a trust id to scope the auth.\n\n    :returns: a password auth plugin object.\n    " #NEWLINE# passwd_kwargs = dict ( auth_url = base . retrieve_auth_url ( CONF . keystone . endpoint_type ) , username = username , password = password ) #NEWLINE# if CONF . use_identity_api_v3 : #NEWLINE# #INDENT# passwd_kwargs . update ( dict ( project_name = project_name , user_domain_name = user_domain_name , project_domain_name = project_domain_name , trust_id = trust_id ) ) #NEWLINE# auth = keystone_identity . v3 . Password ( ** passwd_kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# passwd_kwargs . update ( dict ( tenant_name = project_name , trust_id = trust_id ) ) #NEWLINE# auth = keystone_identity . v2 . Password ( ** passwd_kwargs ) #NEWLINE# #UNINDENT# return auth