Authentication API overview

Last updated on
15 June 2017

This documentation is incomplete. Add more information.

The Authentication API is new in Drupal 8.

API features

Ordered by most to least frequently used APIs:

Authentication provider services
Implement \Drupal\Core\Authentication\AuthenticationProviderInterface and use the 'authentication_provider' service tag.
_auth option on routes
The default authentication manager (see below) enables developers to limit the set of allowed authentication mechanisms to the specified subset by specifying _auth in a route's options.
Example: _auth: ['basic_auth', 'cookie']
Authentication manager
The authentication manager (\Drupal\Core\Authentication\AuthenticationManager) calls the different authentication provider services based on each service's priority.
The manager can be overridden for very advanced use cases; 99.9% of the time the default implementation should be sufficient.

See also