pfSense-pkg-saml2-auth

Config
in package

Defines the configuration class for the pfSense-pkg-saml2-auth package. This class provides methods to load, save, validate, backup, and restore the package's configuration in the pfSense XML configuration file.

Table of Contents

Constants

BACKUP_FILE_PATH  = '/var/cache/pfSense-pkg-saml2-auth/backup.json'
RESTORE_FAILURE  = 1
RESTORE_NO_BACKUP  = 2
RESTORE_SUCCESS  = 0

Properties

$custom_conf  : string
$debug_mode  : bool
$enable  : bool
$id  : int
$idp_entity_id  : string
$idp_groups_attribute  : string
$idp_metadata_url  : string
$idp_sign_on_url  : string
$idp_x509_cert  : string
$sp_base_url  : string
$strip_username  : bool

Methods

__construct()  : mixed
Constructs the Config object. This ensures the values currently in the configuration file are loaded into this object's properties.
backup()  : bool
Backups up the current pfSense-pkg-saml2-auth configuration to a persistent JSON file.
from_internal()  : void
Loads this object's properties from an array of pfSense configuration data.
from_internal_boolval()  : bool
Converts the configs internal boolean representation to a PHP boolean. This is necessary because pfSense does not parse the XML configuration into data types other than strings and arrays.
get_default_sp_base_url()  : string
Obtains a default sp_base_url using the pfSense system configuration
get_raw_config()  : array<string|int, mixed>
Obtains the current pfSense-pkg-saml2-auth package configuration data.
restore()  : int
Restores the last backup of the pfSense-pkg-saml2-auth configuration from the persistent JSON file.
save()  : void
Saves changes made to this object's properties to the pfSense configuration.
to_internal()  : array<string|int, mixed>
Converts this object's properties into an array of pfSense configuration data.
to_internal_boolval()  : string
Converts a PHP boolean to the pfSense internal representation of a boolean.
validate()  : void
Validates the configuration data. This method checks all properties for validity and throws an exception if any validation fails.
validate_custom_conf()  : void
Validates the custom_conf property.
validate_idp_entity_id()  : void
Validates the idp_entity_idp property.
validate_idp_metadata_url()  : void
Validates the idp_metadata_url property.
validate_idp_sign_on_url()  : void
Validates the idp_sign_on_url property.
validate_idp_x509_cert()  : void
Validates the idp_x509_cert property.
validate_sp_base_url()  : void
Validates the sp_base_url property.

Constants

BACKUP_FILE_PATH

public mixed BACKUP_FILE_PATH = '/var/cache/pfSense-pkg-saml2-auth/backup.json'

RESTORE_FAILURE

public mixed RESTORE_FAILURE = 1

RESTORE_NO_BACKUP

public mixed RESTORE_NO_BACKUP = 2

RESTORE_SUCCESS

public mixed RESTORE_SUCCESS = 0

Properties

$custom_conf

public string $custom_conf

$debug_mode

public bool $debug_mode

$idp_entity_id

public string $idp_entity_id

$idp_groups_attribute

public string $idp_groups_attribute

$idp_metadata_url

public string $idp_metadata_url

$idp_sign_on_url

public string $idp_sign_on_url

$idp_x509_cert

public string $idp_x509_cert

$sp_base_url

public string $sp_base_url

$strip_username

public bool $strip_username

Methods

__construct()

Constructs the Config object. This ensures the values currently in the configuration file are loaded into this object's properties.

public __construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []

Optional configuration data to initialize the object with. If empty, the current pfSense-pkg-saml2-auth package configuration data will be loaded.

backup()

Backups up the current pfSense-pkg-saml2-auth configuration to a persistent JSON file.

public backup() : bool
Return values
bool

Returns true if the backup was successful, false otherwise.

from_internal()

Loads this object's properties from an array of pfSense configuration data.

public from_internal(array<string|int, mixed> $config_data) : void
Parameters
$config_data : array<string|int, mixed>

The configuration data to load into this object.

from_internal_boolval()

Converts the configs internal boolean representation to a PHP boolean. This is necessary because pfSense does not parse the XML configuration into data types other than strings and arrays.

public static from_internal_boolval(string $value) : bool
Parameters
$value : string

The incoming config value to convert.

Return values
bool

Returns true if the value is "yes", false otherwise.

get_default_sp_base_url()

Obtains a default sp_base_url using the pfSense system configuration

public static get_default_sp_base_url() : string
Return values
string

Returns the default SP base URL for the SAML2 authentication package.

get_raw_config()

Obtains the current pfSense-pkg-saml2-auth package configuration data.

public get_raw_config() : array<string|int, mixed>
Return values
array<string|int, mixed>

Returns an array containing the package ID and its configuration data.

restore()

Restores the last backup of the pfSense-pkg-saml2-auth configuration from the persistent JSON file.

public restore() : int
Return values
int

Returns an integer indicating the result of the restore operation: 0 for success, 1 for failure, and 2 if no backup file was found.

save()

Saves changes made to this object's properties to the pfSense configuration.

public save() : void

to_internal()

Converts this object's properties into an array of pfSense configuration data.

public to_internal() : array<string|int, mixed>
Return values
array<string|int, mixed>

to_internal_boolval()

Converts a PHP boolean to the pfSense internal representation of a boolean.

public static to_internal_boolval(bool $value) : string
Parameters
$value : bool

The PHP boolean value to convert.

Return values
string

Returns "yes" if true, "" if false.

validate()

Validates the configuration data. This method checks all properties for validity and throws an exception if any validation fails.

public validate() : void
Tags
throws
ValidationError

If any of the configuration properties are invalid.

validate_custom_conf()

Validates the custom_conf property.

public validate_custom_conf() : void
Tags
throws
ValidationError

If the custom_conf is not a valid JSON string.

validate_idp_entity_id()

Validates the idp_entity_idp property.

public validate_idp_entity_id() : void
Tags
throws
ValidationError

If the idp_entity_id is over 1024 characters long or contains invalid characters.

validate_idp_metadata_url()

Validates the idp_metadata_url property.

public validate_idp_metadata_url() : void
Tags
throws
ValidationError

If the idp_metadata_url is not a valid URL.

validate_idp_sign_on_url()

Validates the idp_sign_on_url property.

public validate_idp_sign_on_url() : void
Tags
throws
ValidationError

If the idp_sign_on_url is not a valid URL

validate_idp_x509_cert()

Validates the idp_x509_cert property.

public validate_idp_x509_cert() : void
Tags
throws
ValidationError

If the idp_x509_cert is not a valid X.509 certificate.

validate_sp_base_url()

Validates the sp_base_url property.

public validate_sp_base_url() : void
Tags
throws
ValidationError

If the sp_base_url is not a valid URL.


        
On this page

Search results