SlideShare a Scribd company logo
1 of 51
Darby Felton PHP Developer, Zend Technologies Implementing Access Control with Zend Framework
Topics Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction to Zend Framework Zend Framework facilitates development of PHP applications that require authentication and access control by providing flexible and extensible components built using the object-oriented features of PHP 5
Introduction to Zend Framework ,[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction to Zend Framework ,[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction to Zend Framework ,[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction to Zend Framework ,[object Object],[object Object],[object Object],[object Object],[object Object]
Authenticating with Zend_Auth Authentication – determining whether an entity is actually what it purports to be, based on some set of credentials
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],[object Object],[object Object]
Authenticating with Zend_Auth ,[object Object],class MyAuthAdapter implements Zend_Auth_Adapter_Interface { /** * Performs an authentication attempt      * @throws Zend_Auth_Adapter_Exception      * @return Zend_Auth_Result      */   public function authenticate()     {     } }
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],[object Object],[object Object]
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],[object Object],[object Object]
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],assert(Zend_Auth::getInstance() instanceof Zend_Auth);
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object]
Authenticating with Zend_Auth ,[object Object],[object Object],$authAdapter = new MyAuthAdapter($username, $password); $auth = Zend_Auth::getInstance(); $result = $auth->authenticate($authAdapter); if (!$result->isValid()) {     foreach ($result->getMessages() as $message) {         echo "$message";     } }
Authenticating with Zend_Auth ,[object Object],[object Object],$authAdapter = new MyAuthAdapter($username, $password); $result = $authAdapter->authenticate(); if (!$result->isValid()) {     foreach ($result->getMessages() as $message) {         echo "$message";     } }
Authenticating with Zend_Auth ,[object Object],[object Object],[object Object],[object Object]
Access Control Lists with Zend_Acl Zend_Acl provides role-based access control lists functionality and privileges management
Access Control Lists with Zend_Acl ,[object Object],[object Object],[object Object]
Access Control Lists with Zend_Acl ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Access Control Lists with Zend_Acl ,[object Object],[object Object],class MyResource implements Zend_Acl_Resource_Interface { /** * @return string */ public function getResourceId() {} }
Access Control Lists with Zend_Acl ,[object Object],[object Object],New York Zend_Acl Resources San Francisco Chrysler Transamerica Bank of America Empire State
Access Control Lists with Zend_Acl ,[object Object],<?php $acl = new Zend_Acl(); $acl->addRole(new Zend_Acl_Role('guest')); $acl->add(new Zend_Acl_Resource('New York')) ->add(new Zend_Acl_Resource('Empire State'), 'New York') ->add(new Zend_Acl_Resource('Chrysler'), 'New York'); $acl->allow('guest', 'New York')   ->deny('guest', 'Empire State'); echo $acl->isAllowed('guest', 'Empire State') ? 'allowed' : 'denied'; echo $acl->isAllowed('guest', 'Chrysler') ? 'allowed' : 'denied';
Access Control Lists with Zend_Acl ,[object Object],[object Object],class MyRole implements Zend_Acl_Role_Interface { /** * @return string */ public function getRoleId() {} }
Access Control Lists with Zend_Acl ,[object Object],[object Object],[object Object],member sales support guest visitor admin dev joe
Access Control Lists with Zend_Acl ,[object Object],$acl = new Zend_Acl(); $acl->addRole(new Zend_Acl_Role('guest'))     ->addRole(new Zend_Acl_Role('member'))     ->addRole(new Zend_Acl_Role('admin')); $parents = array('guest', 'member', 'admin'); $acl->addRole(new Zend_Acl_Role('someUser'), $parents); $acl->add(new Zend_Acl_Resource('someResource')); $acl->deny('guest', 'someResource'); $acl->allow('member', 'someResource'); echo $acl->isAllowed('someUser', 'someResource') ? 'allowed' : 'denied';
Access Control Lists with Zend_Acl ,[object Object],[object Object],[object Object],[object Object],$acl->allow($someRole, $someResource, 'view'); $acl->deny($someRole, $someResource, array('edit', 'delete')); if ($acl->isAllowed($someRole, $someResource, 'view')) { ...
Access Control Lists with Zend_Acl ,[object Object],[object Object],$acl = new Zend_Acl(); $acl->allow(null, null, array('privilege 1', 'privilege 2')); assert(!$acl->isAllowed()); assert($acl->isAllowed(null, null, 'privilege 1')); assert($acl->isAllowed(null, null, 'privilege 2')); $acl->removeAllow(null, null, 'privilege 1'); assert(!$acl->isAllowed(null, null, 'privilege 1')); assert($acl->isAllowed(null, null, 'privilege 2'));
Access Control Lists with Zend_Acl ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Access Control Lists with Zend_Acl ,[object Object],class My_Acl_Assert_DirtyIP implements Zend_Acl_Assert_Interface { public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null,                            Zend_Acl_Resource_Interface $resource = null,   $privilege = null) { return $this->_isDirtyIP($_SERVER['REMOTE_ADDR']); } protected function _isDirtyIP($address) {} }
Access Control Lists with Zend_Acl ,[object Object],[object Object],$acl = new Zend_Acl(); $acl->deny(null, null, null, new My_Acl_Assert_DirtyIP());
Putting it Together with MVC The Model View Controller pattern separates an application design into three distinct roles, facilitating development and maintenance
Putting it Together with MVC ,[object Object],[object Object],[object Object]
Putting it Together with MVC ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Application “Example isn't another way to teach, it is the only way to teach” - Albert Einstein
Example Application ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example Application ,[object Object],CREATE DATABASE `myapp`; CREATE TABLE `myapp`.`user` ( `id` int(10) unsigned NOT NULL auto_increment, `username` char(32) NOT NULL, `password` char(32) NOT NULL, `fullname` char(32) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) COMMENT='user accounts';
Example Application ,[object Object],INSERT INTO user (username, password, fullname) VALUES ('admin', MD5('admin'), 'Administrator'), ('someuser', MD5('someuser'), 'Some User');
Example Application ,[object Object],[object Object],RewriteEngine on RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1
Example Application ,[object Object],[object Object],<?php require_once 'application/library/My/App.php'; My_App::getInstance()->run();
Example Application ,[object Object],[object Object],$frontController = Zend_Controller_Front::getInstance(); $frontController->throwExceptions(true) ->registerPlugin(new My_Controller_Plugin_Auth()) ->returnResponse(true);
Example Application ,[object Object],$acl = $this->getAcl(); $acl->add(new Zend_Acl_Resource('index')) ->add(new Zend_Acl_Resource('login')) ->add(new Zend_Acl_Resource('logout')) ->add(new Zend_Acl_Resource('profile')) ->addRole(new Zend_Acl_Role('anonymous')) ->addRole(new Zend_Acl_Role('member'), 'anonymous') ->addRole(new Zend_Acl_Role('admin'), 'member') ->allow() ->deny(null, 'profile') ->allow('member', 'profile');
Example Application ,[object Object],[object Object],try { $response = $frontController->dispatch(); $response->sendResponse(); } catch (Exception $e) { echo $e->getMessage(); }
Example Application ,[object Object],class My_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract { public function preDispatch(Zend_Controller_Request_Abstract $request) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { switch ($auth->getIdentity()->username) { case 'admin': $role = 'admin'; break; default: $role = 'member'; break; } } else { $role = 'anonymous'; } // continued on next slide...
Example Application // ...continued from previous slide $request = $this->getRequest(); $controllerName = $request->getControllerName(); $acl = My_App::getInstance()->getAcl(); if (!$acl->has($controllerName)) { throw new Exception('Sorry, the requested controller does not' . 'exist as an ACL resource'); } if (!$acl->isAllowed($role, $controllerName, $request->getActionName())) { $request->setControllerName('index') ->setActionName('denied') ->setDispatched(false); } } }
Example Application ,[object Object],class My_Controller_Action extends Zend_Controller_Action { public function preDispatch() { $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view; $auth = Zend_Auth::getInstance(); if ($view->authenticated = $auth->hasIdentity()) { $view->user = new My_Model_User($auth->getIdentity()); } else { $view->user = new My_Model_User(); } $view->baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); } public function __call($name, $args) { throw new Exception('Sorry, the requested action does not exist'); } }
Example Application ,[object Object],[object Object],[object Object],[object Object]
Example Application ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example Application ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Thank you! More about Zend Framework: http://framework.zend.com

