Documentation

simplesaml_functions.php

Table of Contents

Functions

simplesaml_get_lib_path()  : string
Get the configured path to the root of the SimpleSAML library If $simplesaml_lib_path is not set this will be the [webroot]/plugins/simplesaml/lib folder
simplesaml_authenticate()  : bool
Authenticate user, redfirecting to IdP if necessary
simplesaml_getattributes()  : array<string|int, mixed>
Get SAML attributes
simplesaml_signout()  : void
Sign out of SAML SP
simplesaml_is_authenticated()  : bool
Check if user has been authenticated by SimpleSAMLPHP
simplesaml_getauthdata()  : mixed
simplesaml_duplicate_notify()  : void
Notify of a new SAML user with an email address that is already in use by an existing user
simplesaml_config_check()  : array{success: bool, error?: string}
Check that the SimpleSAMLphp configuration is valid
simplesaml_php_check()  : bool
Check whether PHP version will cause an error with current SAML config
simplesaml_is_configured()  : bool
Check that the SimpleSAMLphp has been configured.
simplesaml_generate_keypair()  : array<string|int, mixed>
Generate a key/certificate pair
get_saml_sp_name()  : string
Get the name of the saml SP to use
get_saml_metadata_expiry()  : string
Get the latest expiration date for the given SAML Identity Provider's certificates
simplesaml_update_metadata()  : bool|string
Get the latest metadata from the configured IdP Metadata URL
get_saml_metadata()  : array<string|int, mixed>|false
Get SAML IdP metadata from sysvars, updating if necessary
simplesaml_use_idp_metadata_url_mode()  : bool

Functions

simplesaml_get_lib_path()

Get the configured path to the root of the SimpleSAML library If $simplesaml_lib_path is not set this will be the [webroot]/plugins/simplesaml/lib folder

simplesaml_get_lib_path() : string
Return values
string

simplesaml_authenticate()

Authenticate user, redfirecting to IdP if necessary

simplesaml_authenticate() : bool
Return values
bool

simplesaml_getattributes()

Get SAML attributes

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

simplesaml_is_authenticated()

Check if user has been authenticated by SimpleSAMLPHP

simplesaml_is_authenticated() : bool
Return values
bool

simplesaml_getauthdata()

simplesaml_getauthdata(mixed $value) : mixed
Parameters
$value : mixed

simplesaml_duplicate_notify()

Notify of a new SAML user with an email address that is already in use by an existing user

simplesaml_duplicate_notify(string $username, int $group, string $email, array<string|int, mixed> $email_matches[, int $newuserid = 0 ]) : void
Parameters
$username : string

Username

$group : int

Usergroup

$email : string

Email

$email_matches : array<string|int, mixed>

Array of existing users with matching email

$newuserid : int = 0

ID of new user if created

simplesaml_config_check()

Check that the SimpleSAMLphp configuration is valid

simplesaml_config_check() : array{success: bool, error?: string}
Return values
array{success: bool, error?: string}

simplesaml_php_check()

Check whether PHP version will cause an error with current SAML config

simplesaml_php_check([bool $with_config = true ]) : bool
Parameters
$with_config : bool = true
Return values
bool

simplesaml_is_configured()

Check that the SimpleSAMLphp has been configured.

simplesaml_is_configured() : bool

This is done by either:- a) Adding config, authsources and metadata files manually to the configured lib folder ($simplesaml_lib_path) or b) By setting the options in the $simplesamlconfig variable and then enabling the plugin option 'Use ResourceSpace configuration to set SP configuration and metadata'

Return values
bool

simplesaml_generate_keypair()

Generate a key/certificate pair

simplesaml_generate_keypair(array<string|int, mixed> $dn) : array<string|int, mixed>
Parameters
$dn : array<string|int, mixed>

Array of certificate attributes with named indexes as below

  • "countryName"
  • "stateOrProvinceName"
  • "localityName"
  • "organizationName"
  • "commonName"
  • "emailAddress"
Return values
array<string|int, mixed>

Array containing paths to private key (.pem) and certificate (.crt) files

get_saml_sp_name()

Get the name of the saml SP to use

get_saml_sp_name() : string
Return values
string

get_saml_metadata_expiry()

Get the latest expiration date for the given SAML Identity Provider's certificates

get_saml_metadata_expiry(string $entityid) : string
Parameters
$entityid : string

EntityID of SAML IdP

Return values
string

Expiration date. Empty string if no certificate or IdP is not found.

simplesaml_update_metadata()

Get the latest metadata from the configured IdP Metadata URL

simplesaml_update_metadata() : bool|string
Return values
bool|string

True if successful, otherwise error message

get_saml_metadata()

Get SAML IdP metadata from sysvars, updating if necessary

get_saml_metadata([bool $retry = true ]) : array<string|int, mixed>|false
Parameters
$retry : bool = true

Retry if invalid. Default true

Return values
array<string|int, mixed>|false

Metadata if successful, false if failed

simplesaml_use_idp_metadata_url_mode()

simplesaml_use_idp_metadata_url_mode() : bool
Return values
bool
On this page

Search results