Hash the token id if it is over a maximum length

Instead of exclusively hashing the token id based on if the token is
ASN1, hash the id if it exceeds the maximum size allowed within the
session. Keystone has allowed more than simple PKI and UUID tokens so
the is_asn1_token check will not catch all cases.

Closes-Bug: 1331406

Change-Id: I7891eb3fb35a10926ac16829eed0ff8c306f2661