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

  • SEARCH
  • Home
  • 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 7730735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:18:02+00:00 2026-06-01T06:18:02+00:00

i try to program a LdapAuthentication and i need some help. First i need

  • 0

i try to program a LdapAuthentication and i need some help.

First i need to configure the “$components” in /app/Controller/
Component/AppController.php

<?php
  class AppController extends Controller {
  var $components = array('Auth' => array(
                            'Ldap',
                            'authError' => 'Not allowed here',                         
                           'authenticate' => array('Form' => array(
                                              'fields' => array(
                                                   'username'    => 'username',
                                                   'password' => 'password',
                                                    'domain' => 'domain'
                                     )
                                )
                            ),
                            'authorize' => true,
                          ), 'Session');
                  }
                      ?>

Then i create a LdapAuthorize.php like
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#creating-custom-authorize-objects

              <?php
              App::uses('BaseAuthorize', 'Controller/Component/Auth');

            class LdapAuthorize extends BaseAuthorize {
            public function authorize($user, CakeRequest $request) {
            echo "test";
                }
                 }

              ?>

But when i try to login with

          if ($this->Auth->login()) {
           return $this->redirect($this->Auth->redirect());
          } else {
               $this->Session->setFlash(__('Username or password is incorrect'),
            'default', array(), 'auth');
              }

cakephp doesn’t use my authorize function.

What i do wrong? Please help.

  • 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-06-01T06:18:03+00:00Added an answer on June 1, 2026 at 6:18 am

    Here is a working Ldap Auth class for 2.0.x

    https://github.com/analogrithems/idbroker/tree/dev_cake2.0

    with a blog post detailing it here:

    http://www.analogrithems.com/rant/2012/01/03/cakephp-2-0-ldapauth/

    ** ALSO **

    Your Auth configuration is wrong – the authorize key takes a string or array – a boolean true isn’t going to do anything.

    If you want it to check an isAuthorized action in the controller – set it like so:

    <?php
        ...
        public $components = array( 'Auth' => array(
            ...
            'authorize' => array( 'Controller' ),
            ...
        ));
    ?>
    

    You are passing a boolean parameter here, and have no isAuthorized function in your AppController. Also, you are using old php4 syntax to declare your member variables (use public, protected or private instead of “var”)

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

Sidebar

Related Questions

I am writing a program to try to solve a math problem. I need
I try to program a webboot using PHP/CURL, but I face a problem in
Here is a part from my program: try { Class.forName(com.mysql.jdbc.Driver); InitializeData data = new
hey, Since a few weeks I'm try to program a PHP-Application with the smarty
When I try my program on my win2k8 machine it runs fine but on
My program use UdpClient to try to receive 27 responses from 27 hosts. The
I try to run one program in myeclipse where after creating one web project
In my program I generate classes dynamically but when I try: String[] args =
In order to try out how to program with the Win32 API, I wrote
I try to call the esriRegAsm.exe with arguments from a C# program. The purpose

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.