Made some rework for compatibility with CsnAuthorization