Skip to content

mgr/dashboard: Improve oauth2 sso configuration - #67417

Merged
rkachach merged 1 commit into
ceph:mainfrom
webalexeu:feat/mgmt_sso_improvements
Apr 30, 2026
Merged

rkachach merged 1 commit into
ceph:mainfrom
webalexeu:feat/mgmt_sso_improvements

Conversation

@webalexeu

@webalexeu webalexeu commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

[mgr/dashboard: Fix oauth2 sso missing jti claim]

When using oauth2 sso configuration, if the OIDC provider doesn't send jti claim in the JWT token, the auhtentication is looping because the token is considered as block-listed
Improving debugging and documentation

Fixes: https://tracker.ceph.com/issues/75022
Signed-off-by: Alexandre Jardon [email protected]

[mgr/dashboard: Improve oauth2 sso configuration]
Add possibility to configure email_domains and scope parameters in oauth2 sso configuration

Fixes: https://tracker.ceph.com/issues/75020
Signed-off-by: Alexandre Jardon [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Overall the changes LGTM just a couple of comments to be addressed for correctness.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request improves OAuth2 SSO configuration for the Ceph Dashboard by:

  1. Fixing JTI claim handling: Resolves an authentication loop issue when OIDC providers don't send the jti claim in JWT tokens by improving debug logging to distinguish between missing jti claims and blocklisted tokens.
  2. Adding configuration options: Introduces scope and email_domains parameters to the oauth2-proxy service configuration, providing more control over OAuth2 authentication.

However, the PR contains several critical bugs that will prevent it from working correctly:

  • Template variables are not properly passed in the context
  • Incorrect validation applied to the scope field
  • UI component mismatch for the scope field (uses list component instead of text input)

Changes:

  • Improved jti claim handling in JWT token validation with better debug messages
  • Added scope and email_domains fields to OAuth2ProxySpec
  • Updated Angular frontend to support new OAuth2 configuration fields
  • Updated Jinja2 template to include scope and email_domains in oauth2-proxy configuration
  • Enhanced test coverage for oauth2-proxy service configuration
  • Added documentation about jti claim requirement

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/python-common/ceph/deployment/service_spec.py Added scope and email_domains parameters to OAuth2ProxySpec, but validation for scope is incorrect (validates as URL)
src/pybind/mgr/dashboard/services/auth/auth.py Improved JTI claim handling with separate debug messages for missing vs blocklisted tokens
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.ts Added form controls and data processing for scope and email_domains fields
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-form/service-form.component.html Added UI inputs for scope and email_domains, but uses wrong component type for scope
src/pybind/mgr/cephadm/tests/test_services.py Updated tests to include new scope and email_domains parameters in oauth2-proxy test cases
src/pybind/mgr/cephadm/templates/services/oauth2-proxy/oauth2-proxy.conf.j2 Added template logic for scope and email_domains, but references undefined context variables
doc/cephadm/services/oauth2-proxy.rst Documented requirement for jti claim in JWT tokens

Comment thread doc/cephadm/services/oauth2-proxy.rst Resolved
@webalexeu

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. Overall the changes LGTM just a couple of comments to be addressed for correctness.

Thanks for you quick review, PR adapted accordingly

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plz make sure the UT is passing by running:

tox -e py3 -- "cephadm/tests/test_services.py"

@github-project-automation github-project-automation Bot moved this from New to Review in progress in Ceph-Dashboard Feb 20, 2026
@rkachach

rkachach commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

@webalexeu can you plz address the issues raised by @Pegonzal ?

@webalexeu

Copy link
Copy Markdown
Contributor Author

@webalexeu can you plz address the issues raised by @Pegonzal ?

Issues have been addressed (sorry for the delay).
Let me know if ok for you or if you still want some reviews

@rkachach

Copy link
Copy Markdown
Contributor

Thanks @webalexeu, let's wait for a last review from @Pegonzal. Once reviewed I'll tag the PR for Teuthology testing.

@Pegonzal Pegonzal left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webalexeu other than some issue with the ssl_insecure_skip_verify field on the frontend, the make check is failing due to some linting issue that needs to be fixed:

[lint:html    ] [htmllint] found 0 errors out of 317 files
[lint:html    ] All files pass linting
[lint:prettier] src/app/ceph/cluster/services/service-form/service-form.component.ts
[lint:eslint  ] 
[lint:eslint  ] > nx run ceph-dashboard:lint
[lint:eslint  ] 
[lint:eslint  ] Linting "ceph-dashboard"...
[lint:eslint  ] All files pass linting.
[lint:eslint  ] 
[lint:eslint  ] 
[lint:eslint  ] 
[lint:eslint  ]  NX   Successfully ran target lint for project ceph-dashboard
[lint:eslint  ] 
[lint:eslint  ] 

Try running 'npm run fix' to fix some linting errors. Some errors might need a manual fix.

Everything else looks good to me, thank you for the update!

@rkachach

Copy link
Copy Markdown
Contributor

jenkins retest this please

2 similar comments
@rkachach

Copy link
Copy Markdown
Contributor

jenkins retest this please

@rkachach

Copy link
Copy Markdown
Contributor

jenkins retest this please

<cd-text-label-list formControlName="scope"
label="Scope"
helperText="OAuth scope specification."
placeholder="openid profile email">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenID

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we want to put upperscale here as the value defined will be lower case ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think should be fine as it is.
As can be found on the specification this is the standard way to write scope claims https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims

@rkachach

Copy link
Copy Markdown
Contributor

jenkins retest this please

@Pegonzal

Copy link
Copy Markdown
Contributor

PR LGTM @webalexeu, however looks like there is a syntax error as can be seen in the make check failure:

Error: src/app/ceph/cluster/services/service-form/service-form.component.html:1068:7 - error NG5002: Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.

1068       }
           ~

  src/app/ceph/cluster/services/service-form/service-form.component.ts:50:16
    50   templateUrl: './service-form.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ServiceFormComponent.

