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
    • IRC
    • Slack
    • Paid Support
CakePHP

C Authorization 2.x API

  • Project:
    • Authorization
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 2.x
      • 3.x
      • 2.x

Namespaces

  • Authorization
    • Command
    • Controller
    • Exception
    • Middleware
      • UnauthorizedHandler
    • Policy

Class CakeRedirectHandler

This handler will redirect the response if one of configured exception classes is encountered.

CakePHP Router compatible array URL syntax is supported.

Namespace: Authorization\Middleware\UnauthorizedHandler

Property Summary

  • $defaultOptions protected
    array

    Default config:

Method Summary

  • __construct() public

    Constructor.

  • checkException() protected

    Checks if an exception matches one of the classes.

  • getUrl() protected

    Returns the url for the Location header.

  • handle() public

    Handles the unauthorized request. The modified response should be returned.

Method Detail

__construct() ¶ public

__construct()

Constructor.

Throws
RuntimeException
When `Cake\Routing\Router` class cannot be found.

checkException() ¶ protected

checkException(Authorization\Exception\Exception $exception, Exception[] $exceptions): bool

Checks if an exception matches one of the classes.

Parameters
Authorization\Exception\Exception $exception

Exception instance.

Exception[] $exceptions

A list of exception classes.

Returns
bool

getUrl() ¶ protected

getUrl(Psr\Http\Message\ServerRequestInterface $request, array $options): string

Returns the url for the Location header.

Parameters
Psr\Http\Message\ServerRequestInterface $request
array $options
Returns
string

handle() ¶ public

handle(Authorization\Exception\Exception $exception, Psr\Http\Message\ServerRequestInterface $request, array $options = []): Psr\Http\Message\ResponseInterface

Handles the unauthorized request. The modified response should be returned.

Return a response with a location header set if an exception matches.

Parameters
Authorization\Exception\Exception $exception
Psr\Http\Message\ServerRequestInterface $request
array $options optional
Returns
Psr\Http\Message\ResponseInterface

Property Detail

$defaultOptions ¶ protected

Default config:

  • exceptions - A list of exception classes.
    • url - Url to redirect to.
    • queryParam - Query parameter name for the target url.
    • statusCode - Redirection status code.
Type
array
OpenHub
Pingping
Linode
  • 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
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs