Repository navigation
feat(client): Add client auth support #462
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
Merged
matthewgrossman
merged 14 commits into
main
from
mgrossman/AUTH-aircore-828-add-first-class-auth-support-to-nemoclient-replace
Jun 26, 2026
Merged
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e7a7042
feat(client): Add client auth support
matthewgrossman a045a7d
Merge branch 'main' into mgrossman/AUTH-aircore-828-add-first-class-a…
matthewgrossman 4e6b4f3
fix(client): remove unused imports and fix import sorting in auth tests
matthewgrossman 5921b61
fix(client): fix ruff formatting and ty type errors in auth code
matthewgrossman 678c268
fix(client): review fixes — remove dead code, deduplicate constant, s…
matthewgrossman 644fcc5
refactor(client): split auth.py into auth, oidc, and oidc_factory mod…
matthewgrossman db0a84f
lint
matthewgrossman eea7235
fix(client): address review + CodeRabbit feedback
matthewgrossman 0ce4588
Merge branch 'main' into mgrossman/AUTH-aircore-828-add-first-class-a…
matthewgrossman 7128eed
fix(client): address remaining CodeRabbit feedback
matthewgrossman 0f699ac
Merge branch 'main' into mgrossman/AUTH-aircore-828-add-first-class-a…
matthewgrossman f5df88b
refactor(client): simplify client_provider to plain factory functions
matthewgrossman a3d07b6
Merge branch 'main' into mgrossman/AUTH-aircore-828-add-first-class-a…
matthewgrossman e424eb5
refactor(client): remove premature get_nemo_client FastAPI dependency…
matthewgrossman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
packages/nemo_platform_plugin/src/nemo_platform_plugin/client/auth.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Authentication protocols and helpers for NemoClient. | ||
|
|
||
| Defines the protocols that any token provider must satisfy, plus simple | ||
| concrete implementations. | ||
|
|
||
| OIDC-specific machinery lives in :mod:`~.oidc` (token provider, token set, | ||
| discovery) and :mod:`~.oidc_factory` (provider caching, config persistence). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Protocol, runtime_checkable | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Protocols | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| @runtime_checkable | ||
| class TokenProvider(Protocol): | ||
| """Sync protocol for objects that can supply an access token.""" | ||
|
|
||
| def get_access_token(self) -> str: ... | ||
|
|
||
|
|
||
| @runtime_checkable | ||
| class AsyncTokenProvider(Protocol): | ||
| """Async protocol for objects that can supply an access token.""" | ||
|
|
||
| async def get_access_token(self) -> str: ... | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # StaticToken | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| class StaticToken: | ||
| """Wraps a plain token string into a TokenProvider.""" | ||
|
|
||
| def __init__(self, token: str) -> None: | ||
| self._token = token | ||
|
|
||
| def get_access_token(self) -> str: | ||
| return self._token | ||
|
|
||
| async def get_access_token_async(self) -> str: | ||
| return self._token | ||
|
|
||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # Auth errors | ||
| # --------------------------------------------------------------------------- | ||
|
|
||
|
|
||
| class AuthError(Exception): | ||
| """Authentication-related error.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.