More Related Content

What's hot

jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
D
 
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
D
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
Jace Ju
 

What's hot (20)

Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learnedMoving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
 
Extend sdk
Extend sdkExtend sdk
Extend sdk
 
Disregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_FormDisregard Inputs, Acquire Zend_Form
Disregard Inputs, Acquire Zend_Form
 
PHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the testsPHPUnit Episode iv.iii: Return of the tests
PHPUnit Episode iv.iii: Return of the tests
 
PHPSpec BDD for PHP
PHPSpec BDD for PHPPHPSpec BDD for PHP
PHPSpec BDD for PHP
 
Php Security
Php SecurityPhp Security
Php Security
 
Seam Glassfish Slidecast
Seam Glassfish SlidecastSeam Glassfish Slidecast
Seam Glassfish Slidecast
 
PHPunit and you
PHPunit and youPHPunit and you
PHPunit and you
 
WCLV13 JavaScript
WCLV13 JavaScriptWCLV13 JavaScript
WCLV13 JavaScript
 
Hooks WCSD12
Hooks WCSD12Hooks WCSD12
Hooks WCSD12
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
Things Your Mother Didnt Tell You About Bundle Configurations - Symfony Live…
 
Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3Django - 次の一歩 gumiStudy#3
Django - 次の一歩 gumiStudy#3
 
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
Things Your Mother Didn't Tell You About Bundle Configurations - Symfony Live...
 
