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

Support for Keycloak SAML Client creation #326

Closed
ericwyles opened this issue Apr 3, 2024 · 1 comment
Closed

Support for Keycloak SAML Client creation #326

ericwyles opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ericwyles
Copy link
Contributor

ericwyles commented Apr 3, 2024

Updates to uds-core to support creation of saml clients in Keycloak, in addition to the existing support for OIDC clients.

Describe the solution you'd like

  • Allow specifying protocol: saml in the sso spec. The protocol field should be optional and restricted to either openid-connect or saml (default to openid-connect)
  • Allow specifying protocl mappers. This is also needed for Keycloak client mappers configuration #305 and there are additional mappers needed for saml.
  • Allow specifying attributes for the client-registration request to keycloak. This should be restricted to an allowed list of attributes, currently the only allowed key is saml.client.signature
  • In the SSO Secret templating, we need to make available the value of keycloak's SAML x509 signing certificate. That value is available in the xml payload here: http://keycloak-http.keycloak.svc.cluster.local:8080/realms/uds/protocol/saml/descriptor and should be fetched programatically and made available to secret templating.

Describe alternatives you've considered

Considered using OIDC instead but some apps don't support it (sonarqube) and we are going forward with gitlab as well.

Additional context

Below is an example request to the keycloak client-registration endpoint showing everything that is required to configure a saml client for sonarqube, this should illustrate the details listed above.

  {
    "clientId": "sonarqube",
    "name": "sonarqube",
    "redirectUris": [
      "https://sonarqube.uds.dev/oauth2/callback/saml"
    ],
    "webOrigins": [
      "https://sonarqube.uds.dev"
    ],
    "protocol": "saml",
    "attributes": {
      "saml.client.signature": "false"
    },
    "protocolMappers": [
      {
        "name": "Name",
        "protocol": "saml",
        "protocolMapper": "saml-user-property-mapper",
        "consentRequired": false,
        "config": {
          "user.attribute": "Username",
          "attribute.nameformat": "Basic",
          "attribute.name": "name"
        }
      },
      {
        "name": "Email",
        "protocol": "saml",
        "protocolMapper": "saml-user-property-mapper",
        "consentRequired": false,
        "config": {
          "user.attribute": "Email",
          "attribute.nameformat": "Basic",
          "attribute.name": "email"
        }
      },
      {
        "name": "Login",
        "protocol": "saml",
        "protocolMapper": "saml-user-property-mapper",
        "consentRequired": false,
        "config": {
          "user.attribute": "Username",
          "attribute.nameformat": "Basic",
          "attribute.name": "login"
        }
      }
    ],
    "defaultClientScopes": [],
    "optionalClientScopes": []
  }
@ericwyles ericwyles added the enhancement New feature or request label Apr 3, 2024
@ericwyles ericwyles self-assigned this Apr 3, 2024
rjferguson21 added a commit that referenced this issue Apr 19, 2024
…operator (#328)

## Description

Add support for saml protocol and attributes and protocolMappers support
for keycloak clients.

## Related Issue
Relates to #326 
Relates to #305

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)(https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed

---------

Co-authored-by: Rob Ferguson <rjferguson21@gmail.com>
Co-authored-by: Chance <139784371+UnicornChance@users.noreply.github.com>
Co-authored-by: Micah Nagel <micah.nagel@defenseunicorns.com>
@ericwyles
Copy link
Contributor Author

We ended up going a different direction with protocol mappers. Instead of exposing them through the spec here, we built some client scopes that bring mappers with them into the keycloak realm in uds-identity-config. A PR showing this pattern is here: defenseunicorns/uds-identity-config#57

And a client can reference them using the defaultScopes in the spec to get the mappers.

rjferguson21 added a commit that referenced this issue Jul 11, 2024
…operator (#328)

## Description

Add support for saml protocol and attributes and protocolMappers support
for keycloak clients.

## Related Issue
Relates to #326 
Relates to #305

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)(https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed

---------

Co-authored-by: Rob Ferguson <rjferguson21@gmail.com>
Co-authored-by: Chance <139784371+UnicornChance@users.noreply.github.com>
Co-authored-by: Micah Nagel <micah.nagel@defenseunicorns.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant