linotp.useridresolver.PasswdIdResolver module¶
- This module implements the communication interface
for resolving 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 linotp.useridresolver.PasswdIdResolver.IdResolver¶
Bases:
UserIdResolver
- checkDescription(line, pattern)¶
- checkEmail(line, pattern)¶
- checkPass(uid, password)¶
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)¶
check for the userId
- checkUserName(line, pattern)¶
check for user name
- close()¶
request hook - to close down resolver object
- db_prefix = 'useridresolver.PasswdIdResolver.IdResolver'¶
- fields = {'description': 0, 'email': 0, 'gender': 0, 'givenname': 0, 'mobile': 0, 'phone': 0, 'surname': 0, 'userid': 1, 'username': 1}¶
- classmethod getResolverClassDescriptor()¶
return the descriptor of the resolver, which is - the class name and - the config description
- Returns
resolver description dict
- Return type
dict
- classmethod getResolverClassType()¶
provide the resolver type for registration
- getResolverDescriptor()¶
return the descriptor of the resolver, which is - the class name and - the config description
- Returns
resolver description dict
- Return type
dict
- getResolverId(LoginName)¶
returns the resolver identifier string
empty string if not exist
- getResolverType()¶
getResolverType - return the type of the resolver
- Returns
returns the string ‘ldapresolver’
- Return type
string
- getSearchFields(searchDict=None)¶
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)¶
- 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)¶
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: dict)¶
get a list of all users matching the search criteria of the searchdict
- Parameters
searchDict – dict of search expressions
- getUsername(userId)¶
## TODO: why does this return bool
- Parameters
userId – the user to be searched
- Returns
true, if a user id exists
- loadConfig(configDict)¶
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()¶
- init loads the /etc/passwd
user and uid as a dict for / user loginname lookup
- resolver_parameters: Dict[str, Tuple[bool, Optional[Union[str, bool, int]], Callable[[Any], Any]]] = {'fileName': (True, None, <class 'str'>), 'readonly': (False, False, <function boolean>)}¶
- sF = {'cryptpass': 1, 'description': 4, 'email': 4, 'userid': 2, 'username': 0}¶
- searchFields = {'description': 'text', 'email': 'text', 'userid': 'numeric', 'username': 'text'}¶
- classmethod setup(config=None, cache_dir=None)¶
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)¶
- linotp.useridresolver.PasswdIdResolver.str2unicode(input_str)¶
convert as binary string into a unicode string by trying various encodings :param input_str: input binary string :return: unicode output
- linotp.useridresolver.PasswdIdResolver.tokenise(r)¶