OpenSlides / OpenSlides/openslides-backend

Automate SAML setup via a new action

Open
#1,933 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
9
Forks
40
Avg merge
1d 22h
Merged PRs (30d)
19

Description

At the moment the following (here relevant) SAML related fields are defined:

  # Saml settings 
  # [...]                                                         
  saml_metadata_idp:                                 
    type: text                                                      
    restriction_mode: A                                                          
  saml_metadata_sp:                       
    type: text                                                   
    restriction_mode: A                                                                                                                                                                                             
  saml_private_key:                                                                                                                                                                                                 
    type: text                                                                                                                                                                                                      
    restriction_mode: A           

As far as I know these are set with a simple organization.update action issued by the client.
This is very error prone and should instead be mostly automated.
It requires the end user to manually generate and input a keypair and metadata for SP (OpenSlides), see https://github.com/OpenSlides/openslides-client/issues/2944.
I think the backend should just provide an action to automatically generate the needed information, like organization.generate_saml_metadata.
This should then generate a x509 key pair and use it's public key and other relevant information from the database (such as URL) to construct saml_metadata_sp.
The organization.update action should then forbid changing saml_metadata_sp and saml_private_key manually.

For implementing this the backend probably should utilize the python3-saml module for which inspiration may be found at https://github.com/OpenSlides/OpenSlides/tree/stable/3.4.x/server/openslides/saml
However OpenSlides 3 did not generate the keypair within the code so this has to be researched.
I am pretty confident though, a good stable library for this exists.
The generated key pair should be equivalent to the output of

openssl req -new -x509 -days 3652 -nodes -out sp.crt -keyout sp.key

Also IdP's usually provide their metadata xml via an http route. So I think it would also be more user-friendly and intuitive to change the saml_metadata_idp to saml_metadata_idp_url, although this is not as important and may also be debatable.
This of course would also implicate that the URL must be queried at some point and I am not sure if the backend should be the one doing that. So maybe - if at all - this should be in the client which would then keep sending the xml to the backend.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the prior SAML implementation under stable/3.4.x/server/openslides/saml and the organization.update action. Research how to generate the requested key pair and metadata, then define the organization.generate_saml_metadata behavior and how manual updates are restricted. Done means the action automates SP metadata generation and the remaining IdP metadata URL proposal is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.