Scarab commit: svn commit: r10167 - branches/release/b21: . src/conf/classes src/conf/conf src/java/org/tigris/scarab/actions src/java/org/tigris/scarab/pipeline src/java/org/tigris/scarab/tools/localization src/java/org/tigris/scarab/util www/repository/org.samba.jcifs www/repository/org.samba.jcifs/jars xdocs xdocs/howto

[email protected]
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: jorgeuriarte
Date: 2006-06-11 13:39:56-0700
New Revision: 10167

Added:
   branches/release/b21/src/java/org/tigris/scarab/pipeline/NTLMLoginValve.java
      - copied unchanged from r10090, /branches/SCB1407/src/java/org/tigris/scarab/pipeline/NTLMLoginValve.java
   branches/release/b21/www/repository/org.samba.jcifs/
      - Copied
   branches/release/b21/www/repository/org.samba.jcifs/jars/
      - Copied
   branches/release/b21/www/repository/org.samba.jcifs/jars/jcifs-1.2.6.jar
      - copied unchanged from r10090, /branches/SCB1407/www/repository/org.samba.jcifs/jars/jcifs-1.2.6.jar
   branches/release/b21/xdocs/howto/windowsdomain-howto.xml
Modified:
   branches/release/b21/project.properties
   branches/release/b21/project.xml
   branches/release/b21/src/conf/classes/ScarabBundle_en.properties
   branches/release/b21/src/conf/classes/ScarabBundle_es.properties
   branches/release/b21/src/conf/conf/scarab-pipeline.xml
   branches/release/b21/src/java/org/tigris/scarab/actions/Login.java
   branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java
   branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java
   branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java
   branches/release/b21/xdocs/changes.xml
   branches/release/b21/xdocs/howto/index.xml
   branches/release/b21/xdocs/scarab_properties.xml

Log:
Merged SCB1409 (Automatic login in Windows) into B21 release branch.

Modified: branches/release/b21/project.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/project.properties?view=diff&rev=10167&p1=branches/release/b21/project.properties&p2=branches/release/b21/project.properties&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/project.properties	(original)
+++ branches/release/b21/project.properties	2006-06-11 13:39:56-0700
@@ -681,6 +681,44 @@
 
 scarab.login.password.expire=30
 
+
+# ==================
+# Group: NTLM domain
+# ==================
+#
+#   scarab.login.ntlm.active
+#   scarab.login.ntlm.domain
+# 
+#  These properties will allow Scarab to try to authenticate users against a
+#  NTLM domain (windows network), using credentials provided by the browser.
+# 
+
+
+# ------------------------
+# scarab.login.ntlm.active
+# ------------------------
+#
+# 
+#  If set to true, the system will try to authenticate users against an NTLM domain.
+#  This property needs scarab.login.ntlm.domain to work.
+#  
+
+scarab.login.ntlm.active=false
+
+# ------------------------
+# scarab.login.ntlm.domain
+# ------------------------
+#
+# 
+#  The name of the NTLM domain to authenticate users.
+#  
+
+scarab.login.ntlm.domain=
+
+# ========================
+# End of Group NTLM domain
+# ========================
+
 # -------------------------
 # scarab.workflow.classname
 # -------------------------

Modified: branches/release/b21/project.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/project.xml?view=diff&rev=10167&p1=branches/release/b21/project.xml&p2=branches/release/b21/project.xml&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/project.xml	(original)
+++ branches/release/b21/project.xml	2006-06-11 13:39:56-0700
@@ -901,6 +901,15 @@
      </properties>      
    </dependency>     
    <dependency>
+     <groupId>org.samba.jcifs</groupId>
+     <artifactId>jcifs</artifactId>
+     <version>1.2.6</version>
+     <type>jar</type>
+     <properties>
+       <war.bundle>true</war.bundle>
+     </properties>      
+   </dependency>     
+   <dependency>
    <!-- Fake dependency, needed for Docbook pdf generation -->
      <groupId>jimi</groupId>
      <artifactId>jimi</artifactId>   

