How to allow a route to a user as long as he has the good role? Maybe this is a noob question but here goes:

I have a menu a menu that contains four links. However, I need one of the items to be accessible only if the current user has "beneficiary" as role.

Since the user's 'roles' is an array containing all kind of roles, how can I set my route in a way that as long as the user has the correct role ?

IE, let's say that a random user has the following:

$user['roles'] = ['authenticated', 'beneficiary', 'elected'];


and would pass, but another random user having the following:

$user['roles'] = ['authenticated', 'elected'];


wouldn't.

I'm pretty sure there is a way but I can't find explicitely what I'm looking for in Drupal's documentation

Thank you in advance
I've never personally tried this, but it looks like in your routing.yml file, you can specify a _role permission under requirements:

https://www.drupal.org/docs/8/api/routing-system/structure-of-routes

my_module.your_route:
  path: '/your_menu_path'
  defaults:
    _controller: '\path\to\your\controller'
    _title: 'Menu title'
  requirements:
    _role: 'beneficiary'