Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6552031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:24:36+00:00 2026-05-25T12:24:36+00:00

I set up a Zend_Acl and Zend_Auth scheme where user is authenticated using Zend_Auth_Adapter_Ldap

  • 0

I set up a Zend_Acl and Zend_Auth scheme where user is authenticated using Zend_Auth_Adapter_Ldap and stored in session. I use a controller plugin to check if $auth->hasIdentity() and $acl->isAllowed() to display login form if needed.

What I want to do is to add login cookies (my implementation of best practices), and API keys in addition to the session check in Zend_Auth. I also need to switch the role to ‘owner’, on content created by the user.

My concerns:

  • Login cookie should only be used as fallback if regular session auth fails, and thus the session should be authenticated
  • API keys should be used as fallback if both login cookie and session cookie fails
  • I don’t want to store the password anywhere, it should only reside in LDAP
  • I need persistent storage of the identity, as looking it up in LDAP is not possible without full username and password
  • The role is dependent both on LDAP group membership (which needs to be persistently stored), and if the identity should be considered owner of the content (meaning it’s changing in between requests, unless admin)

What’s a good pattern / approach to solve this using Zend Framework MVC and Zend_Auth + Zend_Acl ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:24:36+00:00Added an answer on May 25, 2026 at 12:24 pm

    you can create your own adapter/storage classes, with implementing Zend_Auth_Adpater_Interface and Zend_Auth_Storage_Interface

    In these classes, you can re-use original adapters (like LDAP) or storages, and only write the code that implements your auth rules.

    for example, using multiple sources for the Zend_Auth_Adapter :

    <?php 
    class My_Auth_Adapter implements Zend_Auth_Adapter_Interface
    {
        private $ldapAdapter;
        private $cookieAdapter;
        private $apiKeyAdapter;
    
        public function __construct($ldapAdapter, $cookieAdapter, $apiKeyAdapter) {
        {
            $this->ldapAdapter = $ldapAdapter;
            $this->cookieAdapter = $cookieAdapter;
            $this->apyKeyAdapter = $apiKeyAdapter;
        }
        public function authenticate()
        {
             if ($this->ldapAdapter->authenticate()) {
                 //return the Zend_Auth_Restult
             } elseif ($this->cookieAdapter->authenticate() {
                //return the result
             } elseif ($this->apiKeyAdapter->authenticate() {
               //return the result
             } else {
               //Create and return a Zend_Auth_Result which prevents logging in
              }
         }
    }
    

    I am not sure to understand your login rules, but the concept remains the same for the Storage class :

     <?php 
     class My_Auth_Storage implements Zend_Auth_Storage_Interface
      private $sessionStorage;
      private $cookieStorage;
      private $apiStorage;
    
      public function read()
      {
          if (!$this->sessionStorage->isEmpty())
          {
               return $this->sessionStorage->read();
          } elseif (!$this->cookieStorage->isEmpty())
          { 
               return $this->cookieStorage->read();
          } //And so one, do not forget to implement all the interface's methods
    

    With this implementation, you can have multiple credential sources, and multiple session storage engines (cookie, session, db, or whatever you want to use).

    For your acl concerns, you can fetch the LDAP group in you controller plugin and store it wherever you need, after authentication. You can then use a second plugin that checks ACLs on each request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I find the type of device using WURFL.Also i have written plugin to set
I set up a Zend Framework application using Zend_Tool, but I wanted multiple modules
I'm using Zend_Form to output a set group of checkboxes: <label style=white-space: nowrap;><input type=checkbox
I'm trying to use an array to set the where parameters for a Zend
I'm contemplating using Zend_ACL. However, to me it looks like you create roles and
I have a Web service set up using Zend_Soap, and some public methods in
I have based my application upon the Zend Framework. I am using Zend_Auth for
I want to use the navigation helper to build my navigation menus using Acl.
I'm looking for a way to set the month of Zend_Date using a string
What causes a row ( Zend_Db_Table_Row ) to be set to readOnly ? I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.