pfSense-pkg-saml2-auth

Saml2

Table of Contents

Classes

Auth
Defines the main SAML2 authentication class. This class is responsible for handling all SAML2 related processes, including initiating SSO, processing ACS responses, and generating SP metadata.
Config
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.
TestCase
Defines a TestCase object that can be used to define child TestCase classes that test internal functionality of the API. This is needed because pfSense does not have PHPUnit readily available.
TestCaseRetry
A class to represent retry settings for test cases. This is intended to be defined in methods as a method attribute.
ConfigError
Defines a custom error class for configuration errors in the SAML2 authentication package.
SystemError
Defines a custom error class for system errors in the SAML2 authentication package.
UpdateError
Defines a custom error class for update errors in the SAML2 authentication package.
ValidationError
Defines a custom error class for validation errors in the SAML2 authentication package.

Constants

PKG_STATIC_EXEC  = '/usr/local/sbin/pkg-static'
REFRESH_CACHE_CMD  = '/usr/local/pkg/Saml2/manage.php refreshcache'
RELEASES_CACHE_FILE  = '/var/cache/pfSense-pkg-saml2-auth/releases.json'
RELEASES_FETCH_TIMEOUT  = 10
RELEASES_URL  = 'https://api.github.com/repos/pfrest/pfSense-pkg-saml2-auth/releases'

Functions

get_pfsense_version()  : string
Obtains the current version of pfSense running on this system.
get_pfsense_base_version()  : string
Obtains the base version of pfSense running on this system.
get_pkg_version()  : string
Obtains the current version of the pfSense-pkg-saml2-auth package installed on this system.
get_latest_pkg_version()  : string
Obtains the latest package release version available for download on this system.
get_latest_pkg_release_date()  : string
Obtains the release date of the latest package version available for download on this system.
is_update_available()  : bool
Checks if an update is available for the pfSense-pkg-saml2-auth package.
fetch_pkg_releases()  : array<string|int, mixed>
Fetches current package releases from GitHub. This method always fetches the latest releases from the GitHub API, it does not attempt to read from the cache.
get_pkg_releases()  : array<string|int, mixed>
Obtains package releases from the cache file.
get_supported_pkg_releases()  : array<string|int, mixed>
Obtains the package releases that are supported by the running pfSense version.
update_pkg()  : void
backup()  : void
Performs a backup of the SAML2 configuration
restore()  : void
Restores the SAML2 configuration from the latest backup
refreshcache()  : void
Refreshes the package releases cache
setupschedule()  : void
Sets up cron schedules for the package
removeschedule()  : void
Removes cron schedules for the package
update()  : void
Updates the pfSense-pkg-saml2-auth package to the latest version
revert()  : void
Reverts the pfSense-pkg-saml2-auth package to the specified version
run_tests()  : void
Runs all (or select) TestCase classes in \RESTAPI\Tests. This is only intended to test development of this package and should not be used on live installs.
version()  : void
Prints the installed version of the pfSense-pkg-saml2-auth package
help()  : void
Displays the help page for the CLI tool
main()  : void
Main function that parses command line arguments and calls the appropriate function

Constants

PKG_STATIC_EXEC

public mixed PKG_STATIC_EXEC = '/usr/local/sbin/pkg-static'

REFRESH_CACHE_CMD

public mixed REFRESH_CACHE_CMD = '/usr/local/pkg/Saml2/manage.php refreshcache'

RELEASES_CACHE_FILE

public mixed RELEASES_CACHE_FILE = '/var/cache/pfSense-pkg-saml2-auth/releases.json'

RELEASES_FETCH_TIMEOUT

public mixed RELEASES_FETCH_TIMEOUT = 10

RELEASES_URL

public mixed RELEASES_URL = 'https://api.github.com/repos/pfrest/pfSense-pkg-saml2-auth/releases'

Functions

get_pfsense_version()

Obtains the current version of pfSense running on this system.

get_pfsense_version() : string
Return values
string

The current pfSense version, formatted as x.x or x.x.x.

get_pfsense_base_version()

Obtains the base version of pfSense running on this system.

get_pfsense_base_version() : string
Tags
throws
SystemError

If the version cannot be determined or is not in the expected format.

Return values
string

The base pfSense version, formatted as x.x.

get_pkg_version()

Obtains the current version of the pfSense-pkg-saml2-auth package installed on this system.

get_pkg_version() : string
Return values
string

The current package version, formatted as x.x or x.x.x.

get_latest_pkg_version()

Obtains the latest package release version available for download on this system.

get_latest_pkg_version() : string
Return values
string

Returns the latest package version available for download.

get_latest_pkg_release_date()

Obtains the release date of the latest package version available for download on this system.

get_latest_pkg_release_date() : string
Return values
string

Returns the release date of the latest package version or empty string if not found.

is_update_available()

Checks if an update is available for the pfSense-pkg-saml2-auth package.

is_update_available() : bool
Return values
bool

Returns true if an update is available, false otherwise.

fetch_pkg_releases()

Fetches current package releases from GitHub. This method always fetches the latest releases from the GitHub API, it does not attempt to read from the cache.

fetch_pkg_releases() : array<string|int, mixed>
Tags
throws
SystemError

If the fetch fails due to a cURL error.

Return values
array<string|int, mixed>

Returns array of all available package releases, or empty array if the response was empty.

get_pkg_releases()

Obtains package releases from the cache file.

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

Returns array of all available package releases, or empty array if the cache is empty.

get_supported_pkg_releases()

Obtains the package releases that are supported by the running pfSense version.

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

Returns an array of package releases supported by the current pfSense version. The array is indexed by the release tag name and contains a 'name' and 'pkg_install_url' for each supported release.

update_pkg()

update_pkg([mixed $version = null ]) : void
Parameters
$version : mixed = null

string|null The version tag name to update/revert to or null to update to the latest version.

Tags
throws
UpdateError

If the requested version does not exist or is not supported.

throws
UpdateError

If the package removal or installation fails during the update process.

backup()

Performs a backup of the SAML2 configuration

backup() : void

restore()

Restores the SAML2 configuration from the latest backup

restore() : void

refreshcache()

Refreshes the package releases cache

refreshcache() : void

setupschedule()

Sets up cron schedules for the package

setupschedule() : void

removeschedule()

Removes cron schedules for the package

removeschedule() : void

update()

Updates the pfSense-pkg-saml2-auth package to the latest version

update() : void

revert()

Reverts the pfSense-pkg-saml2-auth package to the specified version

revert(string $version) : void
Parameters
$version : string

run_tests()

Runs all (or select) TestCase classes in \RESTAPI\Tests. This is only intended to test development of this package and should not be used on live installs.

run_tests([mixed $contains = '' ]) : void
Parameters
$contains : mixed = ''

string|null Only run tests that contain this sub-string in the test name.

Tags
note

Tests will attempt to create, modify and delete configurations and files as well as restart services; which can be disruptive to live systems.

version()

Prints the installed version of the pfSense-pkg-saml2-auth package

version() : void

help()

Displays the help page for the CLI tool

help() : void

main()

Main function that parses command line arguments and calls the appropriate function

main(array<string|int, mixed> $argv) : void
Parameters
$argv : array<string|int, mixed>

Command line arguments


        
On this page

Search results