forked from NVIDIA/NVFlare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[2.5] Add authentication to Client API messages (NVIDIA#3103)
* fix cell pipe auth headers * remove unused code * remove unused imports
- Loading branch information
1 parent
f0378ac
commit f73e127
Showing
10 changed files
with
123 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,53 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
from typing import Any | ||
|
||
from nvflare.fuel.utils.validation_utils import check_str | ||
|
||
from .data_bus import DataBus | ||
|
||
|
||
def _scope_prop_key(scope_name: str, key: str): | ||
return f"{scope_name}::{key}" | ||
|
||
|
||
def set_scope_property(scope_name: str, key: str, value: Any): | ||
"""Save the specified property of the specified scope (globally). | ||
Args: | ||
scope_name: name of the scope | ||
key: key of the property to be saved | ||
value: value of property | ||
Returns: None | ||
""" | ||
check_str("scope_name", scope_name) | ||
check_str("key", key) | ||
data_bus = DataBus() | ||
data_bus.put_data(_scope_prop_key(scope_name, key), value) | ||
|
||
|
||
def get_scope_property(scope_name: str, key: str, default=None) -> Any: | ||
"""Get the value of a specified property from the specified scope. | ||
Args: | ||
scope_name: name of the scope | ||
key: key of the scope | ||
default: value to return if property is not found | ||
Returns: | ||
""" | ||
check_str("scope_name", scope_name) | ||
check_str("key", key) | ||
data_bus = DataBus() | ||
result = data_bus.get_data(_scope_prop_key(scope_name, key)) | ||
if result is None: | ||
result = default | ||
return result |
This file contains 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
This file contains 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
This file contains 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
This file contains 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