In order to create and manage users with MAS enabled, we'll need to reach out to the MAS admin API. We can do so automatically by requesting an admin-enabled token, assuming a matching client has been configured on the MAS side. Add some config options for the guest module (OAuth2 client) side.
31 lines
802 B
Python
31 lines
802 B
Python
# Copyright 2023 Nordeck IT + Consulting GmbH
|
|
# Copyright 2025 New Vector Ltd.
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
# Please see LICENSE files in the project root for full details.
|
|
#
|
|
# Originally licensed under the Apache License, Version 2.0:
|
|
# <http://www.apache.org/licenses/LICENSE-2.0>.
|
|
|
|
from typing import Optional
|
|
|
|
import attr
|
|
|
|
|
|
@attr.s(frozen=True, auto_attribs=True)
|
|
class MasConfig:
|
|
admin_api_base_url: str
|
|
oauth_base_url: str
|
|
client_id: str
|
|
# TODO: Add a filepath option for the secret as well.
|
|
client_secret: str
|
|
|
|
|
|
@attr.s(frozen=True, auto_attribs=True)
|
|
class GuestModuleConfig:
|
|
user_id_prefix: str
|
|
display_name_suffix: str
|
|
enable_user_reaper: bool
|
|
user_expiration_seconds: int
|
|
mas: Optional[MasConfig] = None
|