[KARAF-2636] Improve security mechanism