The middleware to check if the request contains at least one roles enabled to
fullfill the requesting resource
@param   {Object}   req  the requsest object
@param   {Object} res  the response object
@param   {Function} next next middlware
@returns {Function} the next middleware or 401
function check_role_authorization(req, res, next) {

    if (!req.hasOwnProperty("user") || !req.user.hasOwnProperty('authorized_roles') ||
        !(req.user.authorized_roles instanceof Array) || req.user.authorized_roles.length === 0){

        running_debug("Unhautorized: Invalid role or path not configured");
        var err = new Error("Unhautorized: Invalid role or path not configured");
        err.status = 401;
        return next(err);

    }

    running_debug("Authorized roles: " + req.user.authorized_roles);
    return next();


}