CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.6 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.6
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • AbstractPasswordHasher
  • ActionsAuthorize
  • BaseAuthenticate
  • BaseAuthorize
  • BasicAuthenticate
  • BlowfishAuthenticate
  • BlowfishPasswordHasher
  • ControllerAuthorize
  • CrudAuthorize
  • DigestAuthenticate
  • FormAuthenticate
  • SimplePasswordHasher

Class BaseAuthenticate

Base Authentication class with common methods and properties.

BaseAuthenticate implements CakeEventListener
Direct Subclasses
  • BasicAuthenticate
  • FormAuthenticate
Indirect Subclasses
  • BlowfishAuthenticate
  • DigestAuthenticate
Abstract
Package: Cake\Controller\Component\Auth
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Location: Cake/Controller/Component/Auth/BaseAuthenticate.php

Properties summary

  • $_Collection protected
    ComponentCollection
    A Component collection, used to get more components.
  • $_passwordHasher protected
    AbstractPasswordHasher
    Password hasher instance.
  • $settings public
    array
    Settings for this object.

Method Summary

  • __construct() public
    Constructor
  • _findUser() protected
    Find a user record using the standard options.
  • _password() protected deprecated

    Hash the plain text password so that it matches the hashed/encrypted password in the datasource.

  • authenticate() abstract public
    Authenticate a user based on the request information.
  • getUser() public

    Get a user based on information in the request. Primarily used by stateless authentication systems like basic and digest auth.

  • implementedEvents() public
    Implemented events
  • logout() public

    Allows you to hook into AuthComponent::logout(), and implement specialized logout behavior.

  • passwordHasher() public
    Return password hasher object
  • unauthenticated() public
    Handle unauthenticated access attempt.

Method Detail

__construct() public ¶

__construct( ComponentCollection $collection , array $settings )

Constructor

Parameters
ComponentCollection $collection
The Component collection used on this request.
array $settings
Array of settings to use.

_findUser() protected ¶

_findUser( string|array $username , string $password = null )

Find a user record using the standard options.

The $username parameter can be a (string)username or an array containing conditions for Model::find('first'). If the $password param is not provided the password field will be present in returned array.

Input passwords will be hashed even when a user doesn't exist. This helps mitigate timing attacks that are attempting to find valid usernames.

Parameters
string|array $username
The username/identifier, or an array of find conditions.
string $password optional null
The password, only used if $username param is string.
Returns
boolean|array
Either false on failure, or an array of user data.

_password() protected deprecated ¶

_password( string $password )

Hash the plain text password so that it matches the hashed/encrypted password in the datasource.

Deprecated
3.0.0 Since 2.4. Use a PasswordHasher class instead.
Parameters
string $password
The plain text password.
Returns
string
The hashed form of the password.

authenticate() abstract public ¶

authenticate( CakeRequest $request , CakeResponse $response )

Authenticate a user based on the request information.

Parameters
CakeRequest $request
Request to get authentication information from.
CakeResponse $response
A response object that can have headers added.
Returns
mixed
Either false on failure, or an array of user data on success.

getUser() public ¶

getUser( CakeRequest $request )

Get a user based on information in the request. Primarily used by stateless authentication systems like basic and digest auth.

Parameters
CakeRequest $request
Request object.
Returns
mixed
Either false or an array of user information

implementedEvents() public ¶

implementedEvents( )

Implemented events

Returns
array
of events => callbacks.
Implementation of
CakeEventListener::implementedEvents()

logout() public ¶

logout( array $user )

Allows you to hook into AuthComponent::logout(), and implement specialized logout behavior.

All attached authentication objects will have this method called when a user logs out.

Parameters
array $user
The user about to be logged out.

passwordHasher() public ¶

passwordHasher( )

Return password hasher object

Returns
AbstractPasswordHasher
Password hasher instance
Throws
CakeException

If password hasher class not found or it does not extend AbstractPasswordHasher


unauthenticated() public ¶

unauthenticated( CakeRequest $request , CakeResponse $response )

Handle unauthenticated access attempt.

Parameters
CakeRequest $request
A request object.
CakeResponse $response
A response object.
Returns
mixed

Either true to indicate the unauthenticated request has been dealt with and no more action is required by AuthComponent or void (default).


Properties detail

$_Collection ¶

protected ComponentCollection

A Component collection, used to get more components.

$_passwordHasher ¶

protected AbstractPasswordHasher

Password hasher instance.

$settings ¶

public array

Settings for this object.

  • fields The fields to use to identify a user by.
  • userModel The model name of the User, defaults to User.
  • userFields Array of fields to retrieve from User model, null to retrieve all. Defaults to null.
  • scope Additional conditions to use when looking up and authenticating users, i.e. array('User.is_active' => 1).
  • recursive The value of the recursive key passed to find(). Defaults to 0.
  • contain Extra models to contain and store in session.
  • passwordHasher Password hasher class. Can be a string specifying class name or an array containing className key, any other keys will be passed as settings to the class. Defaults to 'Simple'.
array(
    'fields' => array(
        'username' => 'username',
        'password' => 'password'
    ),
    'userModel' => 'User',
    'userFields' => null,
    'scope' => array(),
    'recursive' => 0,
    'contain' => null,
    'passwordHasher' => 'Simple'
)
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs