allow functions for returnURL and realm
fixes #21