Presentation
PresentationPresentation
Presentation
 
Jsp
JspJsp
Jsp
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
PHP Security
PHP SecurityPHP Security
PHP Security
 
Concern of Web Application Security
Concern of Web Application SecurityConcern of Web Application Security
Concern of Web Application Security
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 

Viewers also liked

Viewers also liked (11)

Asset management with Zend Framework 2
Asset management with Zend Framework 2Asset management with Zend Framework 2
Asset management with Zend Framework 2
 
Zend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnitZend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnit
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2
 
Unit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnitUnit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnit
 
Into the ZF2 Service Manager
Into the ZF2 Service ManagerInto the ZF2 Service Manager
Into the ZF2 Service Manager
 
Zend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionZend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency Injection
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Introduction to Unit Testing with PHPUnit
Introduction to Unit Testing with PHPUnitIntroduction to Unit Testing with PHPUnit
Introduction to Unit Testing with PHPUnit
 
Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best PracticesUnit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
 

Similar to Implementing access control with zend framework

Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
King Foo
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
funkatron
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
phelios
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnit
Peter Wilcsinszky
 
vCloud SDK for PHP - Introduction
vCloud SDK for PHP - IntroductionvCloud SDK for PHP - Introduction
vCloud SDK for PHP - Introduction
Pablo Roesch
 

Similar to Implementing access control with zend framework (20)

Authentication with zend framework
Authentication with zend frameworkAuthentication with zend framework
Authentication with zend framework
 
Php frameworks
Php frameworksPhp frameworks
Php frameworks
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
2007 Zend Con Mvc
2007 Zend Con Mvc2007 Zend Con Mvc
2007 Zend Con Mvc
 
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Zendcon 09
Zendcon 09Zendcon 09
Zendcon 09
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
 
Testing persistence in PHP with DbUnit
Testing persistence in PHP with DbUnitTesting persistence in PHP with DbUnit
Testing persistence in PHP with DbUnit
 
Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
Security in laravel
Security in laravelSecurity in laravel
Security in laravel
 
Spring Security 3
Spring Security 3Spring Security 3
Spring Security 3
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
vCloud SDK for PHP - Introduction
vCloud SDK for PHP - IntroductionvCloud SDK for PHP - Introduction
vCloud SDK for PHP - Introduction
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 

Implementing access control with zend framework

  • 1. Darby Felton PHP Developer, Zend Technologies Implementing Access Control with Zend Framework
  • 2.
  • 3. Introduction to Zend Framework Zend Framework facilitates development of PHP applications that require authentication and access control by providing flexible and extensible components built using the object-oriented features of PHP 5
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. Authenticating with Zend_Auth Authentication – determining whether an entity is actually what it purports to be, based on some set of credentials
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19. Access Control Lists with Zend_Acl Zend_Acl provides role-based access control lists functionality and privileges management
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. Putting it Together with MVC The Model View Controller pattern separates an application design into three distinct roles, facilitating development and maintenance
  • 34.
  • 35.
  • 36. Example Application “Example isn't another way to teach, it is the only way to teach” - Albert Einstein
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. Example Application // ...continued from previous slide $request = $this->getRequest(); $controllerName = $request->getControllerName(); $acl = My_App::getInstance()->getAcl(); if (!$acl->has($controllerName)) { throw new Exception('Sorry, the requested controller does not' . 'exist as an ACL resource'); } if (!$acl->isAllowed($role, $controllerName, $request->getActionName())) { $request->setControllerName('index') ->setActionName('denied') ->setDispatched(false); } } }
  • 47.
  • 48.
  • 49.
  • 50.
  • 51. Thank you! More about Zend Framework: http://framework.zend.com