Modified: branches/release/b21/src/conf/classes/ScarabBundle_en.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/conf/classes/ScarabBundle_en.properties?view=diff&rev=10167&p1=branches/release/b21/src/conf/classes/ScarabBundle_en.properties&p2=branches/release/b21/src/conf/classes/ScarabBundle_en.properties&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/conf/classes/ScarabBundle_en.properties	(original)
+++ branches/release/b21/src/conf/classes/ScarabBundle_en.properties	2006-06-11 13:39:56-0700
@@ -1223,6 +1223,7 @@
 UserIsNotConfirmed=User is not confirmed!
 YourPasswordHasExpired=Your password has expired.
 UserIsDeleted=This user has been deleted.
+AutomaticallyLoggedIn = You've been logged in as user "{0}" in the "{1}" domain.
 
 ##Logout
 YouHaveBeenLoggedOut=You have been logged out

Modified: branches/release/b21/src/conf/classes/ScarabBundle_es.properties
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/conf/classes/ScarabBundle_es.properties?view=diff&rev=10167&p1=branches/release/b21/src/conf/classes/ScarabBundle_es.properties&p2=branches/release/b21/src/conf/classes/ScarabBundle_es.properties&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/conf/classes/ScarabBundle_es.properties	(original)
+++ branches/release/b21/src/conf/classes/ScarabBundle_es.properties	2006-06-11 13:39:56-0700
@@ -1196,6 +1196,7 @@
 UserIsNotConfirmed = Usuario no confirmado!
 YourPasswordHasExpired = Tu contraseña ha expirado.
 UserIsDeleted = Este usuario ha sido borrado
+AutomaticallyLoggedIn = Has sido conectado como usuario "{0}" en el dominio "{1}".
 
 ##Logout
 YouHaveBeenLoggedOut = You have been logged out

Modified: branches/release/b21/src/conf/conf/scarab-pipeline.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/conf/conf/scarab-pipeline.xml?view=diff&rev=10167&p1=branches/release/b21/src/conf/conf/scarab-pipeline.xml&p2=branches/release/b21/src/conf/conf/scarab-pipeline.xml&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/conf/conf/scarab-pipeline.xml	(original)
+++ branches/release/b21/src/conf/conf/scarab-pipeline.xml	2006-06-11 13:39:56-0700
@@ -12,6 +12,7 @@
     <org.apache.turbine.pipeline.DetermineActionValve/>
     <org.tigris.scarab.pipeline.DetermineTargetValve/>
     <org.apache.turbine.pipeline.DefaultSessionTimeoutValve/>
+    <org.tigris.scarab.pipeline.NTLMLoginValve/>
     <org.tigris.scarab.pipeline.AnonymousLoginValve/>
     <org.apache.turbine.pipeline.DefaultLoginValve/>
     <org.apache.turbine.pipeline.DefaultSessionValidationValve/>

Modified: branches/release/b21/src/java/org/tigris/scarab/actions/Login.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/actions/Login.java?view=diff&rev=10167&p1=branches/release/b21/src/java/org/tigris/scarab/actions/Login.java&p2=branches/release/b21/src/java/org/tigris/scarab/actions/Login.java&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/actions/Login.java	(original)
+++ branches/release/b21/src/java/org/tigris/scarab/actions/Login.java	2006-06-11 13:39:56-0700
@@ -62,7 +62,6 @@
 
 // Scarab Stuff
 import org.tigris.scarab.tools.ScarabRequestTool;
-import org.tigris.scarab.tools.ScarabLocalizationTool;
 import org.tigris.scarab.tools.localization.L10NKeySet;
 import org.tigris.scarab.tools.localization.L10NMessage;
 import org.tigris.scarab.tools.localization.Localizable;
