Random PIN generation - base pinhandler class not receiving full user data
Hi!
I have an privacyIDEA installation running on Ubuntu Server 18.04 LTS, installed via Ubuntu Packages.
For our use-case it’s a mandatory feature to have a random PIN generated automatically upon token enrollment and send it to the user via SMS. I therefor want to use the default pinhandler class and modify it to our needs. The default function of the class works, so the PIN is logged. Unfortunately I’m not able to deliver the SMS via a request.get (or request.post) because the phone number of the user somehow is missing in the object delivered to the pinhandler (although in the sourcecode is mentioned to receive it from privacyIDEA).
It receives the necessary data like
* the PIN
* the serial number of the token
* the username
* all other user data:
* given name, surname
* email address
* telephone
* mobile (if the module would deliver via SMS)
* the administrator name (who enrolled the token)
I added under the log line a simple prints to verify the content of the variables:
[...]
# The most simple way of handling a random PIN! ;-)
print (pin)
print (serial)
print (user)
print (tokentype)
print (logged_in_user)
print (userdata)
print (options)
log.info("PIN {0!r} TOKENSN {1!r} forUSERNAME {2!r} ENROLLEDBY {3!r} USER {4!r} TOKENTYPE {5!r}".format(pin,serial,user, logged_in_user.get("username"), user, tokentype))
[...]
However, the output in Apache Error Log from Flask remains “None” for userdata:
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277341 2020] [wsgi:error] [pid 20746:tid 140614714185472] [remote 192.168.1.100:49239] laSE3U
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277372 2020] [wsgi:error] [pid 20746:tid 140614714185472] [remote 192.168.1.100:49239] N/A
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277388 2020] [wsgi:error] [pid 20746:tid 140614714185472] [remote 192.168.1.100:49239] <testuser@test>
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277396 2020] [wsgi:error] [pid 20746:tid 140614714185472] [remote 192.168.1.100:49239] email
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277405 2020] [wsgi:error] [pid 20746:tid 140614714185472] [remote 192.168.1.100:49239] {'username': 'admin', 'realm': '', 'role': 'admin'}
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277405 2020] [wsgi:error] [pid 20929:tid 140614714185472] [remote 192.168.1.100:49865] None
/var/log/apache2/error.log.2.gz:[Fri Aug 07 14:03:51.277405 2020] [wsgi:error] [pid 20929:tid 140614714185472] [remote 192.168.1.100:49865] None
At first I had the impression it’s related to misconfigured sqlite mappings but the I’m encountering the same when trying to deploy a token to an LDAP user - the phone numbers are displayed correctly in the userlist though. I also tried removing the default values of the “send” function variables ("= None") which ended up generating python errors.
Is this an expected error or am I missing something here? Appreciate any help
BR