[security] add API to make testing code relying on RestxSession easier