[Yanel-commits] rev 28668 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/map

michi at wyona.com michi at wyona.com
Fri Nov 9 10:19:52 CET 2007


Author: michi
Date: 2007-11-09 10:19:51 +0100 (Fri, 09 Nov 2007)
New Revision: 28668

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
Log:
read web authenticator class from realm config

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java	2007-11-09 09:00:57 UTC (rev 28667)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java	2007-11-09 09:19:51 UTC (rev 28668)
@@ -152,8 +152,25 @@
             setIdentityManager(identityManager);
         }
 
+        // Set WebAuthenticator for this realm
+        Configuration waConfigElement = config.getChild("web-authenticator", false);
+        if (waConfigElement != null) {
+            WebAuthenticator wa = null;
+            try {
+            	String customWebAuthenticatorImplClassName = waConfigElement.getAttribute("class");
+            	wa = (WebAuthenticator) Class.forName(customWebAuthenticatorImplClassName).newInstance();
+                // TODO: Read configuration ...
+/*
+                identityManager = imFactory.newIdentityManager(ConfigurationUtil.getCustomConfiguration(repoConfigElement, "identity-manager-config", "http://www.wyona.org/security/1.0"), new RealmConfigPathResolver(this));
+*/
+            } catch (ConfigurationException e) {
+                wa = null;
+            }
+            setWebAuthenticator(wa);
+        }
 
 
+
         RepositoryFactory repoFactory = yanel.getRepositoryFactory("DefaultRepositoryFactory");
         RepositoryFactory rtiRepoFactory = yanel.getRepositoryFactory("RTIRepositoryFactory");
         RepositoryFactory extraRepoFactory = yanel.getRepositoryFactory("ExtraRepositoryFactory");
@@ -356,15 +373,14 @@
      *
      */
     public WebAuthenticator getWebAuthenticator() {
-/*
-TODO:
-- Refactor Realm init() in order to load WebAuthenticator impl
- <realm>
-   <web-authenticator class=""><!-- custom config --></web-authenticator>
- </realm>
-*/
         return privateWebAuthenticator;
     }
+    /**
+     *
+     */
+    public void setWebAuthenticator(WebAuthenticator wa) {
+        privateWebAuthenticator = wa;
+    }
 
     public IdentityManager getIdentityManager() {
         return privateIdentityManager;



More information about the Yanel-commits mailing list