Authentication in Drupal
Juampy Novillo Requena
DrupalCamp Spain 2014
Authentication in Drupal DrupalCamp Spain 2014 About me, @juampy72 - - PowerPoint PPT Presentation
Juampy Novillo Requena Authentication in Drupal DrupalCamp Spain 2014 About me, @juampy72 Drupal 7 and 8 module Developer at Lullabot maintainer and core developer Let's start by defining Authentication and Authorization Authentication
Juampy Novillo Requena
DrupalCamp Spain 2014
Drupal 7 and 8 module maintainer and core developer Developer at Lullabot
Show me your ID, sucker!
None shall pass!!
http://symfony.com/doc/current/book/security.html
Drupal 8 implements a Modular Authentication System. Different Authentication Providers may extract a Drupal $user out of a given $request.
Cookie Returns authenticated or anonymous user depending on the presence of a cookie. Basic Auth Checks if user & password are in the request headers and finds a matching user in the DB.
php > print base64_encode('test:test');
https://drupal.org/node/2076725
Supports OAuth 1.0a protocol (Twitter, Flickr). No support for OAuth2 (Facebook) yet :-( Will be implemented at OAuth2 Server
REQUEST RESPONSE
https://drupal.org/project/guzzle_oauth
Client
Request /latest-news Authorization: Basic pvcGVuIHNlc2ZQ==
Server
Drupal bootstraps Authentication Manager $request
$request Basic Auth.authenticate() $user Access Controllers (EntityaccessController, MenuAccessController...) Build response OK 200
sleeping with the gorilas after a fun night
by not doing a striptease TRUE
AUTHENTICATION AUTHORIZATION
Quick check to see if we can authenticate If the above is TRUE, proceed and attempt to extract a $user.
This makes the class discoverable. Higher priority means that it will try to authenticate before others The Authentication Manager looks for services tagged as authentication_provider
http://hillsidek9academy.com/wp-content/uploads/2013/12/dog-training.jpg
friendly_support module Makes it impossible to send support requests by ading HTTP authentication to the Contact form ;D
$provider is an identifier for a set of routes. Normally is the module name. Here is where we add authentication rules
Change record
We can do it from the route definition.
Allowed methods: Basic Authentication This is part of Authorization: only authenticated users can access.
Recommended read: REST: exposing data as RESTful web services
REST UI offers site builders an interface to set up a REST API, including output formats and authentication.
https://drupal.org/node/2228141
Providers:
○ OAuth2 ○ Digest Authentication ○ IP based authentication
about.me/juampy @juampy72