[security] Introduce token factory and generic token factory