- Created by Karolin Hemmingsson (Unlicensed), last modified on Apr 21, 2020
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 22 Next »
This article describes how to enable two-factor authentication to the Smart ID Identity Manager (PRIME) clients Identity Manager main client (PRIME Explorer) and Smart ID Self-Service.
This is solved by setting up a SAML 2.0 federation with PRIME as a Service Provider and an Identity Provider, such as Smart ID Digital Access component (Hybrid Access Gateway).
Prerequisites
Installations
PRIME must be set up:
- Installed PRIME, see Install Identity Manager.
The identity provider must be set up. If Hybrid Access Gateway is used, see here:
- Installed Hybrid Access Gateway, see Deploy Hybrid Access Gateway and do initial setup.
- Network Time Protocol (NTP) of Hybrid Access Gateway needs to be set up. See Deploy Hybrid Access Gateway and do initial setup.
Certificates
SSL server certificates for https communication:
- For Identity Manager, SSL server certificate in PKCS#12 format.
- Example: idm.p12
- For Digital Access as identity provider, SSL server certificate and private key as PKCS#8 PEM files.
- Example: Certificate: da.pem, Private Key: da.key.pem
SAML certificates for signing and encryption:
- For Identity Manager, SAML certificate in PKCS#12 format.
Example: idm.saml.p12 - For Digital Access as identity provider, SAML certificate and private key as PKCS#8 PEM files.
Example:Certificate: da.saml.pem, Private Key: da.saml.key.pem
If you need instructions to create demo certificates or extract certificates to the required formats, see Create or extract certificates for SSL and SAML.
Set up PRIME as service provider
To integrate PRIME with SAML SSO, the SAML authentication profile must be used.
- In PRIME Designer, go to Authentication Profiles, and add a new profile with the type SAML SSO Core Object. See Set up authentication profile.
- Open the created authentication profile for editiing.
- Error rendering macro 'excerpt-include' : No link could be created for 'Set up authentication profile'.
The defined keystore file must contain the certificates and the private key used for signing and decryption.
A keystore is mandatory to configure. Trying to save a configuration without a keystore, triggers an error message.
- Go to the SAML Configuration tab.
- Under Keystore configuration, click the upload symbol, browse for the keystore file and select it.
- In Password, enter the keystore password. If objects in the key store are protected with a password, then they must have the same password as the keystore.
When the keystore configuration has been uploaded, then Available key aliases shows a list of the aliases of all available private keys in the key store.
Each SAML federation can have multiple service providers, for example PRIME Explorer, Self-Service and any other application to be included in the federation. Each service provider must have a metadata file.
For each service provider, do the following to create a metadata file:
- Create a metadata file in .xml format, and give it a file name such as PRIME_Explorer_saml_metadata.xml.
- Open the file for editing. Copy and paste the example file content from below.
- Do the following changes:
- In entityID: enter a meaningful name for the service provider, for example https://prime.local/sp.
- Replace certificate data with the base64 encoded SAML certificate, for example prime.saml.pem.
- In Location: enter the location, for example http://localhost:8080/prime_explorer/saml/SSO/alias/explorer.
<?xml version="1.0" encoding="UTF-8"?> <md:EntityDescriptor entityID="sp.example" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"> <md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" AuthnRequestsSigned="true" WantAssertionsSigned="false"> <md:KeyDescriptor use="signing"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate>certificate data</ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:KeyDescriptor use="encryption"> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate>certificate data</ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> </md:KeyDescriptor> <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat> <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</md:NameIDFormat> <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat> <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat> <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</md:NameIDFormat> <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8080/prime_explorer/saml/SSO/alias/explorer" index="0"/> </md:SPSSODescriptor> </md:EntityDescriptor>
This table describes some elements and attributes of the Service Provider metadata xml file:
Element | Attribute | Description |
---|---|---|
EntityDescriptor | The common root element for definitions of IDP and SP. | |
entityID | By convention, a symbolic URL can be used both for an IDP and a SP but any identifier is allowed. The number of characters is limited to 1024. | |
xmlns:md | Namespace definition of SAML V2.0 metadata. | |
KeyDescriptor | Provides information about the cryptographic key(s) an entity uses for signing and encryption. The contents, including the certificate, follow the XML Signature standard. | |
use | Allowed values are "signing" and "encryption". This attribute is optional. If it is not used the assumption is that the same certificate is used for both signing and encryption. | |
NameIDFormat | Elements indicate what SAML name identifier formats the service supports. | |
SPSSODescriptor: | Element for the definition of a SP. | |
protocolSupportEnumeration | Support for the SAML V2.0 protocol namespace. | |
AuthnRequestsSigned | Indicates if the SAML request sent by the SP must be signed. This attribute is optional. Defaults to "false" if not set. | |
WantAssertionsSigned | Indicates if the Assertion elements in the SAML response must be signed. This attribute is optional. Defaults to "false" if not set. | |
AssertionConsumerService | The service the SP defines to process the SAML response. | |
Binding | Mapping of the SAML protocol message onto a standard communication protocol. Value "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" required. | |
Location | The URI under which the endpoint is reachable. Must include the path /saml/SSO/alias/<alias>. | |
index | A unique integer of the endpoint for reference in a protocol message. |
After the metadata files have been created they must be uploaded to the authentication profile in PRIME Designer. Multiple service providers can be configured, for example for the different PRIME applications and any other applications to be included in the federation.
- Open the SAML SSO authentication profile that was created earlier.
- Go to the SAML Configuration tab.
- Under Service Provider Configuration, do the following for each service provider:
- Click on the + button to add a service provider.
- In Service Provider Details, define the service provider as follows:
- In Configuration file, click on the upload symbol and select the metadata file.
- In Alias, enter a name to define the service provider. This must match the <alias> in the Location in the metadata file. If needed, multiple aliases can be given to the same application.
Example: explorer or self-service. - In Alias for Signing Key and Alias for Encryption Key, enter the names of the private keys for signing and encryption that must be available in Available Key Aliases.
The metadata file for the SAML identity provider will be uploaded in a later step.
PRIME Self-Service needs the following additional configurations:
Make sure that SAML is enabled in the configuration file /prime-ussp/assets/config/config.json:
Example: config.json/prime-ussp/assets/config/config.json ... { ... "saml": { "enabled": true } }
- Set up the communication between PRIME Self-Service and PRIME Explorer:
- Open the file \prime_ussp\WEB-INF\classes\application.yaml.
Adapt the URLs pointing to PRIME Explorer. If you use HTTPS instead of HTTP you must ensure that the SSL server certificate of PRIME Explorer is trusted by the java environment that runs the PRIME Self-Service (tomcat).
Make sure that cookie forwarding is activated, that is, that there are empty values for the propertysensitiveHeaders for the SAML routes in the configuration file.
This is the default configuration.
Example: application.yamlapplication.yaml ... zuul: ... routes: ... saml: path: /saml sensitiveHeaders: url: http://localhost:8080/prime_explorer/saml/login samllogin: path: /saml/** sensitiveHeaders: url: http://localhost:8080/prime_explorer/saml/
Set up identity provider, for example Hybrid Access Gateway
To have a secure communication between the identity provider and PRIME, server certificates must be provided by each server.
Example - Add server certificate in Hybrid Access Gateway:
- Log in to Hybrid Access Gateway administration interface.
- Go to Manage System > Certificates.
- In Server Certificates, click Add Server Certificate…
Enter a Display Name and browse for the files, to define Certificate and Key:
Example: Add server certificateDisplay Name: hag.local
Certificate: hag.local.pem
Key: key.pem
- Click Next > to finish the wizard.
Private keys are used to digitally sign SAML messages and encrypt their content. Both parties need their own key-pair that could be created in self-signed mode (for testing purpose) or received from a public key infrastructure (for productive systems).
Example - Enable Hybrid Access Gateway to use the SAML certificate for signing:
- Log in to Hybrid Access Gateway administration interface.
- Go to Manage System > Certificates.
- In Server Certificates, click Add Server Certificate…
Enter a Display Name and browse for the files, to define Certificate and Key:
Example: Add SAML certificateDisplay Name: SAML IdP Signing
Certificate: hag.saml.pem
Key: hag.saml.key.pem
The Hybrid Access Gateway SAML certificate must be trusted by the Java installation that runs PRIME to have a secure communication between them.
To allow SSL communication between PRIME Explorer and PRIME Self-Service, the SSL certificate needs to be trusted as well by the Java installation. The SSL certificate can be exported from the Java Key Store with the following command:
Example: java keytool commandkeytool -export -keystore prime.local.jks -alias selfsigned -file prime.local.cer
- Click Next > to finish the wizard.
As identity provider, you can use any SAML2 compliant system. Follow the instructions of that software in order to configure it as SAML IdP. If you use Hybrid Access Gateway as identity provider, follow the steps here to create a DNS name.
Example - Create a DNS name for the Hybrid Access Gateway access point:
- Log in to Hybrid Access Gateway administration interface.
- Go to Manage Resource Access > Global Resource Settings.
- Go to the DNS Name Pool tab.
- Add a new DNS name for the access point. Give the DNS name, for example idp.hag.local, and select the corresponding Hybrid Access Gateway server certificate, for example hag.local.pem.
- Click Add and then Save.
The identity provider must be configured to define the SAML federation with the service provider, using the metadata created in PRIME.
Example - Add service provider in Hybrid Access Gateway:
- Go to Manage Resource Access > SAML Federation.
- Click Add SAML Federation....
- Enter a Display Name, for example
PRIME
. - Check Acting as Identity Provider.
- Uncheck Import metadata automatically.
- Go to the Export tab.
- Give a unique Entity ID: for example
https://hag.local/idp
. - Select the Signing Certificate, for example
SAML IdP Signing
. - Go to the Role Identity Provider tab and click Add service provider...
- Verify that SAML 2.0 is checked.
- Upload SAML 2.0 metadata, click Choose file and select the file that was created before (for example prime_explorer_saml_metadata.xml). Click Next.
- Confirm the message about the signer certificate by clicking Yes.
- Click Finish Wizard.
- Click on the created service provider, to open it.
The Display Name and Entity ID is now updated according to the metadata file.Entity ID must be unique within the federation, for example https://prime.local/sp.
Service Provider URL is where the IdP will redirect the user after successful authentication, so this must be an exact match with the SP domain, in this case https://<prime_url>/prime_explorer/saml/SSO
Example: https://prime.local/prime_explorer/saml/SSO
<prime_url> must be the same as the url that was called initially. To be sure that the SAML request and response belong together, the communication must go to the same url and protocol (http or https), and both IdP and SP must be synchronized in terms of time.
To set up NTP in HAG, see Deploy Hybrid Access Gateway and do initial setup.
Disable Require signed authentication request
Go to the Assertion Settings tab.
In Subject > Select source of subject: select E-mail. This is the unique identifier PRIME uses in standard cases, and will be used when Hybrid Access Gateway sends a SAML ticket to PRIME.
Go to the tab Manage Access Rules.
Select any suitable access rule or leave it as Any Authentication.
Click Finish Wizard and then Add.
Repeat the same steps to add PRIME Self-Service as an additional service provider.
After the service provider was configured successfully in the identity provider, the SAML metadata must be downloaded and uploaded in PRIME.
Example - Download the metadata from Hybrid Access Gateway:
- Go to Manage Resource Access > SAML Federation.
- Click on the created service provider, to open it.
- Go to the tab Export.
- Click Download metadata.
Upload the metadata file to the SAML Authentication Profile in PRIME Explorer and select the Type as METADATA. No File Properties needs to be configured for the identity provider meta-data.
Make sure that the PRIME server and the Hybrid Access Gateway server have the same time configured.
Upload identity provider metadata to PRIME
After the metadata files have been created they must be uploaded to the authentication profile in PRIME Designer. This section describes how to upload the identity provider metadata files.
- Open the SAML SSO authentication profile that was created earlier.
- Go to the SAML Configuration tab.
- Under Identity Provider Configuration, do the following:
- In Configuration File, click the upload symbol to browse for and select the metadata file that has been provided from the identity provider, for example downloaded from Hybrid Access Gateway.
- In Attribute Type, select either option for where the authentication information shall be communicated:
- NameID refers to the subject of a SAML response. Use an appropriate value that matches the desired field in the CoreObject.
- Attribute Statement refers to attributes associated with the subject of a SAML response.
- If Attribute Statement was selected, then also enter one or more names in Attribute Name.
Make sure that the PRIME server and the Identity Provider server (for example Hybrid Access Gateway) have the same time configured.
This article is valid from PRIME 3.12
Related information
- No labels