# \OneLogin_Saml2_Settings

Configuration of the PHP Toolkit

## Summary

Methods
Properties
Constants
__construct()
getBasePath()
getCertPath()
getConfigPath()
getLibPath()
getExtLibPath()
getSchemasPath()
setSchemasPath()
checkSettings()
checkCompressionSettings()
checkIdPSettings()
checkSPSettings()
checkSPCerts()
getSPkey()
getSPcert()
getSPcertNew()
getIdPData()
getSPData()
getSecurityData()
getContacts()
getOrganization()
shouldCompressRequests()
shouldCompressResponses()
getIdPSSOUrl()
getIdPSLOUrl()
getIdPSLOResponseUrl()
getSPMetadata()
validateMetadata()
formatIdPCert()
formatIdPCertMulti()
formatSPCert()
formatSPCertNew()
formatSPKey()
getErrors()
setStrict()
isStrict()
isDebugActive()
setBaseURL()
getBaseURL()
setIdPCert()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
_loadPaths()
_loadSettingsFromArray()
_loadSettingsFromFile()
_addDefaultValues()
$_paths
$_baseurl
$_strict
$_debug
$_sp
$_idp
$_compress
$_security
$_contacts
$_organization
$_errors
$_spValidationOnly
N/A

File
  Settings.php
Package
  Default
Class hierarchy
  \OneLogin_Saml2_Settings

## Tags

None found

## Properties

### $_paths

    $_paths : array

List of paths.

#### Type

array

#

## Tags

None found

### $_baseurl

    $_baseurl : string

#### Type

string

#

## Tags

None found

### $_strict

    $_strict : boolean

Strict. If active, PHP Toolkit will reject unsigned or unencrypted messages if it expects them signed or encrypted. If not, the messages will be accepted and some security issues will be also relaxed.

#### Type

boolean

#

## Tags

None found

### $_debug

    $_debug : boolean

Activate debug mode

#### Type

boolean

#

## Tags

None found

### $_sp

    $_sp : array

SP data.

#### Type

array

#

## Tags

None found

### $_idp

    $_idp : array

IdP data.

#### Type

array

#

## Tags

None found

### $_compress

    $_compress : array

Compression settings that determine whether gzip compression should be used.

#### Type

array

#

## Tags

None found

### $_security

    $_security : array

Security Info related to the SP.

#### Type

array

#

## Tags

None found

### $_contacts

    $_contacts : array

Setting contacts.

#### Type

array

#

## Tags

None found

### $_organization

    $_organization : array

Setting organization.

#### Type

array

#

## Tags

None found

### $_errors

    $_errors : array

Setting errors.

#### Type

array

#

## Tags

None found

### $_spValidationOnly

    $_spValidationOnly : boolean

Setting errors.

#### Type

boolean

#

## Tags

None found

## Methods

### __construct()

    __construct(array|object|null  $settings = null, boolean  $spValidationOnly = false)

Initializes the settings: - Sets the paths of the different folders - Loads settings info from settings file or array/object provided

#### Parameters

array|object|null | $settings | SAML Toolkit Settings
boolean | $spValidationOnly |

#### Throws

\OneLogin_Saml2_Error

  If any settings parameter is invalid

\Exception

  If OneLogin_Saml2_Settings is incorrectly supplied

#

## Tags

None found

### getBasePath()

    getBasePath() : string

Returns base path.

#### Returns

string —

The base toolkit folder path

#

## Tags

None found

### getCertPath()

    getCertPath() : string

Returns cert path.

#### Returns

string —

The cert folder path

#

## Tags

None found

### getConfigPath()

    getConfigPath() : string

Returns config path.

#### Returns

string —

The config folder path

#

## Tags

None found

### getLibPath()

    getLibPath() : string

Returns lib path.

#### Returns

string —

The library folder path

#

## Tags

None found

### getExtLibPath()

    getExtLibPath() : string

Returns external lib path.

#### Returns

string —

The external library folder path

#

## Tags

None found

### getSchemasPath()

    getSchemasPath() : string

Returns schema path.

#### Returns

string —

The external library folder path

#

## Tags

None found

### setSchemasPath()

    setSchemasPath(string  $path) : $this

Set schemas path

#### Parameters

string | $path |

#### Returns

$this

#

## Tags

None found

### checkSettings()

    checkSettings(array  $settings) : array

Checks the settings info.

#### Parameters

array | $settings | Array with settings data

#### Returns

array —

$errors Errors found on the settings data

#

## Tags

None found

### checkCompressionSettings()

    checkCompressionSettings(array  $settings) : array

Checks the compression settings info.

#### Parameters

array | $settings | Array with settings data

#### Returns

array —

$errors Errors found on the settings data

#

## Tags

None found

### checkIdPSettings()

    checkIdPSettings(array  $settings) : array

Checks the IdP settings info.

#### Parameters

array | $settings | Array with settings data

#### Returns

array —

$errors Errors found on the IdP settings data

#

## Tags

None found

### checkSPSettings()

    checkSPSettings(array  $settings) : array

Checks the SP settings info.

#### Parameters

array | $settings | Array with settings data

#### Returns

array —

$errors Errors found on the SP settings data

#

## Tags

None found

### checkSPCerts()

    checkSPCerts() : boolean

Checks if the x509 certs of the SP exists and are valid.

#### Returns

boolean

#

## Tags

None found

### getSPkey()

    getSPkey() : string

Returns the x509 private key of the SP.

#### Returns

string —

SP private key

#

## Tags

None found