@webalexeu

Copy link
Copy Markdown
Contributor Author

PR LGTM @webalexeu, however looks like there is a syntax error as can be seen in the make check failure:

Error: src/app/ceph/cluster/services/service-form/service-form.component.html:1068:7 - error NG5002: Unexpected closing block. The block may have been closed earlier. If you meant to write the } character, you should use the "&#125;" HTML entity instead.

1068       }
           ~

  src/app/ceph/cluster/services/service-form/service-form.component.ts:50:16
    50   templateUrl: './service-form.component.html',
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component ServiceFormComponent.

Hello,

Sorry for the error, I've corrected accordingly

@rkachach

Copy link
Copy Markdown
Contributor

jenkins test make check

@rkachach

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@rkachach

rkachach commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

@webalexeu seems like make check is still failing...

The UT test file might needs some small adjustments:

cephadm/tests/services/test_mgmt_gateway.py

https://jenkins.ceph.com/job/ceph-pull-requests/179524/console

self = <test_mgmt_gateway.TestMgmtGateway object at 0x7d86afd53160>
get_service_endpoints_mock = <MagicMock name='get_service_endpoints' id='138014625427856'>
_run_cephadm = <AsyncMock name='_run_cephadm' id='138014625468992'>
cephadm_module = <cephadm.module.CephadmOrchestrator object at 0x7d860b32ff10>

    @patch("cephadm.serve.CephadmServe._run_cephadm")
    @patch("cephadm.services.mgmt_gateway.MgmtGatewayService.get_service_endpoints")
    @patch("cephadm.services.cephadmservice.CephadmService.get_certificates",
           lambda instance, dspec, ips=None: TLSCredentials(ceph_generated_cert, ceph_generated_key))
    @patch("cephadm.services.mgmt_gateway.MgmtGatewayService.get_self_signed_certificates_with_label",
           lambda instance, svc_spec, dspec, label, ip: TLSCredentials(ceph_generated_cert, ceph_generated_key))
    @patch("cephadm.module.CephadmOrchestrator.get_mgr_ip", lambda _: '::1')
    @patch('cephadm.cert_mgr.CertMgr.get_root_ca', lambda instance: cephadm_root_ca)
    @patch("cephadm.services.mgmt_gateway.get_dashboard_endpoints", lambda _: (["ceph-node-2:8443", "ceph-node-2:8443"], "https"))
    def test_oauth2_proxy_service(self, get_service_endpoints_mock, _run_cephadm, cephadm_module):
>       self.oauth2_proxy_service_common(get_service_endpoints_mock, _run_cephadm, cephadm_module, virtual_ip=None)