@@ -144,7 +143,6 @@
     {
         IntakeTool intake = getIntakeTool(context);
         ScarabRequestTool scarabR = getScarabRequestTool(context);
-        ScarabLocalizationTool l10n = getLocalizationTool(context);
 
         Group login = intake.get("Login", IntakeTool.DEFAULT_KEY);
         String username = login.get("Username").toString();
@@ -265,4 +263,5 @@
     {
         doLogin(data, context);
     }
+    
 }

Modified: branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java?view=diff&rev=10167&p1=branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java&p2=branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java	(original)
+++ branches/release/b21/src/java/org/tigris/scarab/pipeline/AnonymousLoginValve.java	2006-06-11 13:39:56-0700
@@ -22,7 +22,6 @@
 public class AnonymousLoginValve extends AbstractValve
 {
     private final static Set nonAnonymousTargets = new HashSet();
-    private String userid                = null;
     private boolean anonymousAccessAllowed = false;
     
     /**
@@ -34,7 +33,6 @@
         anonymousAccessAllowed = AnonymousUserUtil.anonymousAccessAllowed();
         if (anonymousAccessAllowed) {
             Log.get().info("anonymous Login enabled.");
-            userid = AnonymousUserUtil.getAnonymousUserId();
 	        //nonAnonymousTargets.add("Index.vm");
 	        //nonAnonymousTargets.add("Logout.vm");
 	        //nonAnonymousTargets.add(conf.getProperty("template.login"));

Modified: branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java?view=diff&rev=10167&p1=branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java&p2=branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java	(original)
+++ branches/release/b21/src/java/org/tigris/scarab/tools/localization/L10NKeySet.java	2006-06-11 13:39:56-0700
@@ -166,6 +166,7 @@
     public static final LocalizationKey UserChangesSaved                     = new L10NKey("UserChangesSaved");
     public static final LocalizationKey UserDeleted                          = new L10NKey("UserDeleted");
     public static final LocalizationKey YouHaveBeenLoggedOut                 = new L10NKey("YouHaveBeenLoggedOut");
+    public static final LocalizationKey AutomaticallyLoggedIn                = new L10NKey("AutomaticallyLoggedIn");
     public static final LocalizationKey ConditionallyRequiredUserAttribute   = new L10NKey("ConditionallyRequiredUserAttribute");
 
     // Experts notifications:

Modified: branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java?view=diff&rev=10167&p1=branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java	(original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/AnonymousUserUtil.java	2006-06-11 13:39:56-0700
@@ -120,23 +120,45 @@
     {
         try
         {
-            User user = AnonymousUserUtil.getAnonymousUser();
-            data.setUser(user);
-            if( null == user || user.getUserName() == null || user.getUserName().equals(""))
+            User user;
+            user = AnonymousUserUtil.getAnonymousUser();
+            userLogin(data, user);
+        }
+        catch (DataBackendException e)
+        {
+            Log.get().error("anonymousLogin: " + e);
+        }
+        catch (UnknownEntityException e)
+        {
+            Log.get().error("anonymousLogin: " + e);
+        }
+    }
+    
+    /**
+     * Login a given user into the session updating the rundata.
+     * @param data
+     * @param user
+     */
+    public static void userLogin(RunData data, User user)
+    {
+        data.setUser(user);
+        if( null == user || user.getUserName() == null || user.getUserName().equals(""))
+        {
+            user.setHasLoggedIn(Boolean.FALSE);
+        }
+        else
+        {
+            user.setHasLoggedIn(Boolean.TRUE);
+            try
             {
-                user.setHasLoggedIn(Boolean.FALSE);
+                user.updateLastLogin();
             }
-            else
+            catch (Exception e)
             {
-                user.setHasLoggedIn(Boolean.TRUE);
-                user.updateLastLogin();
+                Log.get().error("userLogin: Error updating last login: " + e);
             }
-            data.save();            
-        }
-        catch (Exception e)
-        {
-            Log.get().error("anonymousLogin failed to login anonymously: " + e.getMessage());
         }
+        data.save();            
         
     }
 

Modified: branches/release/b21/xdocs/changes.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/xdocs/changes.xml?view=diff&rev=10167&p1=branches/release/b21/xdocs/changes.xml&p2=branches/release/b21/xdocs/changes.xml&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/xdocs/changes.xml	(original)
+++ branches/release/b21/xdocs/changes.xml	2006-06-11 13:39:56-0700
@@ -7,10 +7,14 @@
 
   <body>
     <release version="b21" date="in-development">
+      <action dev="jorgeuriarte" type="add" fix="SCB1407">
+       Added support for NTLM (Windows) login integration. Take a look at
+       <a href="howto/windowsdomain-howto.html">this howto</a>.
+      </action>
       <action dev="jorgeuriarte" type="add" fix="SCB1565">
       Date and user of issue-creation and last-modification are now availaible in search results' output.
       </action>
-      <action dev="jorgeuriarte" due-to="Ricardo Amillategui" fix="SCB1708">
+      <action dev="jorgeuriarte" type="fix" due-to="Ricardo Amillategui" fix="SCB1708">
        Attribute fields could not be undefined once setted.
       </action>
       <action dev="pledbrook" type="add">

Modified: branches/release/b21/xdocs/howto/index.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/xdocs/howto/index.xml?view=diff&rev=10167&p1=branches/release/b21/xdocs/howto/index.xml&p2=branches/release/b21/xdocs/howto/index.xml&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/xdocs/howto/index.xml	(original)
+++ branches/release/b21/xdocs/howto/index.xml	2006-06-11 13:39:56-0700
@@ -17,8 +17,8 @@
         <li><a href="release-howto.html">Releasing Scarab Howto</a></li>
         <li><a href="firewall-howto.html">Scarab Behind Firewall Howto</a></li>
         <li><a href="tuning-howto.html">Tuning Howto</a></li>  
+        <li><a href="windowsdomain-howto.html">Authenticating in a Windows domain</a></li>        
         <li><a href="customize-howto.html">Customizing Scarab Howto</a></li>        
-        
       </ul>
     </p>
   </section>

Added: branches/release/b21/xdocs/howto/windowsdomain-howto.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/xdocs/howto/windowsdomain-howto.xml?view=auto&rev=10167
==============================================================================
--- (empty file)
+++ branches/release/b21/xdocs/howto/windowsdomain-howto.xml	2006-06-11 13:39:56-0700
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+
+<document>
+
+<properties>
+    <title>How to authenticate Scarab in a Windows Domain</title>
+    <author>Jorge Uriarte</author>
+</properties>
+
+<body>
+
+
+<section name="Enabling NTLM Authentication">
+<p>

+Since B21, Scarab is able to authenticate users against a Windows NT domain. To do it, Scarab relies on a product named jcifs, from the Samba project. 

+<ul>

+<li><a href="http://jcifs.samba.org" target="jcifsweb">http://jcifs.samba.org</a></li>

+</ul>

+</p>

+

+<p>

+You must build Scarab with NTLM support to authenticate againsts NT domains.

+Scarab ships with a mock implementation of jcifs, that will NOT run out of the box. So you must download the real JCIFS implementation from:

+<ul>

+<li><a href="http://jcifs.samba.org">http://jcifs.samba.org</a></li>

+<li><a href="http://www.ibiblio.org/maven/org.samba.jcifs/jars/jcifs-1.2.6.jar">http://www.ibiblio.org/maven/org.samba.jcifs/jars/jcifs-1.2.6.jar</a></li>

+</ul>

+</p>

+<p>
+Once you've got the jar file, you must replace with it the previous version. Be aware that, in case you're using maven, you've possibly already got the mock version in your local MAVEN REPOSITORY (usually at <code>$HOME/.maven/repository/org.samba.jcifs/jars</code>)

+</p>

+<p>

+<STRONG>YOU MUST REPLACE THIS JAR WITH THE REAL ONE YOU JUST DOWNLOADED</STRONG>

+</p>

+<p>

+Once you've got the proper file, you must configure your Scarab to activate the NTLM login.

+

+In the build.properties file, include the following properties:

+<pre>

+    scarab.login.ntlm.active=true

+    scarab.login.ntlm.domain=YOURWINDOWSDOMAIN

+</pre>

+</p>
+</section>

+<section name="How does it works?">

+<p>

+When browsing, Scarab will try to get the credentials and validate them against the NTLM domain.<br/>

+If they are valid. it will try logging in the user into Scarab.<br/>

+<strong>For this to succeed, the NTLM usename must match an Scarab username.</strong>

+</p>

+<p>

+If the user gets logged in, a message will be displayed, such as <strong>"You've been automatically logged in using your user 'YourUser' from domain 'YourDomain'."</strong>

+</p>

+<p>

+If anyone from the NTLM credentials or its equivalent Scarab username are invalid, the valve will

+just 'pass' and the rest of the login system will proceed (Login form / Anonymous)<br/>

+

+When an authenticated user (even Anonymous) click on the 'Logout/Login' link, the session will be

+terminated and the Login.vm screen will be displayed, so any user (NTLM or not) can try logging

+in the system with other credentials.

+</p>

+</section>
+

+<section name="Firefox support">

+<p>

+This behaviour is not directly supported by any browser other than Internet Explorer.

+</p>

+<p>

+Firefox users will be by default prompted with a dialog box asking for username and password. To

+do login with Windows domain credentials, the user will have to fill them up using the DOMAIN\User format.

+</p>

+<code>

+Example: Username: "MyDomain\mywindowsuser", Password: myplainpassword

+</code>

+<p>

+If firefox users want to automatically (no dialog!) get the credentials fed from the underlaying Windows

+operative system, the have to:

+<ul>

+<li>Type "about:config" in the URL box.</li>

+<li>Search for the 'network.automatic-ntlm-auth.trusted-uris' configuration value.</li>

+<li>Add the name of the Scarab host to that value.</li>

+</ul>

+</p>

+</section>
+</body>
+</document>

Modified: branches/release/b21/xdocs/scarab_properties.xml
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/xdocs/scarab_properties.xml?view=diff&rev=10167&p1=branches/release/b21/xdocs/scarab_properties.xml&p2=branches/release/b21/xdocs/scarab_properties.xml&r1=10166&r2=10167
==============================================================================
--- branches/release/b21/xdocs/scarab_properties.xml	(original)
+++ branches/release/b21/xdocs/scarab_properties.xml	2006-06-11 13:39:56-0700
@@ -825,6 +825,42 @@
       <file/>
     </property>
 
+    <group name="NTLM domain">
+    <details>
+        These properties will allow Scarab to try to authenticate users against a
+        NTLM domain (windows network), using credentials provided by the browser.
+        
+		Scarab ships with an empty implementation jar for the JCIFS library. To activate this
+		feature you'll need to download the real implementation and replace the shipped jcifs.jar
+		with it.
+		
+		You can download it from:
+
+		- http://jcifs.samba.org (official site)
+		- http://www.ibiblio.org/maven/org.samba.jcifs/jars/jcifs-1.2.6.jar (tested version)
+        
+    </details>
+    <property>
+      <name>scarab.login.ntlm.active</name>
+      <default>false</default>
+      <details>
+      If set to true, the system will try to authenticate users against an NTLM domain.
+      This property needs scarab.login.ntlm.domain to work.
+      </details>
+      <type>Runtime</type>
+      <file/>
+    </property>    
+    <property>
+      <name>scarab.login.ntlm.domain</name>
+      <default></default>
+      <details>
+      The name of the NTLM domain to authenticate users, if scarab.login.ntlm.active is TRUE.
+      </details>
+      <type>Runtime</type>
+      <file/>
+    </property>    
+	</group>
+	
     <property>
       <name>scarab.workflow.classname</name>
       <default>org.tigris.scarab.workflow.CheapWorkflow</default>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.