• Stan Hu's avatar
    Fix SAML SSO login redirects not working · 6e973420
    Stan Hu authored
    When a user without a SSO session attempted to access anything in a SAML
    group, previously GitLab would redirect the user back to the dashboard
    and lose the original link. This was happening because the `RelayState`
    wasn't being used since the `SessionsController#create` took over. To
    fix this, we have to do things:
    
    1. Store the `RelayState` in the Devise session helper before the
    session is created. `ApplicationController#after_sign_in_path_for` will
    run and retrieve this value.
    
    2. Ensure the `RelayState` is the right value. Previously this value
    would be set to the path of the project (e.g. mygroup/project), but this
    drops the full path that was being accessed. Now we retain the entire
    path so the `redirect` parameter is passed on to the IdP properly.
    
    Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/247674
    
    Changelog: fixed
    EE: true
    6e973420
clusters_controller.rb 771 Bytes