[
https://issues.apache.org/jira/browse/KNOX-3426?focusedWorklogId=1038999&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1038999
]
ASF GitHub Bot logged work on KNOX-3426:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Sep/26 06:21
Start Date: 01/Sep/26 06:21
Worklog Time Spent: 10m
Work Description: hsheinblatt commented on code in PR #1361:
URL: https://github.com/apache/knox/pull/1361#discussion_r3901313273
##########
gateway-spi/src/main/java/org/apache/knox/gateway/services/knoxidf/delegation/DelegationPolicy.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.knoxidf.delegation;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Immutable representation of a stored delegation policy record.
+ */
+public class DelegationPolicy {
+
+ private final String registrationId;
+ private final String actorAuthority;
+ private final String actorId;
+ private final String name;
+ private final String status;
+ private final Integer tokenTtlSec;
+ private final String description;
+ private final String createdBy;
+ private final Instant createdAt;
+ private final Instant updatedAt;
+ private final boolean allowHeadlessExchange;
+ private final Set<String> canActForUsers;
+ private final Set<String> canActForGroups;
+ private final Map<String, Set<String>> resourcePolicy;
+
+ public DelegationPolicy(String registrationId, String actorAuthority, String
actorId,
+ String name, String status, Integer tokenTtlSec, String description,
String createdBy,
+ Instant createdAt, Instant updatedAt, boolean allowHeadlessExchange,
+ Set<String> canActForUsers, Set<String> canActForGroups,
+ Map<String, Set<String>> resourcePolicy) {
+ this.registrationId = registrationId;
+ this.actorAuthority = actorAuthority;
+ this.actorId = actorId;
+ this.name = name;
+ this.status = status;
+ this.tokenTtlSec = tokenTtlSec;
+ this.description = description;
+ this.createdBy = createdBy;
+ this.createdAt = createdAt;
+ this.updatedAt = updatedAt;
+ this.allowHeadlessExchange = allowHeadlessExchange;
+ this.canActForUsers = Collections.unmodifiableSet(new
HashSet<>(canActForUsers));
+ this.canActForGroups = Collections.unmodifiableSet(new
HashSet<>(canActForGroups));
+ Map<String, Set<String>> copy = new HashMap<>();
+ for (Map.Entry<String, Set<String>> entry : resourcePolicy.entrySet()) {
+ copy.put(entry.getKey(), Collections.unmodifiableSet(new
HashSet<>(entry.getValue())));
+ }
+ this.resourcePolicy = Collections.unmodifiableMap(copy);
Review Comment:
Added
##########
gateway-spi/src/main/java/org/apache/knox/gateway/services/knoxidf/delegation/PolicyCheckRequest.java:
##########
@@ -0,0 +1,66 @@
+/*
+ * 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.knoxidf.delegation;
+
+import java.util.Set;
+
+/**
+ * Immutable input to {@link
DelegationPolicyService#evaluate(PolicyCheckRequest)}.
+ */
+public class PolicyCheckRequest {
+
+ private final String actorAuthority;
+ private final String actorId;
+ private final String subjectName;
+ private final String requestedResource;
+ private final Set<String> requestedScopes;
+ private final boolean headlessExchange;
+
+ public PolicyCheckRequest(String actorAuthority, String actorId, String
subjectName,
+ String requestedResource, Set<String> requestedScopes, boolean
headlessExchange) {
+ this.actorAuthority = actorAuthority;
+ this.actorId = actorId;
+ this.subjectName = subjectName;
+ this.requestedResource = requestedResource;
+ this.requestedScopes = requestedScopes;
+ this.headlessExchange = headlessExchange;
+ }
Review Comment:
Added
Issue Time Tracking
-------------------
Worklog Id: (was: 1038999)
Time Spent: 3h 10m (was: 3h)
> 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: 3h 10m
> 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)