[
https://issues.apache.org/jira/browse/KNOX-3426?focusedWorklogId=1038965&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1038965
]
ASF GitHub Bot logged work on KNOX-3426:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Sep/26 03:26
Start Date: 01/Sep/26 03:26
Worklog Time Spent: 10m
Work Description: hsheinblatt commented on code in PR #1361:
URL: https://github.com/apache/knox/pull/1361#discussion_r3900519912
##########
gateway-server/src/main/java/org/apache/knox/gateway/services/factory/DelegationPolicyServiceFactory.java:
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.knox.gateway.services.factory;
+
+import org.apache.knox.gateway.GatewayMessages;
+import org.apache.knox.gateway.config.GatewayConfig;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.services.GatewayServices;
+import org.apache.knox.gateway.services.Service;
+import org.apache.knox.gateway.services.ServiceLifecycleException;
+import org.apache.knox.gateway.services.ServiceType;
+import
org.apache.knox.gateway.services.knoxidf.delegation.EmptyDelegationPolicyService;
+import
org.apache.knox.gateway.services.knoxidf.delegation.JdbcDelegationPolicyService;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class DelegationPolicyServiceFactory extends AbstractServiceFactory {
+
+ private static final GatewayMessages LOG =
MessagesFactory.get(GatewayMessages.class);
+ private static final String DEFAULT_IMPLEMENTATION =
EmptyDelegationPolicyService.class.getName();
+
+ @Override
+ protected Service createService(GatewayServices gatewayServices, ServiceType
serviceType,
+ GatewayConfig gatewayConfig, Map<String, String> options, String
implementation)
+ throws ServiceLifecycleException {
+
+ String implementationToUse = implementation;
Review Comment:
For the empty implementation, I was following the pattern from
FederatedIdentityService, so Sandor might have a better understanding of the
intent. My understanding is that the empty service is a soft config failure.
On a config failure, you could say, that's not allowed, fail knox startup,
everything stops with a clear config exception. Other services do that, like
DefaultTokenAuthorityService. The pattern in the FederatedIdentityService,
also used in TrustedOidcIssuer, is that if there is some failure, it doesn't
block startup, instead it loads the empty service and that will cause runtime
errors if those paths are hit.
One example failure case is you've configured the delegation service enabled
flag to allow policy-driven delegation token exchanges, but you haven't
configured the delegation service. Arguably this should just fail startup
Issue Time Tracking
-------------------
Worklog Id: (was: 1038965)
Time Spent: 2.5h (was: 2h 20m)
> Delegation policy schema and JDBC implementation
> ------------------------------------------------
>
> Key: KNOX-3426
> URL: https://issues.apache.org/jira/browse/KNOX-3426
> Project: Apache Knox
> Issue Type: Task
> Components: JWT
> Reporter: Harrison Sheinblatt
> Assignee: Harrison Sheinblatt
> Priority: Major
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> Persistent storage for delegation policies, with a service interface and JDBC
> implementation. After these tasks, delegation policies can be stored and
> retrieved.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)