Introduce ShiroIni 31/104331/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Feb 2023 21:29:15 +0000 (22:29 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 8 Feb 2023 21:37:14 +0000 (22:37 +0100)
ShiroConfiguration is tied to a concrete datastore instance. Split its
contents into ShiroIni based on a grouping. This will allow us to
flexibly inject configuration from multiple sources.

JIRA: AAA-205
Change-Id: I918f5089cd48efa46009a97664afbea775cb8fbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java
aaa-shiro/impl/src/main/yang/aaa-app-config.yang

index 976c8a72345890c95c3d341e5fc87a677c987f66..ed853f1dc8315ab216fd008336e091f40c51b1ef 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.aaa.shiro.realm.TokenAuthRealm;
 import org.opendaylight.aaa.tokenauthrealm.auth.TokenAuthenticators;
 import org.opendaylight.aaa.web.servlet.ServletSupport;
 import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.ShiroConfiguration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.aaa.app.config.rev170619.ShiroIni;
 import org.opendaylight.yangtools.util.ClassLoaderUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,7 +39,7 @@ public final class AAAWebEnvironment extends IniWebEnvironment implements AAAShi
         setIni(ini);
     }
 
-    public static AAAWebEnvironment create(final ShiroConfiguration shiroConfiguration, final DataBroker dataBroker,
+    public static AAAWebEnvironment create(final ShiroIni shiroConfiguration, final DataBroker dataBroker,
             final ICertificateManager certificateManager, final AuthenticationService authenticationService,
             final TokenAuthenticators tokenAuthenticators, final TokenStore tokenStore,
             final PasswordHashService passwordHashService, final ServletSupport servletSupport) {
index dd2116eed29100cc041dc4247fec658cfadb1b66..ef30f08bd1942e159577c45ed370dc1cb7112fbf 100644 (file)
@@ -1,63 +1,68 @@
 module aaa-app-config {
-    yang-version 1;
-    namespace "urn:opendaylight:aaa:app:config";
-    prefix "aaa-app-config";
-    organization "OpenDaylight";
+  yang-version 1;
+  namespace "urn:opendaylight:aaa:app:config";
+  prefix "aaa-app-config";
+  organization "OpenDaylight";
 
-    contact "ryandgoulding@gmail.com, m.elserngawy@gmail.com";
+  contact "ryandgoulding@gmail.com, m.elserngawy@gmail.com";
 
-    revision "2017-06-19" {
-        description "aaa-app-config is used to manipulate aspects of AAA clustered-app-config.";
-    }
+  revision "2017-06-19" {
+   description "aaa-app-config is used to manipulate aspects of AAA clustered-app-config.";
+  }
 
-    grouping string-pair {
-        description "Used to store string key/value pairs.";
-        leaf pair-key {
-            type string;
-            description "The key.";
-        }
-        leaf pair-value {
-            type string;
-            description "The value.";
-        }
+  grouping string-pair {
+    description "Used to store string key/value pairs.";
+    leaf pair-key {
+      type string;
+      description "The key.";
     }
+    leaf pair-value {
+      type string;
+      description "The value.";
+    }
+  }
 
-    container shiro-configuration {
-        description "AAA shiro related configuration.";
-        list main {
-            key "pair-key";
-            uses string-pair;
-            ordered-by user;
-            description "The main section of shiro.ini.";
-        }
+  grouping shiro.ini {
+    description "Basic structure of generated shiro.ini";
 
-        list urls {
-            key "pair-key";
-            uses string-pair;
-            ordered-by user;
-            description "The urls section of shiro.ini.";
-        }
+    list main {
+      key "pair-key";
+      uses string-pair;
+      ordered-by user;
+      description "The main section of shiro.ini.";
     }
 
-    container datastore-config {
-        leaf store {
-            description "Available data store types.";
-            type enumeration {
-                enum h2-data-store {
-                    description "H2 DataStore.";
-                }
-            }
-        }
-        leaf time-to-live {
-            description "Time to live for tokens in second.";
-             type uint64;
-             default 36000;
-         }
-         leaf time-to-wait {
-             description "Time to wait for tokens in second.";
-             type uint64;
-             default 3600;
-         }
+    list urls {
+      key "pair-key";
+      uses string-pair;
+      ordered-by user;
+      description "The urls section of shiro.ini.";
     }
+  }
+
+  container shiro-configuration {
+    description "AAA shiro related configuration.";
+    uses shiro.ini;
+  }
 
+  container datastore-config {
+    leaf store {
+      description "Available data store types.";
+      type enumeration {
+        enum h2-data-store {
+          description "H2 DataStore.";
+        }
+      }
+    }
+    leaf time-to-live {
+      description "Time to live for tokens in second.";
+      type uint64;
+      default 36000;
+    }
+    leaf time-to-wait {
+      description "Time to wait for tokens in second.";
+      type uint64;
+      default 3600;
+    }
+  }
 }