### getSPcert()

    getSPcert() : string

Returns the x509 public cert of the SP.

#### Returns

string —

SP public cert

#

## Tags

None found

### getSPcertNew()

    getSPcertNew() : string

Returns the x509 public of the SP that is planed to be used soon instead the other public cert

#### Returns

string —

SP public cert New

#

## Tags

None found

### getIdPData()

    getIdPData() : array

Gets the IdP data.

#### Returns

array —

IdP info

#

## Tags

None found

### getSPData()

    getSPData() : array

Gets the SP data.

#### Returns

array —

SP info

#

## Tags

None found

### getSecurityData()

    getSecurityData() : array

Gets security data.

#### Returns

array —

SP info

#

## Tags

None found

### getContacts()

    getContacts() : array

Gets contact data.

#### Returns

array —

SP info

#

## Tags

None found

### getOrganization()

    getOrganization() : array

Gets organization data.

#### Returns

array —

SP info

#

## Tags

None found

### shouldCompressRequests()

    shouldCompressRequests() : boolean

Should SAML requests be compressed?

#### Returns

boolean —

Yes/No as True/False

#

## Tags

None found

### shouldCompressResponses()

    shouldCompressResponses() : boolean

Should SAML responses be compressed?

#### Returns

boolean —

Yes/No as True/False

#

## Tags

None found

### getIdPSSOUrl()

    getIdPSSOUrl() : string|null

Gets the IdP SSO url.

#### Returns

string|null —

The url of the IdP Single Sign On Service

#

## Tags

None found

### getIdPSLOUrl()

    getIdPSLOUrl() : string|null

Gets the IdP SLO url.

#### Returns

string|null —

The request url of the IdP Single Logout Service

#

## Tags

None found

### getIdPSLOResponseUrl()

    getIdPSLOResponseUrl() : string|null

Gets the IdP SLO response url.

#### Returns

string|null —

The response url of the IdP Single Logout Service

#

## Tags

None found

### getSPMetadata()

    getSPMetadata(boolean  $alwaysPublishEncryptionCert = false, \DateTime|null  $validUntil = null, integer|null  $cacheDuration = null) : string

Gets the SP metadata. The XML representation.

#### Parameters

boolean | $alwaysPublishEncryptionCert | When 'true', the returned metadata will always include an 'encryption' KeyDescriptor. Otherwise, the 'encryption' KeyDescriptor will only be included if $advancedSettings['security']['wantNameIdEncrypted'] or $advancedSettings['security']['wantAssertionsEncrypted'] are enabled.
\DateTime|null | $validUntil | Metadata's valid time
integer|null | $cacheDuration | Duration of the cache in seconds

#### Throws

\Exception
\OneLogin_Saml2_Error

#### Returns

string —

SP metadata (xml)

#

## Tags

None found

### validateMetadata()

    validateMetadata(string  $xml) : Array

Validates an XML SP Metadata.

#### Parameters

string | $xml | Metadata's XML that will be validate

#### Throws

\Exception

#### Returns

Array —

The list of found errors

#

## Tags

None found

### formatIdPCert()

    formatIdPCert()

Formats the IdP cert.

#

## Tags

None found

### formatIdPCertMulti()

    formatIdPCertMulti()

Formats the Multple IdP certs.

#

## Tags

None found

### formatSPCert()

    formatSPCert()

Formats the SP cert.

#

## Tags

None found

### formatSPCertNew()

    formatSPCertNew()

Formats the SP cert.

#

## Tags

None found

### formatSPKey()

    formatSPKey()

Formats the SP private key.

#

## Tags

None found

### getErrors()

    getErrors() : array

Returns an array with the errors, the array is empty when the settings is ok.

#### Returns

array —

Errors

#

## Tags

None found

### setStrict()

    setStrict(boolean  $value)

Activates or deactivates the strict mode.

#### Parameters

boolean | $value | Strict parameter

#### Throws

\Exception

#

## Tags

None found

### isStrict()

    isStrict() : boolean

Returns if the 'strict' mode is active.

#### Returns

boolean —

Strict parameter

#

## Tags

None found

### isDebugActive()

    isDebugActive() : boolean

Returns if the debug is active.

#### Returns

boolean —

Debug parameter

#

## Tags

None found

### setBaseURL()

    setBaseURL(  $baseurl)

Set a baseurl value.

#### Parameters

| $baseurl |

#

## Tags

None found

### getBaseURL()

    getBaseURL() : null|string

Returns the baseurl set on the settings if any.

#### Returns

null|string —

The baseurl

#

## Tags

None found

### setIdPCert()

    setIdPCert(string  $cert)

Sets the IdP certificate.

#### Parameters

string | $cert | IdP certificate

#

## Tags

None found

### _loadPaths()

    _loadPaths()

Sets the paths of the different folders

#

## Tags

suppress | PhanUndeclaredConstant

### _loadSettingsFromArray()

    _loadSettingsFromArray(array  $settings) : boolean

Loads settings info from a settings Array

#### Parameters

array | $settings | SAML Toolkit Settings

#### Returns

boolean —

True if the settings info is valid

#

## Tags

None found

### _loadSettingsFromFile()

    _loadSettingsFromFile() : boolean

Loads settings info from the settings file

#### Throws

\OneLogin_Saml2_Error

#### Returns

boolean —

True if the settings info is valid

#

## Tags

suppress | PhanUndeclaredVariable

### _addDefaultValues()

    _addDefaultValues()

Add default values if the settings info is not complete

#

## Tags

None found

### Settings.php