Users authentication with SAML and GSuite
If you are going to implement this type of authentication this action implies you clearly understand what you are doing.
Prerequisites
- You need to have administrative access to GSuite or an admin near you.
- You need the access to Allure Testops configuration files.
- You need to be able to apply the changes in the configuration, which could require some downtime.
- Allure Testops needs work behind HTTPS, i.e. there must be something like reverse proxy between Allure Testops and GSuite servers. Please consult your network administrator or DevOps to ensure proper configuration on the network side.
Integration of Allure Testops and GSuite
Given
- Allure Testops is deployed and accessible on
http://allure.local
your URLs will be different. - GSuite administration is accessible on
https://admin.google.com
.
Creating new application in GSuite
In GSuite (https://admin.google.com):
- Go to Web and mobile apps.
- Click Add app then Add custom SAML app.
- Add a name (we prefer Allure Testops) and an icon for the application if you want, then press Continue.
- In the next screen click Download metadata and save metadata to a file to your local PC (say, it'll be
metadata.xml
).
- Add all the needed information as follows:
- ACS URL:
https://allure.local/api/login/saml2/sso/gsuite
- Entity ID:
https://allure.local/api/login/saml2/service-provider-metadata/gsuite
- Name ID format:
EMAIL
- Name ID:
Basic Information > Primary email
- ACS URL:
- Then press Continue and finally Finish.
Configuring Allure Testops
Making metadata file available via some URL
We downloaded metadata.xml
, remember?
Now, you need to make this file available for Allure Testops gateway service. This will be required for all the deployment options.
A few options here:
- File can be added to gateway's volume and it will be added to gateway parameters like file
file:///path/to/metadata.xml
- File can be provided via some URL, and it will be added to gateway parameters like URL
https://some.url/metadata.xml
.
Deployment in Kubernetes
For k8s deployment you need to add the parameters to open environment of gateway service of values.yaml
file used to pass user's configuration to Helm.
<snip>
gateway:
env:
secret:
# security
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_ACS_LOCATION: https://allure-local/api/login/saml2/sso/gsuite
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_ENTITYID: https://allure.local/api/login/saml2/service-provider-metadata/gsuite
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_IDENTITYPROVIDER_METADATAURI: https:///some.url/metadata.xml
<snip>
Now, to use GSuite as Identity provider, you need to update your Allure Testops configuration as usual for Kubernetes installation using Helm's commands.
Deployment via docker-compose
For the deployment done via docker-compose you need to update docker-compose.yml
configuration file by adding the parameters to gateway service.
Updating of the configuration requires downtime to properly stop and run the application.
gateway:
<snip>
environment:
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_ACS_LOCATION: https://allure.local/api/login/saml2/sso/gsuite
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_ENTITYID: https://allure.local/api/login/saml2/service-provider-metadata/gsuite
SPRING_SECURITY_SAML2_RELYINGPARTY_REGISTRATION_GSUITE_IDENTITYPROVIDER_METADATAURI: https:///some.url/metadata.xml
<snip>
To update Allure Testops for the usage GSuite as identity provider you need to perform the same actions you do for updating Allure Testops using docker-compose commands., i.e. 1) down
, 2) then start the application using up -d
Deployment via packages
Update properties file /opt/allure-ee/gateway/conf/allure-gateway.properties
with the following string:
spring.security.saml2.relyingparty.registration.gsuite.acs.location=https://allure.local/api/login/saml2/sso/gsuite
spring.security.saml2.relyingparty.registration.gsuite.entityId=https://allure.local/api/login/saml2/service-provider-metadata/gsuite
spring.security.saml2.relyingparty.registration.gsuite.identityprovider=https:///some.url/metadata.xml
Setting the default authentication way
When you've updated the settings and these were successfully applied, you need to check the authentication by trying to log in using the following URL:
https://allure.local/login/oauth2
,
Your URL will differ, you remember, right? Only this part you need to take for test from this guide: /login/oauth2
When you've successfully tested the authentication, you can switch to SAML2 as main authentication method.
Deployment in Kubernetes
uaa:
<snip>
env:
open:
ALLURE_LOGIN_PRIMARY:saml2
<snip>
Deployment via docker-compose
uaa:
<snip>
environment:
ALLURE_LOGIN_PRIMARY: saml2
Deployment via packages
Update properties file /opt/allure-ee/uaa/conf/allure-uaa.properties
with the following string:
allure.login.primary=saml2
Setting the default role for new user registering via saml/gsuite
Why
If no additional setting made all new users will have ROLE_USER
by default and will consume 1 license.
What
To prevent new users consuming the licenses you need to define the default role for them as ROLE_GUEST
, when they register in the system using saml/gsuite. This will ensure they will have read only access by default and won't consume any licenses in the system.
How
The following parameter should be set for UAA service:
For docker-compose and Kubernetes deployment
ALLURE_LOGIN_SAML2_DEFAULTROLE: ROLE_GUEST
For the deployment using packages
allure.login.saml2s.defaultRole: ROLE_GUEST