Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/volttron/auth/auth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import re
import logging
from typing import Any, Literal, Optional, Dict
from typing import Any, Literal, Optional
import time

import cattrs
Expand Down Expand Up @@ -176,25 +176,32 @@ def get_credentials(self, *, identity: Identity) -> Credentials:
except IdentityNotFound as e:
raise VIPError(f"Credentials not found for identity {identity}") from e

def register_remote_platform(self, platform_id: str, credentials: Any):
def add_federation_platform(self, platform_id: str, credentials: Any) -> bool:
"""
Register a remote platform for federation access

:param platform_id: ID of the remote platform
:param credentials: Authentication credentials for the remote platform (public key)
:return: True if registration was successful, False otherwise
"""
try:
# Store the platform credentials
self._federation_platforms[platform_id] = {
'credentials': credentials,
'timestamp': time.time()
}

platform_identity = f"{platform_id}"
public_creds = PublicCredentials(identity=f"{platform_identity}", publickey=credentials)
self._credentials_store.store_credentials(credentials=public_creds, overwrite=True)

self._credentials_store.store_credentials(credentials=public_creds)


_log.info(f"Federation platform registered: {platform_id}")
return True
except Exception as e:
_log.error(f"Error registering federation platform {platform_id}: {e}")
raise
return False

def remove_federation_platform(self, platform_id: str) -> bool:
"""
Expand Down
Loading