cephadm/tests/services/test_mgmt_gateway.py:701: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
cephadm/tests/services/test_mgmt_gateway.py:810: in oauth2_proxy_service_common
    _run_cephadm.assert_called_with(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <AsyncMock name='_run_cephadm' id='138014625468992'>
args = ('ceph-node', 'oauth2-proxy.ceph-node', ['_orch', 'deploy'], [])
kwargs = {'error_ok': True, 'stdin': '{"fsid": "fsid", "name": "oauth2-proxy.ceph-node", "image": "", "deploy_arguments": [], "...ucQ/J3Cvd0dWUspJfLHJ\\n39gnaegswnz9KMQAvzKFdg==\\n-----END PRIVATE KEY-----\\n"}}}', 'use_current_daemon_image': False}
expected = call('ceph-node', 'oauth2-proxy.ceph-node', ['_orch', 'deploy'], [], stdin='{"fsid": "fsid", "name": "oauth2-proxy.cep...UspJfLHJ\\n39gnaegswnz9KMQAvzKFdg==\\n-----END PRIVATE KEY-----\\n"}}}', error_ok=True, use_current_daemon_image=False)
actual = call('ceph-node', 'oauth2-proxy.ceph-node', ['_orch', 'deploy'], [], stdin='{"fsid": "fsid", "name": "oauth2-proxy.cep...UspJfLHJ\\n39gnaegswnz9KMQAvzKFdg==\\n-----END PRIVATE KEY-----\\n"}}}', use_current_daemon_image=False, error_ok=True)
_error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7d860ad2b0a0>
cause = None

    def assert_called_with(self, /, *args, **kwargs):
        """assert that the last call was made with the specified arguments.
    
        Raises an AssertionError if the args and keyword args passed in are
        different to the last call to the mock."""
        if self.call_args is None:
            expected = self._format_mock_call_signature(args, kwargs)
            actual = 'not called.'
            error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                    % (expected, actual))
            raise AssertionError(error_message)
    
        def _error_message():
            msg = self._format_mock_failure_message(args, kwargs)
            return msg
        expected = self._call_matcher(_Call((args, kwargs), two=True))
        actual = self._call_matcher(self.call_args)
        if actual != expected:
            cause = expected if isinstance(expected, Exception) else None
>           raise AssertionError(_error_message()) from cause

@Pegonzal

Copy link
Copy Markdown
Contributor

Hey @webalexeu, just FYI ( as some linting issues might still be present): to verify that the dashboard changes are up to linting standards you can run:

from mgr/dashboard/frontend folder

npm run lint to runt linting checks
npm run fix to fix with prettier

from mgr/dashboard/ folder

tox -e lint

@rkachach

Copy link
Copy Markdown
Contributor

@webalexeu Dashboard UT is failing:

Label Time Summary:
PurePython    = 1339.19 sec*proc (16 tests)
PythonTox     = 1339.19 sec*proc (16 tests)

Total Test time (real) = 1586.02 sec

The following tests FAILED:
	209 - mgr-dashboard-frontend-unittests (Failed)
Errors while running CTest
2026-04-24 13:34:04,571: INFO: step done: tests completed in 00:32:34
+ npm_cache_info

plz follow instructions provided by @Pegonzal to fix it.

Add possibility to configure email_domains and scope parameters in oauth2 sso configuration
Fixes: https://tracker.ceph.com/issues/75020

mgr/dashboard: Fix oauth2 sso missing jti claim review
Fixes: https://tracker.ceph.com/issues/75022

mgr/dashboard: Improve oauth2 sso configuration
Add possibility to configure ssl_insecure_skip_verify parameter in oauth2 sso configuration
Fixes: https://tracker.ceph.com/issues/75984

Signed-off-by: Alexandre Jardon <[email protected]>
@webalexeu

Copy link
Copy Markdown
Contributor Author

Label Time Summary:
PurePython = 1339.19 secproc (16 tests)
PythonTox = 1339.19 sec
proc (16 tests)

Total Test time (real) = 1586.02 sec

The following tests FAILED:
209 - mgr-dashboard-frontend-unittests (Failed)
Errors while running CTest
2026-04-24 13:34:04,571: INFO: step done: tests completed in 00:32:34

  • npm_cache_info

Locally, it is all green so I don't know what is blocking ?

[lint:html ] [htmllint] found 0 errors out of 317 files
[lint:html ] All files pass linting

NX Successfully ran target lint for project ceph-dashboard

Success! No issues detected.
lint: OK (156.60=setup[0.16]+cmd[15.67,2.66,3.73,0.74,130.40,3.25] seconds)
congratulations :) (156.69 seconds)

@webalexeu

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cephadm changes: LGTM

@rkachach

Copy link
Copy Markdown
Contributor

@Pegonzal @anthonyeleven are the changes corresponding to you areas good to go?

@rkachach

Copy link
Copy Markdown
Contributor

Teuthology run was successful. Failing Test cases are not related to this PR: https://pulpito.ceph.com/rkachach-2026-04-29_15:06:59-orch:cephadm-wip-rkachach-testing-2-2026-04-29-1255-distro-default-trial/

@Pegonzal Pegonzal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution @webalexeu !

@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/25162165836

@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/25162165836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants