Configuring SAML Global Variables
On this page
Before you can authenticate users with SAML, you must configure each SingleStore aggregator node’s memsql.OFF
:
SHOW VARIABLES LIKE 'saml%';
+-----------------------------------+-------+
| Variable_name | Value |
+-----------------------------------+-------+
| saml_assertion_audience | |
| saml_message_recipient | |
| saml_private_decryption_key | |
| saml_require_encryption | OFF |
| saml_require_signature_validation | OFF |
| saml_use_NameID | OFF |
| saml_user_name_attribute | |
| saml_x509_certificate | |
+-----------------------------------+-------+
8 rows in set (0.00 sec)
To enable SAML authentication, the memsql.SET GLOBAL
statement.
The settings for each configuration variable depend on the expected structure of an incoming SAML assertion, and a number of configuration combinations are possible.
Minimum Configurations
Two minimum memsql.
NameID Configuration
If the incoming SAML assertion identifies a username with the <saml:NameID>
element, you can set the saml_
variable to ON
.
[server]
...
saml_use_NameID = ON
...
Attribute Name Configuration
If the incoming SAML assertion identifies a username with a <saml:Attribute Name="">
element, you can set the saml_
variable to its value.
Minimum configuration for Attribute Name element.
[server]
...
saml_user_name_attribute = <my-username-identifier>
...
Maximum Configuration and Other Options
SAML assertions are usually validated using more than just a username, so the minimum configuration options in the section above must be expanded upon.<saml:NameID>
is being used for username mapping instead of <saml:Attribute Name="">
:
[server]
...
saml_assertion_audience = https://my.example.com/service/
saml_message_recipient = initech
saml_private_decryption_key = ../local/file/path/private-key.pem
saml_require_encryption = ON
saml_require_signature_validation = ON
saml_use_NameID = ON
saml_x509_certificate = ../local/file/path/public-key.crt
...
Various other combinations are possible, depending on whether the incoming SAML assertion contains encrypted data, has restricted audiences or recipients, and if signature validation is required.
Signing Variables
If the SAML assertion is signed, at minimum the saml_
variable should be set.
[server]
...
saml_use_NameID = ON
saml_x509_certificate= ../local/file/path/public-key.crt
...
Encryption Variables
If the SAML assertion contains encrypted data, at minimum the saml_
variable should be set.
[server]
...
saml_use_NameID = ON
saml_private_decryption_key = ../local/file/path/private-key.pem
...
saml_ user_ name_ attribute
Specifies the username attribute in a SAML assertion that should be used to determine if a user exists in the database.
Identity providers can use arbitrary attribute names to specify a username.username
, user_
, or other values.
<saml:Assertion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" ID="_d71a3a8e9fcc45c9e9d248ef7049393fc8f04e5f75" Version="2.0" IssueInstant="2014-07-17T01:01:48Z">
...
<saml:AttributeStatement>
<saml:Attribute Name="username" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">johndoe</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
...
</saml:Assertion>
In the assertion above, an attribute named username
is specified with an attribute value of johndoe
.saml_
variable is used to map this attribute’s value so that johndoe
will be used as the user name when authenticating to the database.
Examples
saml_user_name_attribute = username
SHOW GLOBAL VARIABLES LIKE 'saml_user_name_attribute';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| saml_user_name_attribute | username |
+--------------------------+----------+
1 row in set (0.00 sec)
saml_ use_ NameID
Specifies whether a username value should be extracted from the <saml:NameID>
element in a SAML assertion.
The default value is OFF
.OFF
, this element is ignored and the saml_
variable must be set instead.ON
, the saml_
variable is ignored.
Consider the following example from a SAML assertion:
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" NameQualifier="my.service.com">johndoe</saml:NameID>
...
</saml:Subject>
In the example above, the NameID
element’s value is johndoe
.saml_
engine variable is set to ON
, johndoe
will be used as the username credential during authentication.
Examples
saml_use_NameID = ON
SHOW GLOBAL VARIABLES LIKE 'saml_use_NameID';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| saml_use_NameID | ON |
+-----------------+-------+
1 row in set (0.00 sec)
saml_ require_ encryption
Specifies if authentication should fail when both the SAML response and SAML assertion are unencrypted.OFF
.ON
.
If your security requirements include encrypted SAML responses or SAML assertions, this variable ensures that authentication will fail when neither are encrypted.
This variable is dependent on the presence of a valid PEM certificate, which is specified in the saml_
engine variable.
-
If required encryption is set to
ON
but no PEM certificate is specified, authentication will fail. -
If a SAML assertion doesn’t contain a encrypted data and the requirement is set to
OFF
, the specified PEM certificate is ignored. -
If a SAML assertion does contain encrypted data and the requirement is set to
OFF
, a PEM certificate must be present.
Examples
saml_require_encryption = ON
SHOW GLOBAL VARIABLES LIKE 'saml_require_encryption';
+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| saml_require_encryption | ON |
+-------------------------+-------+
1 row in set (0.00 sec)
saml_ require_ signature_ validation
Specifies if authentication should fail when both the SAML response and SAML assertion are unsigned.OFF
.ON
.
If your security requirements include signed SAML responses or SAML assertions, this variable ensures that authentication will fail when neither are signed.
This variable is dependent on the presence of a valid x509 certificate, which is specified in the saml_
engine variable.
-
If signature validation is set to
ON
but no x509 certificate is specified, authentication will fail. -
If a SAML assertion doesn’t contain a signature and validation is set to
OFF
, the specified x509 certificate is ignored. -
If a SAML assertion does contain a signature and validation is set to
OFF
, an x509 certificate must be present.
Examples
saml_require_signature_validation = ON
SHOW GLOBAL VARIABLES LIKE 'saml_require_signature_validation';
+-----------------------------------+-------+
| Variable_name | Value |
+-----------------------------------+-------+
| saml_require_signature_validation | ON |
+-----------------------------------+-------+
1 row in set (0.00 sec)
saml_ x509_ certificate
Specifies the file path for the identity provider’s public x509 signing certificate.
An identity provider uses a private key to sign SAML responses.saml_
variable points the database to the path of this public key and uses it to validate security tokens.
No validation is performed on this file path when SingleStore is started; validation occurs when a user attempts to authenticate to the database.
Examples
saml_x509_certificate = ../local/file/path/public-key.crt
SHOW GLOBAL VARIABLES LIKE 'saml_x509_certificate';
+-----------------------+-----------------------------------+
| Variable_name | Value |
+-----------------------+-----------------------------------+
| saml_x509_certificate | ../local/file/path/public-key.crt |
+-----------------------+-----------------------------------+
1 row in set (0.00 sec)
saml_ private_ decryption_ key
Specifies the file path for the private key that is used to decrypt an encrypted assertion.
An identity provider can encrypt assertions within a SAML response by using a previously supplied public key.saml_
points the database to the path of this public key and uses it to decrypt the assertions.
No validation is performed on this file path when SingleStore is started; validation occurs when a user attempts to authenticate to the database.
Examples
saml_private_decryption_key = ../local/file/path/private-key.pem
SHOW GLOBAL VARIABLES LIKE 'saml_private_decryption_key';
+-----------------------------+------------------------------------+
| Variable_name | Value |
+-----------------------------+------------------------------------+
| saml_private_decryption_key | ../local/file/path/private-key.pem |
+-----------------------------+------------------------------------+
1 row in set (0.00 sec)
saml_ message_ recipient
Specifies the intended recipient for a wrapped encryption key.
A SAML response may contain encrypted data in the <xenc:EncryptedData>
element.<xenc:EncryptedKey>
element, which is often intended for a specific recipient.<xenc:EncryptedKey Recipient="recipient@domain.
The saml_
variable is used to validate that the intended recipient of a message is the same.
If a SAML response’s encryption key does not have a recipient attribute, validation will be skipped.
Examples
saml_message_recipient = recipient@domain.com
SHOW GLOBAL VARIABLES LIKE 'saml_message_recipient';
+------------------------+----------------------+
| Variable_name | Value |
+------------------------+----------------------+
| saml_message_recipient | recipient@domain.com |
+------------------------+----------------------+
1 row in set (0.00 sec)
saml_ assertion_ audience
Specifies a single audience restriction for the SAML assertion.
SAML assertions can be restricted to specific audiences.
<saml:Assertion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" ID="_d71a3a8e9fcc45c9e9d248ef7049393fc8f04e5f75" Version="2.0" IssueInstant="2014-07-17T01:01:48Z">
...
<saml:Conditions NotBefore="2014-07-17T01:01:18Z" NotOnOrAfter="2016-01-18T06:21:48Z">
<saml:AudienceRestriction>
<saml:Audience>https://my.example.com/service/</saml:Audience>
<saml:Audience>https://my.otherexample.com/service/</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
...
</saml:Assertion>
The assertion above is restricted to the two audiences specified in the <saml:Audience>
elements.saml_
variable matches at least one of the audiences in the restriction.
Examples
saml_assertion_audience = https://my.example.com/service/
SHOW GLOBAL VARIABLES LIKE 'saml_assertion_audience';
+-------------------------+---------------------------------+
| Variable_name | Value |
+-------------------------+---------------------------------+
| saml_assertion_audience | https://my.example.com/service/ |
+-------------------------+---------------------------------+
1 row in set (0.00 sec)
Last modified: April 26, 2023