Package pyxmpp2 :: Module streamsasl :: Class DefaultPasswordManager
[hide private]

Class DefaultPasswordManager


Default password manager.
Nested Classes [hide private]

Inherited from sasl.core.PasswordManager: __metaclass__

Instance Methods [hide private]
 
__init__(self, settings)
x.__init__(...) initializes x; see help(type(x)) for signature
 
set_stream(self, stream)
Set a stream associated with this password manager.
unicode,`str` tuple.
get_password(self, username, realm=None, acceptable_formats=('plain'))
Get the password for user authentication.
bool
check_authzid(self, authzid, extra_info=None)
Check authorization id provided by the client.
list of unicode
get_realms(self)
Get realms available for client authentication.
unicode
choose_realm(self, realm_list)
Choose authentication realm from the list provided by the server.
unicode
get_serv_type(self)
Get the server name for SASL authentication.
unicode
get_serv_name(self)
Get the service name for SASL authentication.
unicode
get_serv_host(self)
Get the service host name for SASL authentication.

Inherited from sasl.core.PasswordManager: check_password, generate_nonce

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from sasl.core.PasswordManager: __abstractmethods__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

set_stream(self, stream)

 
Set a stream associated with this password manager.
Parameters:

get_password(self, username, realm=None, acceptable_formats=('plain'))

 

Get the password for user authentication.

[both client or server]

If stream initiator: return the value of the "password" setting if username patches the "username" setting or local jid localpart.

If stream receiver - lookup the password in the "user_passwords" setting.

Parameters:
  • username (unicode) - the username for which the password is requested.
  • realm (unicode) - the authentication realm for which the password is requested.
  • acceptable_formats (sequence of str) - a sequence of acceptable formats of the password data. Could be "plain", "md5:user:realm:password" or any other mechanism-specific encoding. This allows non-plain-text storage of passwords. But only "plain" format will work with all password authentication mechanisms.
Returns: unicode,`str` tuple.
the password and its encoding (format).
Overrides: sasl.core.PasswordManager.get_password

check_authzid(self, authzid, extra_info=None)

 

Check authorization id provided by the client.

[server only]

Allow only no authzid or authzid equal to current username@domain

Parameters:
  • authzid (unicode) - authorization id provided.
  • extra_info (mapping) - additional information about the user from the authentication backend. This mapping will usually contain at least 'username' item.
Returns: bool
True if user is authorized to use that authzid.
Overrides: sasl.core.PasswordManager.check_authzid

get_realms(self)

 

Get realms available for client authentication.

[server only]

Returns: list of unicode
list of realms.
Overrides: sasl.core.PasswordManager.get_realms

choose_realm(self, realm_list)

 

Choose authentication realm from the list provided by the server.

[client only]

Use domain of the own JID if no realm list was provided or the domain is on the list or the first realm on the list otherwise.

Parameters:
  • realm_list (list of unicode) - realm list provided by the server.
Returns: unicode
the realm chosen.
Overrides: sasl.core.PasswordManager.choose_realm

get_serv_type(self)

 
Get the server name for SASL authentication.
Returns: unicode
'xmpp'.
Overrides: sasl.core.PasswordManager.get_serv_type

get_serv_name(self)

 
Get the service name for SASL authentication.
Returns: unicode
domain of the own JID.
Overrides: sasl.core.PasswordManager.get_serv_name

get_serv_host(self)

 
Get the service host name for SASL authentication.
Returns: unicode
domain of the own JID.
Overrides: sasl.core.PasswordManager.get_serv_host