useridresolver.PasswdIdResolver module

This module implements the communication interface
for resolvin user info to the /etc/passwd user base
PasswdIdResolver.IdResolver class
implements the UserIdResolver for local /etc/passwd lookup
Remarks:
Don’t use this as an enterprise solution!
class useridresolver.PasswdIdResolver.IdResolver[source]

Bases: useridresolver.UserIdResolver.UserIdResolver

checkDescription(line, pattern)[source]
checkEmail(line, pattern)[source]
checkPass(uid, password)[source]

This function checks the password for a given uid. - returns true in case of success - false if password does not match

We do not support shadow passwords at the moment. so the seconds column of the passwd file needs to contain the crypted password

checkUserId(line, pattern)[source]

check for the userId

checkUserName(line, pattern)[source]

check for user name

close()[source]

request hook - to close down resolver object

fields = {'username': 1, 'phone': 0, 'surname': 0, 'description': 0, 'mobile': 0, 'gender': 0, 'givenname': 0, 'userid': 1, 'email': 0}
getConfigEntry(config, key, conf, required=True)[source]
classmethod getResolverClassDescriptor()[source]

return the descriptor of the resolver, which is - the class name and - the config description

Returns:resolver description dict
Return type:dict
classmethod getResolverClassType()[source]
getResolverDescriptor()[source]
getResolverId(LoginName)[source]
  • returns the resolver identifier string
  • empty string if not exist
getResolverType()[source]
getSearchFields(searchDict=None)[source]

show, which search fields this userIdResolver supports

TODO: implementation is not completed

Parameters:searchDict – fields, which should be queried
Returns:dict of all searchFields
getUserId(LoginName)[source]
search the user id from the login name
we need the encoding no more as the input is converted to unicode by the str2unicode function
Parameters:LoginName – the login of the user
Returns:the userId
getUserInfo(userId, no_passwd=False)[source]

get some info about the user as we only have the loginId, we have to traverse the dict for the value

Parameters:
  • userId – the to be searched user
  • no_passwd – retrun no password
Returns:

dict of user info

getUserList(searchDict)[source]

get a list of all users matching the search criteria of the searchdict

Parameters:searchDict – dict of search expressions
getUsername(userId)[source]

## TODO: why does this return bool

Parameters:userId – the user to be searched
Returns:true, if a user id exists
loadConfig(configDict)[source]

The UserIdResolver could be configured from the pylon app config - here this could be the passwd file , whether it is /etc/passwd or /etc/shadow

loadFile()[source]
init loads the /etc/passwd
user and uid as a dict for / user loginname lookup
sF = {'username': 0, 'userid': 2, 'description': 4, 'cryptpass': 1, 'email': 4}
searchFields = {'username': 'text', 'userid': 'numeric', 'description': 'text', 'email': 'text'}
classmethod setup(config=None, cache_dir=None)[source]

this setup hook is triggered, when the server starts to serve the first request

Parameters:config (the linotp config dict) – the linotp config
stringMatch(cString, cPattern)[source]
useridresolver.PasswdIdResolver.str2unicode(input_str)[source]

convert as binary string into a unicode string by trying various encodings :param input_str: input binary string :return: unicode output

useridresolver.PasswdIdResolver.tokenise(r)[source]