SecurityException
extends BadRequestException
in package
Security exception - used when SecurityComponent detects any issue with the current request
Table of Contents
Properties
- $_attributes : array<string|int, mixed>
- Array of attributes that are passed in from the constructor, and made available in the view when a development error is displayed.
- $_defaultCode : int
- Default exception code
- $_messageTemplate : string
- Template string that has attributes sprintf()'ed into it.
- $_reason : string|null
- Reason for request blackhole
- $_responseHeaders : array<string|int, mixed>|null
- Array of headers to be passed to {@link \Cake\Http\Response::withHeader()}
- $_type : string
- Security Exception type
- $headers : array<string, mixed>
Methods
- __construct() : mixed
- Constructor
- getAttributes() : array<string|int, mixed>
- Get the passed in attributes
- getCode() : int
- getHeaders() : array<string, mixed>
- Returns array of response headers.
- getReason() : string|null
- Get Reason
- getType() : string
- Getter for type
- responseHeader() : array<string|int, mixed>|null
- Get/set the response header to be used
- setHeader() : void
- Set a single HTTP response header.
- setHeaders() : void
- Sets HTTP response headers.
- setMessage() : void
- Set Message
- setReason() : $this
- Set Reason
Properties
$_attributes
Array of attributes that are passed in from the constructor, and made available in the view when a development error is displayed.
protected
array<string|int, mixed>
$_attributes
= []
$_defaultCode
Default exception code
protected
int
$_defaultCode
= 400
Tags
$_messageTemplate
Template string that has attributes sprintf()'ed into it.
protected
string
$_messageTemplate
= ''
$_reason
Reason for request blackhole
protected
string|null
$_reason
$_responseHeaders
Array of headers to be passed to {@link \Cake\Http\Response::withHeader()}
protected
array<string|int, mixed>|null
$_responseHeaders
$_type
Security Exception type
protected
string
$_type
= 'secure'
$headers
protected
array<string, mixed>
$headers
= []
Methods
__construct()
Constructor
public
__construct([string|null $message = null ][, int|null $code = null ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string|null = null
-
If no message is given 'Bad Request' will be the message
- $code : int|null = null
-
Status code, defaults to 400
- $previous : Throwable|null = null
-
The previous exception.
getAttributes()
Get the passed in attributes
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getCode()
public
getCode() : int
Gets the Exception code.
Return values
intgetHeaders()
Returns array of response headers.
public
getHeaders() : array<string, mixed>
Return values
array<string, mixed>getReason()
Get Reason
public
getReason() : string|null
Return values
string|nullgetType()
Getter for type
public
getType() : string
Return values
stringresponseHeader()
Get/set the response header to be used
public
responseHeader([array<string|int, mixed>|string|null $header = null ][, string|null $value = null ]) : array<string|int, mixed>|null
Use HttpException::setHeaders()
instead. Response headers
should be set for HttpException only.
Parameters
- $header : array<string|int, mixed>|string|null = null
-
A single header string or an associative array of "header name" => "header value"
- $value : string|null = null
-
The header value.
Return values
array<string|int, mixed>|nullsetHeader()
Set a single HTTP response header.
public
setHeader(string $header[, array<string|int, string>|string|null $value = null ]) : void
Parameters
- $header : string
-
Header name
- $value : array<string|int, string>|string|null = null
-
Header value
setHeaders()
Sets HTTP response headers.
public
setHeaders(array<string, mixed> $headers) : void
Parameters
- $headers : array<string, mixed>
-
Array of header name and value pairs.
setMessage()
Set Message
public
setMessage(string $message) : void
Parameters
- $message : string
-
Exception message
setReason()
Set Reason
public
setReason([string|null $reason = null ]) : $this
Parameters
- $reason : string|null = null
-
Reason details