Skip to content

Add randkey for krb api 1225#924

Open
Misha-Shvets wants to merge 6 commits intodevfrom
add_randkey_for_krb_api_1225
Open

Add randkey for krb api 1225#924
Misha-Shvets wants to merge 6 commits intodevfrom
add_randkey_for_krb_api_1225

Conversation

@Misha-Shvets
Copy link
Collaborator

@Misha-Shvets Misha-Shvets commented Feb 3, 2026

Добавление функционала в работу с kadmin_api

в ktadd был добавлен атрибут is_rand_key
изменил создание принципала и модификацию. теперь это post и put соответственно по урлу /principal
в kadmind добавленпа обработка algorithms

m.shvets added 5 commits February 9, 2026 12:09
… related API endpoints to utilize these schemas for better data handling and validation.
…ests, update API endpoints to accept parameters directly for improved clarity and simplicity.
…API interactions

- Introduced new request models: AddPrincipalRequest, KtaddRequest, and ModifyPrincipalRequest for better structure and validation.
- Updated API endpoints to use the new request models, ensuring correct JSON structure for principal creation and keytab addition.
- Enhanced error handling and logging for keytab operations.
- Refactored existing methods to accommodate new parameters for encryption algorithms and random key generation.
…o improve parameter handling and request structure

- Modified the API endpoints for adding and renaming principals to align with new request models.
- Adjusted assertions in tests to reflect changes in the expected arguments for kadmin methods.
- Enhanced clarity by consolidating parameters in API requests.
@Misha-Shvets Misha-Shvets force-pushed the add_randkey_for_krb_api_1225 branch from 2d19d1a to 77d0720 Compare February 9, 2026 09:09
dependencies=[Depends(verify_auth), Depends(require_master_db)],
error_map=error_map,
)
async def rename_principal(
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename - > modify

principal_new_name: str,
) -> None:
"""Rename principal in Kerberos.
async def rename_principal(self, request: PrincipalPutRequest) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename -> modify


@abstractmethod
async def rename_princ(self, name: str, new_name: str) -> None: ...
async def rename_princ(
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename -> modify


@logger_wraps()
async def rename_princ(self, name: str, new_name: str) -> None:
async def rename_princ(
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename -> modify


else:
if not is_stub:
logger.success(f"Executed {name}")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Зачем удалять эти логи ?

async def modify_principal(
self,
principal_name: str,
new_principal_name: str | None = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Put запрос с full modify разве нет ? почему изменения опциональны ?

"""Request model for modifying principal."""

principal_name: str
new_principal_name: str | None = Field(default=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

схем отличается от той, что в клиенте

)

if password is not None:
if password == "":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Зачем пересоздавать принципал, если передан пустой пароль ?

:param Annotated[AbstractKRBManager, Depends kadmin: kadmin abstract
:param Annotated[str, Body name: principal name
:param Annotated[str, Body password: principal password
<<<<<<< Updated upstream
Copy link
Collaborator

Choose a reason for hiding this comment

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

лишнее записалось

Copy link
Collaborator

Choose a reason for hiding this comment

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

Чет не понял. А ручка reset_principal_pw остается ? Почему теперь две ручки могут изменить пароль принципалу ?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants