6.2.1.4. useridresolver.SQLIdResolver module¶
- This module implements the communication and data mapping to SQL servers.
- The LinOTP server imports this module to use SQL databases as a userstore.
Dependencies: UserIdResolver
- class useridresolver.SQLIdResolver.IdResolver[source]¶
Bases: useridresolver.UserIdResolver.UserIdResolver
- checkPass(uid, password)[source]¶
checkPass - checks the password for a given uid.
Parameters: - uid (string) – userid to be checked
- password (string) – user password
:return : true in case of success, false if password does not match :rtype : boolean
Todo : extend to support htpasswd passwords: http://httpd.apache.org/docs/2.2/misc/password_encryptions.html
- getConfigEntry(config, key, conf, required=True, default='')[source]¶
getConfigEntry - retrieve an entry from the config
Parameters: - config (dict) – dict of all configs
- key (string) – key which is searched
- conf (string) – scope of the config eg. connect.sql
- required (boolean) – if this value ist true and the key is not defined, an exception sill be raised
- default (any) – fallback value if confg has no such entry
Returns: the value of the specified key
Return type: value type - in most cases string ;-)
- 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
- getResolverId()[source]¶
getResolverId - provide the resolver identifier
Returns: returns the resolver identifier string or empty string if not exist :rtype : string
- getResolverType()[source]¶
getResolverType - return the type of the resolver
Returns: returns the string ‘sqlresolver’ Return type: string
- getSearchFields()[source]¶
return all fields on which a search could be made
Returns: dictionary of the search fields and their types Return type: dict
- getUserId(loginName)[source]¶
return the userId which mappes to a loginname
Parameters: loginName (string) – login name of the user Returns: userid - unique idenitfier for this unser Return type: string
- getUserInfo(userId)[source]¶
return all user related information
@param userId: specied user @type userId: string @return: dictionary, containing all user related info @rtype: dict
- getUserList(searchDict)[source]¶
retrieve a list of users
Parameters: searchDict (dict) – dictionary of the search criterias Returns: list of user descriptions (as dict)
- getUsername(userId)[source]¶
get the loginname from the given userid
Parameters: userId (string) – userid descriptor Returns: loginname Return type: string
- class useridresolver.SQLIdResolver.dbObject[source]¶
- useridresolver.SQLIdResolver.make_connect(driver, user, pass_, server, port, db, conParams='')[source]¶
create a connect string from decicated parts - to build a SQLAlchemy Uri
Parameters: - driver (string) – mysql, postgres, ...
- user (string) – database connection user
- pass (string) – password of the database user
- server (string) – servername
- port (string or int) – database connection port
- db (string) – database name
- conParams (string) – additional connection parameters