Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add saml sso support as the default #118

Merged
merged 16 commits into from
May 24, 2024
9 changes: 9 additions & 0 deletions bundle/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,20 @@ packages:
- name: GITLAB_SSO_ENABLED
description: "Boolean to enable or disable sso things"
path: "sso.enabled"
- name: GITLAB_SSO_PROTOCOL
description: "Protocol to use. Valid values are 'openid_connect' and 'saml'. Default value is 'saml'"
path: "sso.protocol"
- name: GITLAB_ADMIN_GROUPS
description: "Array of group names that grant admin role gitlab when saml protocol is active."
path: "sso.adminGroups"
gitlab:
variables:
- name: GITLAB_SSO_ENABLED
description: "Boolean to enable or disable sso things"
path: "global.appConfig.omniauth.enabled"
- name: GITLAB_SSO_PROTOCOL
description: "Protocol to use. Valid values are 'openid_connect' and 'saml'. Default value is 'saml'"
path: "global.appConfig.omniauth.autoSignInWithProvider"
- name: MIGRATIONS_RESOURCES
description: "Gitlab Migrations Resources"
path: "gitlab.migrations.resources"
Expand Down
2 changes: 2 additions & 0 deletions bundle/uds-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ variables:
gitlab_db_endpoint: "pg-cluster.postgres.svc.cluster.local"
DISABLE_REGISTRY_REDIRECT: "true"
GITLAB_PAGES_ENABLED: true
GITLAB_ADMIN_GROUPS: ["/GitLab Admin", "/UDS Core/Admin"]
GITLAB_SSO_PROTOCOL: saml
# # Overrides for scaled down cluster for local dev and CI
webservice_replicas: 1
webservice_resources:
Expand Down
39 changes: 37 additions & 2 deletions chart/templates/uds-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ metadata:
name: gitlab
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.sso.enabled }}
{{- if and (.Values.sso.enabled) (eq .Values.sso.protocol "openid_connect") }}
sso:
- name: Gitlab SSO
- name: GitLab Login
clientId: uds-swf-gitlab
redirectUris:
- "https://gitlab.{{ .Values.domain }}/users/auth/openid_connect/callback"

secretName: {{ .Values.sso.secretName }}
secretTemplate:
# GitLab expects a providers JSON file that is documented more here: https://gitlab-org.gitlab.io/technical-writing-group/gitlab-docs-hugo/administration/auth/oidc/
Expand Down Expand Up @@ -42,6 +43,40 @@ spec:
}
}
}
{{- else if and (.Values.sso.enabled) (eq .Values.sso.protocol "saml") }}
sso:
- name: GitLab Login
clientId: uds-swf-gitlab-saml
redirectUris:
- "https://gitlab.{{ .Values.domain }}/users/auth/saml/callback"

protocol: saml
defaultClientScopes:
- "mapper-saml-email-email"
- "mapper-saml-firstname-first_name"
- "mapper-saml-lastname-last_name"
- "mapper-saml-grouplist-groups"

attributes:
saml.client.signature: "false"

secretName: {{ .Values.sso.secretName }}
secretTemplate:
# GitLab expects a providers JSON file that is documented more here: https://docs.gitlab.com/ee/integration/saml.html
providers: |
{
"name":"saml",
"label":"SSO",
"groups_attribute": "Groups",
"admin_groups": {{ .Values.sso.adminGroups | toJson }},
"args":{
"assertion_consumer_service_url": "https://gitlab.{{ .Values.domain }}/users/auth/saml/callback",
"idp_cert": "clientField(samlIdpCertificate)",
"idp_sso_target_url": "https://sso.{{ .Values.domain }}/realms/uds/protocol/saml",
"issuer": "clientField(clientId)",
"name_identifier_format": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
}
}
{{- end }}
network:
expose:
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
domain: "###ZARF_VAR_DOMAIN###"
sso:
enabled: true
protocol: saml
secretName: gitlab-sso
adminGroups: ["/GitLab Admin", "/UDS Core/Admin"]
storage:
# Set to false to use external storage
internal: true
Expand Down
6 changes: 6 additions & 0 deletions tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ tasks:
- task: dependencies:create
- task: create:test-bundle

- name: dev
description: deploy against running cluster
actions:
- task: create-gl-test-bundle
- task: deploy:test-bundle

# CI will execute the following (via uds-common/.github/actions/test) so they need to be here with these names

- name: test-package
Expand Down
5 changes: 3 additions & 2 deletions values/common-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ global:
## https://docs.gitlab.com/charts/charts/globals#omniauth
omniauth:
enabled: true
allowSingleSignOn: ['openid_connect']
allowSingleSignOn: true
blockAutoCreatedUsers: false
autoLinkUser: true
autoSignInWithProvider: openid_connect
autoLinkSamlUser: true
autoSignInWithProvider: saml
externalProviders: []
syncProfileAttributes: ['email']
syncProfileFromProvider: []
Expand Down