Auth
in package
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.
Table of Contents
Constants
- SP_ACS_URL = '/saml2_auth/sso/acs/'
- SP_METADATA_URL = '/saml2_auth/sso/metadata/'
- SSO_ERROR_URL = '/saml2_auth/sso/error/'
- SSO_REDIRECT_URL = '/saml2_auth/sso/redirect/'
- SSO_URL = '/saml2_auth/sso/'
Properties
Methods
- __construct() : mixed
- Constructor for the Saml2 Auth class. This class contains the handlers needed to initiate the SAML2 auth processes using the current configuration.
- acs() : void
- The ACS handler for SAML2 responses. This method is responsible for processing the SAML2 response from the IdP and setting session variables accordingly.
- get_saml2_errors() : void
- Checks for SAML2 login errors and logs them if found. This method is also responsible for exiting the session when authentication fails.
- get_saml_settings() : array<string|int, mixed>
- Converts the pfSense-pkg-saml2-auth package's configuration to the onelogin/php-saml settings array.
- log() : void
- Writes a log entry to the applicable log file
- metadata() : void
- Sets up SAML2 settings and metadata. This method is responsible for generating and validating the SP metadata.
- sso() : void
- Initiates the SSO login.
- __check_saml2_state() : void
- Checks the SAML2 state after SSO login. This method is responsible for either redirecting the user to the dashboard if authentication was successfully, or redirecting them back to the SSO URL to start the login process.
Constants
SP_ACS_URL
public
mixed
SP_ACS_URL
= '/saml2_auth/sso/acs/'
SP_METADATA_URL
public
mixed
SP_METADATA_URL
= '/saml2_auth/sso/metadata/'
SSO_ERROR_URL
public
mixed
SSO_ERROR_URL
= '/saml2_auth/sso/error/'
SSO_REDIRECT_URL
public
mixed
SSO_REDIRECT_URL
= '/saml2_auth/sso/redirect/'
SSO_URL
public
mixed
SSO_URL
= '/saml2_auth/sso/'
Properties
$auth
public
Auth
$auth
$config
public
Config
$config
Methods
__construct()
Constructor for the Saml2 Auth class. This class contains the handlers needed to initiate the SAML2 auth processes using the current configuration.
public
__construct([bool $no_auth = false ]) : mixed
Parameters
- $no_auth : bool = false
acs()
The ACS handler for SAML2 responses. This method is responsible for processing the SAML2 response from the IdP and setting session variables accordingly.
public
acs() : void
get_saml2_errors()
Checks for SAML2 login errors and logs them if found. This method is also responsible for exiting the session when authentication fails.
public
get_saml2_errors() : void
get_saml_settings()
Converts the pfSense-pkg-saml2-auth package's configuration to the onelogin/php-saml settings array.
public
get_saml_settings() : array<string|int, mixed>
Return values
array<string|int, mixed> —The settings array for the onelogin/php-saml library
log()
Writes a log entry to the applicable log file
public
log(int $level, string $message[, string $logfile = 'saml2' ]) : void
Parameters
- $level : int
- $message : string
- $logfile : string = 'saml2'
-
The log file to write to. Use
authto write to the auth log (will print to console) orsaml2to write to the saml2 package log file.
metadata()
Sets up SAML2 settings and metadata. This method is responsible for generating and validating the SP metadata.
public
metadata() : void
sso()
Initiates the SSO login.
public
sso(string $redirect) : void
Parameters
- $redirect : string
-
The URL to redirect to.
__check_saml2_state()
Checks the SAML2 state after SSO login. This method is responsible for either redirecting the user to the dashboard if authentication was successfully, or redirecting them back to the SSO URL to start the login process.
private
__check_saml2_state() : void