[ 
https://issues.apache.org/jira/browse/KNOX-3426?focusedWorklogId=1038580&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1038580
 ]

ASF GitHub Bot logged work on KNOX-3426:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Aug/26 22:42
            Start Date: 28/Aug/26 22:42
    Worklog Time Spent: 10m 
      Work Description: lmccay commented on code in PR #1361:
URL: https://github.com/apache/knox/pull/1361#discussion_r3884502564


##########
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:
   Seems fair enough.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1038580)
    Time Spent: 1h 20m  (was: 1h 10m)

> 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
>            Priority: Major
>          Time Spent: 1h 20m
>  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)

Reply via email to