From 76bcb98e716422535120641f5aeac9636dfcbed0 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 8 Feb 2023 22:29:15 +0100 Subject: [PATCH] Introduce ShiroIni 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 --- .../aaa/shiro/web/env/AAAWebEnvironment.java | 4 +- .../impl/src/main/yang/aaa-app-config.yang | 107 +++++++++--------- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java index 976c8a723..ed853f1dc 100644 --- a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java +++ b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/web/env/AAAWebEnvironment.java @@ -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) { diff --git a/aaa-shiro/impl/src/main/yang/aaa-app-config.yang b/aaa-shiro/impl/src/main/yang/aaa-app-config.yang index dd2116eed..ef30f08bd 100644 --- a/aaa-shiro/impl/src/main/yang/aaa-app-config.yang +++ b/aaa-shiro/impl/src/main/yang/aaa-app-config.yang @@ -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; + } + } } -- 2.36.6