diff --git a/deploy/helm/config/config.yaml b/deploy/helm/config/config.yaml index 9c708e6a..0e1469ef 100644 --- a/deploy/helm/config/config.yaml +++ b/deploy/helm/config/config.yaml @@ -52,11 +52,3 @@ GLOBAL: - mobile Token.issue: - credentials - - HANDLERS: - authentication: - - backend: spaceone.core.handler.authentication_handler.AuthenticationGRPCHandler - uri: grpc://identity:50051/v1/Domain/get_public_key - authorization: - - backend: spaceone.core.handler.authorization_handler.AuthorizationGRPCHandler - uri: grpc://identity:50051/v1/Authorization/verify diff --git a/src/spaceone/identity/conf/global_conf.py b/src/spaceone/identity/conf/global_conf.py index 510290eb..b1b5955b 100644 --- a/src/spaceone/identity/conf/global_conf.py +++ b/src/spaceone/identity/conf/global_conf.py @@ -66,6 +66,7 @@ "SpaceConnector": { "backend": "spaceone.core.connector.space_connector.SpaceConnector", "endpoints": { + "identity": "grpc://localhost:50051", "plugin": "grpc://plugin:50051", "secret": "grpc://secret:50051", "repository": "grpc://repository:50051", diff --git a/src/spaceone/identity/model/api_key/request.py b/src/spaceone/identity/model/api_key/request.py index 34f7c694..5a50f8e4 100644 --- a/src/spaceone/identity/model/api_key/request.py +++ b/src/spaceone/identity/model/api_key/request.py @@ -56,7 +56,6 @@ class APIKeySearchQueryRequest(BaseModel): query: Union[dict, None] = None api_key_id: Union[str, None] = None name: Union[str, None] = None - owner_type: str = "USER" user_id: Union[str, None] = None state: Union[str, None] = None domain_id: str @@ -64,6 +63,5 @@ class APIKeySearchQueryRequest(BaseModel): class APIKeyStatQueryRequest(BaseModel): query: dict - owner_type: str = "USER" domain_id: str user_id: Union[str, None] = None diff --git a/src/spaceone/identity/service/api_key_service.py b/src/spaceone/identity/service/api_key_service.py index cb209d94..afd97ec2 100644 --- a/src/spaceone/identity/service/api_key_service.py +++ b/src/spaceone/identity/service/api_key_service.py @@ -183,7 +183,6 @@ def list(self, params: APIKeySearchQueryRequest) -> Union[APIKeysResponse, dict] 'query': 'dict', 'api_key_id': 'str', 'name': 'str', - 'owner_type': 'str', 'user_id': 'str', 'state': 'str', 'domain_id': 'str' # required @@ -208,7 +207,6 @@ def stat(self, params: APIKeyStatQueryRequest) -> dict: Args: params (dict): { 'query': 'dict', # required - 'owner_type': 'str', 'domain_id': 'str', # required 'user_id': 'str', # from meta } @@ -219,6 +217,8 @@ def stat(self, params: APIKeyStatQueryRequest) -> dict: } """ query = params.query or {} + query = self._append_owner_type_filter(query) + return self.api_key_mgr.stat_api_keys(query) @staticmethod @@ -236,7 +236,6 @@ def _get_expired_at(expired_at: str) -> str: @staticmethod def _check_expired_at(expired_at: str) -> None: one_year_later = datetime.now() + timedelta(days=365) - print(one_year_later) if one_year_later.strftime("%Y-%m-%d %H:%M:%S") < expired_at: raise ERROR_API_KEY_EXPIRED_LIMIT(expired_at=expired_at) diff --git a/src/spaceone/identity/service/domain_service.py b/src/spaceone/identity/service/domain_service.py index 4e98e2dc..541e72a8 100644 --- a/src/spaceone/identity/service/domain_service.py +++ b/src/spaceone/identity/service/domain_service.py @@ -3,6 +3,7 @@ from spaceone.core.service import * from spaceone.core.service.utils import * +from spaceone.core import utils from spaceone.identity.manager.external_auth_manager import ExternalAuthManager from spaceone.identity.manager.domain_manager import DomainManager @@ -17,11 +18,10 @@ _LOGGER = logging.getLogger(__name__) -# @authentication_handler -# @authorization_handler -# @request_mutation_handler -# @response_mutation_handler -# @event_handler +@authentication_handler +@authorization_handler +@mutation_handler +@event_handler class DomainService(BaseService): service = "identity" @@ -201,7 +201,7 @@ def get_public_key( """ pub_jwk = self.domain_secret_mgr.get_domain_public_key(params.domain_id) - return DomainSecretResponse(public_key=str(pub_jwk), domain_id=params.domain_id) + return DomainSecretResponse(public_key=utils.dump_json(pub_jwk), domain_id=params.domain_id) @transaction(scope='system_admin:read') @append_query_filter(["domain_id", "name", "state"])