Class TBrookHTTPCookie

Unit

Declaration

type TBrookHTTPCookie = class(TCollectionItem)

Description

Server side HTTP cookie item.

Hierarchy

Overview

Methods

Public constructor Create(ACollection: TCollection); override;
Public procedure Assign(ASource: TPersistent); override;
Public class function Sign(const ASecret, AUnsignedValue: string): string; overload; static;
Public class function TryUnsign(const ASecret, ASignedValue: string; out AUnsignedValue: string): Boolean; overload; static;
Public class function Unsign(const ASecret, ASignedValue: string): string; overload; static; inline;
Public class function IsSigned( const ASignedValue: string): Boolean; overload; static; inline;
Public function IsSigned: Boolean; overload; virtual;
Public procedure Sign(const ASecret: string); overload; virtual;
Public function TryUnsign(const ASecret: string): Boolean; overload; virtual;
Public procedure Unsign(const ASecret: string); overload; virtual;
Public function ToString: string; override;
Public procedure Clear; virtual;
Public procedure Expire; virtual;
Public procedure Persist; virtual;

Properties

Public property Name: string read FName write SetName;
Public property Value: string read FValue write SetValue;
Public property Domain: string read FDomain write FDomain;
Public property Path: string read FPath write SetPath;
Public property Expires: TDateTime read FExpires write FExpires;
Public property HttpOnly: Boolean read FHttpOnly write FHttpOnly;
Public property Secure: Boolean read FSecure write FSecure;
Public property MaxAge: Integer read FMaxAge write SetMaxAge;
Public property SameSite: TBrookHTTPCookieSameSite read FSameSite write FSameSite;

Description

Methods

Public constructor Create(ACollection: TCollection); override;

Creates an instance of TBrookHTTPCookie.

Parameters
ACollection[in]
Cookies list.
Public procedure Assign(ASource: TPersistent); override;

Copies the properties of the source cookie.

Parameters
ASource[in]
Cookie source to be copied.
Public class function Sign(const ASecret, AUnsignedValue: string): string; overload; static;

Signs a cookie value using HMAC-SHA1.

Parameters
ASecret[in]
Secret key to sign the cookie value.
AUnsignedValue[in]
Unsigned cookie value to be signed.
Returns

Signed cookie value.

Public class function TryUnsign(const ASecret, ASignedValue: string; out AUnsignedValue: string): Boolean; overload; static;

Tries to unsign a cookie value.

Parameters
ASecret[in]
Secret key to unsign the cookie value.
ASignedValue[out]
Signed cookie value.
AUnsignedValue[out]
Unsigned cookie value.
Returns

True if cookie value is unsigned successfully.

Public class function Unsign(const ASecret, ASignedValue: string): string; overload; static; inline;

Unsigns a cookie value.

Parameters
ASecret[in]
Secret key to unsign the cookie value.
ASignedValue[in]
Signed cookie value.
Returns

Unsigned cookie value.

Public class function IsSigned( const ASignedValue: string): Boolean; overload; static; inline;

Checks if a cookie value is signed.

Parameters
ASignedValue[out]
Signed cookie value.
Returns

True if cookie value is signed.

Public function IsSigned: Boolean; overload; virtual;

Checks if a cookie is signed.

Returns

True if cookie is signed.

Public procedure Sign(const ASecret: string); overload; virtual;

Signs a cookie value using HMAC-SHA1.

Parameters
ASecret[in]
Secret key to sign the cookie value.
Public function TryUnsign(const ASecret: string): Boolean; overload; virtual;

Tries to unsign a cookie.

Parameters
ASecret[in]
Secret key to unsign the cookie value.
Returns

True if cookie is unsigned successfully.

Public procedure Unsign(const ASecret: string); overload; virtual;

Unsigns a cookie.

Parameters
ASecret[in]
Secret key to unsign the cookie value.
Public function ToString: string; override;

Gets the cookie as string.

Public procedure Clear; virtual;

Clears the cookie properties.

Public procedure Expire; virtual;

Expires the cookie.

Public procedure Persist; virtual;

Persists a cookie to live as long as it can.

Properties

Public property Name: string read FName write SetName;

Cookie name.

Public property Value: string read FValue write SetValue;

Cookie value.

Public property Domain: string read FDomain write FDomain;

Allowed domain to receive the cookie.

Public property Path: string read FPath write SetPath;

Path that must exist in the URL to receive the cookie.

Public property Expires: TDateTime read FExpires write FExpires;

Expiration date/time.

Public property HttpOnly: Boolean read FHttpOnly write FHttpOnly;

True prevents the cookie to be accessed through JavaScript.

Public property Secure: Boolean read FSecure write FSecure;

True indicates cookie sent only through HTTPS protocol.

Public property MaxAge: Integer read FMaxAge write SetMaxAge;

Sets an expiration expressed in number of seconds.

Public property SameSite: TBrookHTTPCookieSameSite read FSameSite write FSameSite;

True indicates that a cookie shouldn't be sent with cross-site requests.


Generated by PasDoc 0.16.0.