You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/06/17 09:00:09 UTC

[WIKI-UPDATE] LDAPPortalAuthentification+and+RequestUserInfoFromXSP Tue Jun 17 09:00:09 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=LDAPPortalAuthentification+and+RequestUserInfoFromXSP , version: 7 on Tue Jun 17 06:56:47 2003 by 168.209.98.67

- Sorry for the tabs that are missing, but I don't know how to do the indentation... \\
+ 
- ======================= \\
+ {{{
- ... \\
?     --

+ ... 
- <map:pipeline internal-only="true"> \\
?                                     --

+ <map:pipeline internal-only="true"> 
-   <!-- This is the Cocoon Demo Portal Pipeline --> \\
?                                                    --

+   <!-- This is the Cocoon Demo Portal Pipeline --> 
-   <map:match pattern="sunrise-*"> \\
?                                   --

+   <map:match pattern="sunrise-*"> 
-     <!-- authentication --> \\
?                             --

+     <!-- authentication --> 
-     <map:match pattern="sunrise-authuser">	 \\
?                                             --

+     <map:match pattern="sunrise-authuser">	 
- 	<map:generate src="ldap.xml"/> \\
? 	                               --

+ 	<map:generate src="ldap.xml"/> 
- 	<map:transform type="ldap">   \\
? 	                              --

+ 	<map:transform type="ldap">   
- 	    <map:parameter name="rootdn" value="{request-param:name}"/> \\
? 	                                                                --

+ 	    <map:parameter name="rootdn" value="{request-param:name}"/> 
- 	    <map:parameter name="password"  value="{request-param:password}"/>  \\
? 	                                                                        --

+ 	    <map:parameter name="password"  value="{request-param:password}"/>  
- 	</map:transform>   \\
? 	                   --

+ 	</map:transform>   
- 	<map:transform type="xslt" src="ldap.xsl"/> \\
? 	                                            --

+ 	<map:transform type="xslt" src="ldap.xsl"/> 
- 	<map:transform src="styles/sunrise-user.xsl"> \\
? 	                                              --

+ 	<map:transform src="styles/sunrise-user.xsl"> 
-    		<map:parameter name="use-request-parameters" value="true"/> \\
?                                                                  --

+    		<map:parameter name="use-request-parameters" value="true"/> 
-         </map:transform> \\	                 	             			
+         </map:transform>
- 	<map:serialize type="xml"/> \\						
? 	                           ---------

+ 	<map:serialize type="xml"/>
-     </map:match> \\
?                  --

+     </map:match> 
-  \\
+ 
-     <map:match pattern="sunrise-changeuser"> \\
?                                              --

+     <map:match pattern="sunrise-changeuser"> 
- ... \\
?     --

+ ... 
+ }}}
- ================ \\
+ {{{
- <?xml version="1.0" encoding="ISO-8859-1"?> \\
?                                             --

+ <?xml version="1.0" encoding="ISO-8859-1"?> 
- <authentication xmlns:ldap="http://apache.org/cocoon/LDAP/1.0"> \\
?                                                                 --

+ <authentication xmlns:ldap="http://apache.org/cocoon/LDAP/1.0"> 
-   <ldap:execute-query> \\
?                        --

+   <ldap:execute-query> 
-     <ldap:initializer>com.sun.jndi.ldap.LdapCtxFactory</ldap:initializer> \\
?                                                                           --

+     <ldap:initializer>com.sun.jndi.ldap.LdapCtxFactory</ldap:initializer> 
- <!-- enter your own ldap server --> \\
?                                     --

+ <!-- enter your own ldap server --> 
-     <ldap:serverurl>ldap://CORPROOT.NET</ldap:serverurl>   \\
?                                                            --

+     <ldap:serverurl>ldap://CORPROOT.NET</ldap:serverurl>   
-     <ldap:authentification>simple</ldap:authentification> \\
?                                                           --

+     <ldap:authentification>simple</ldap:authentification> 
-     <ldap:version>3</ldap:version> \\
?                                    --

+     <ldap:version>3</ldap:version> 
-     <ldap:port>389</ldap:port>        \\
?                                       --

+     <ldap:port>389</ldap:port>        
-     <ldap:scope>SUBTREE_SCOPE</ldap:scope> \\
?                                            --

+     <ldap:scope>SUBTREE_SCOPE</ldap:scope> 
- <!-- enter your own searchbase & filter -->     \\
?                                                 --

+ <!-- enter your own searchbase & filter -->     
-     <ldap:searchbase>DC=corproot,DC=net</ldap:searchbase> \\
?                                                           --

+     <ldap:searchbase>DC=corproot,DC=net</ldap:searchbase> 
-     <ldap:filter>(&amp;(objectclass=User)(cn=TFR*))</ldap:filter>  \\
?                                                                    --

+     <ldap:filter>(&amp;(objectclass=User)(cn=TFR*))</ldap:filter>  
-     <ldap:deref-link>TRUE</ldap:deref-link> \\
?                                             --

+     <ldap:deref-link>TRUE</ldap:deref-link> 
-     <ldap:count-limit>0</ldap:count-limit> \\
?                                            --

+     <ldap:count-limit>0</ldap:count-limit> 
-     <ldap:time-limit>0</ldap:time-limit>   \\
?                                            --

+     <ldap:time-limit>0</ldap:time-limit>   
-     <ldap:show-attribute>TRUE</ldap:show-attribute> \\
?                                                     --

+     <ldap:show-attribute>TRUE</ldap:show-attribute> 
-     <ldap:doc-element>users</ldap:doc-element> \\
?                                                --

+     <ldap:doc-element>users</ldap:doc-element> 
-     <ldap:row-element>user</ldap:row-element> \\
?                                               --

+     <ldap:row-element>user</ldap:row-element> 
-     <ldap:error-element>ELEMENT</ldap:error-element> \\
?                                                      --

+     <ldap:error-element>ELEMENT</ldap:error-element> 
- <!-- enter your own attributes --> \\
?                                    --

+ <!-- enter your own attributes --> 
-     <ldap:attribute>cn</ldap:attribute> \\
?                                         --

+     <ldap:attribute>cn</ldap:attribute> 
-     <ldap:attribute>co</ldap:attribute> \\
?                                         --

+     <ldap:attribute>co</ldap:attribute> 
-     <ldap:attribute>sn</ldap:attribute>     \\
?                                             --

+     <ldap:attribute>sn</ldap:attribute>     
-     <ldap:attribute>employeeID</ldap:attribute>     \\
?                                                     --

+     <ldap:attribute>employeeID</ldap:attribute>     
-     <ldap:attribute>title</ldap:attribute>     \\
?                                                --

+     <ldap:attribute>title</ldap:attribute>     
-     <ldap:attribute>company</ldap:attribute>     \\
?                                                  --

+     <ldap:attribute>company</ldap:attribute>     
-     <ldap:attribute>givenname</ldap:attribute>     \\
?                                                    --

+     <ldap:attribute>givenname</ldap:attribute>     
-     <ldap:attribute>mail</ldap:attribute>    \\
?                                              --

+     <ldap:attribute>mail</ldap:attribute>    
-     <ldap:attribute>streetAddress</ldap:attribute>     \\
?                                                        --

+     <ldap:attribute>streetAddress</ldap:attribute>     
-     <ldap:attribute>postalCode</ldap:attribute>     \\
?                                                     --

+     <ldap:attribute>postalCode</ldap:attribute>     
-     <ldap:attribute>st</ldap:attribute>    \\
?                                            --

+     <ldap:attribute>st</ldap:attribute>    
-     <ldap:attribute>mobile</ldap:attribute>    \\
?                                                --

+     <ldap:attribute>mobile</ldap:attribute>    
-   </ldap:execute-query>  \\
?                          --

+   </ldap:execute-query>  
- </authentication> \\
?                   --

+ </authentication> 
-  \\
+ }}}
+ 
- ================ \\
+ {{{
- <?xml version="1.0"?> \\
?                       --

+ <?xml version="1.0"?> 
-  \\
+  
- <xsl:stylesheet version="1.0"  \\
?                                --

+ <xsl:stylesheet version="1.0"  
-                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> \\
?                                                                   --

+                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
-  \\
+  
- <xsl:template match="authentication"> \\
?                                       --

+ <xsl:template match="authentication"> 
-   <authentication> \\
?                    --

+   <authentication> 
- 	<xsl:apply-templates select="users"/> \\
? 	                                      --

+ 	<xsl:apply-templates select="users"/> 
-   </authentication> \\
?                     --

+   </authentication> 
- </xsl:template> \\
?                 --

+ </xsl:template> 
-  \\
+  
- <xsl:template match="users"> \\
?                              --

+ <xsl:template match="users"> 
-     <users> \\
?             --

+     <users> 
- 	<xsl:apply-templates select="user"/> \\
? 	                                     --

+ 	<xsl:apply-templates select="user"/> 
-     </users> \\
?              --

+     </users> 
- </xsl:template> \\
?                 --

+ </xsl:template> 
-  \\
+  
- <xsl:template match="user"> \\
?                             --

+ <xsl:template match="user"> 
- 	<user> \\
? 	       --

+ 	<user> 
- 		<name><xsl:value-of select="cn"/></name> \\
? 		                                         --

+ 		<name><xsl:value-of select="cn"/></name> 
- 		<password>testa</password> \\
? 		                           --

+ 		<password>testa</password> 
- 		<role>admin</role> \\
? 		                   --

+ 		<role>admin</role> 
- 		<title><xsl:value-of select="title"/></title> \\
? 		                                              --

+ 		<title><xsl:value-of select="title"/></title> 
- 		<firstname><xsl:value-of select="givenName"/></firstname> \\
? 		                                                          --

+ 		<firstname><xsl:value-of select="givenName"/></firstname> 
- 		<lastname><xsl:value-of select="sn"/></lastname> \\
? 		                                                 --

+ 		<lastname><xsl:value-of select="sn"/></lastname> 
- 		<company><xsl:value-of select="company"/></company> \\
? 		                                                    --

+ 		<company><xsl:value-of select="company"/></company> 
- 		<street><xsl:value-of select="streetAddress"/></street> \\
? 		                                                        --

+ 		<street><xsl:value-of select="streetAddress"/></street> 
- 		<zipcode><xsl:value-of select="postalCode"/></zipcode> \\
? 		                                                       --

+ 		<zipcode><xsl:value-of select="postalCode"/></zipcode> 
- 		<city><xsl:value-of select="st"/></city> \\
? 		                                         --

+ 		<city><xsl:value-of select="st"/></city> 
- 		<country><xsl:value-of select="co"/></country> \\
? 		                                               --

+ 		<country><xsl:value-of select="co"/></country> 
- 		<phone><xsl:value-of select="mobile"/></phone> \\
? 		                                               --

+ 		<phone><xsl:value-of select="mobile"/></phone> 
- 		<fax></fax> \\ 
? 		            --

+ 		<fax></fax>  
- 		<email><xsl:value-of select="mail"/></email> \\   
? 		                                             --

+ 		<email><xsl:value-of select="mail"/></email>    
- 		<bankid></bankid> \\  
? 		                  --

+ 		<bankid></bankid>   
- 		<bankname></bankname> \\   
? 		                      --

+ 		<bankname></bankname>    
- 		<accountid></accountid>	\\  
? 		                        --

+ 		<accountid></accountid>	  
- 	</user> \\ 
? 	        --

+ 	</user>  
- </xsl:template> \\ 
?                 --

+ </xsl:template>  
-  \\ 
+   
- </xsl:stylesheet> \\ 
?                   --

+ </xsl:stylesheet>  
-  \\ 
+ }}}
+  
+ 
+ {{{
- <map:transform type="log"> \\ 
?                            ---

+ <map:transform type="log"> 
- 	<map:parameter name="logfile" value="UserList.log"/> \\ 
? 	                                                     --

+ 	<map:parameter name="logfile" value="UserList.log"/>  
- 	<map:parameter name="append" value="NO"/> \\ 
? 	                                          ---

+ 	<map:parameter name="append" value="NO"/> 
- </map:transform>	 \\ 
?                   ---

+ </map:transform>	 
-  \\ 
+ }}}
+  
- ================ \\ 
+ {{{
- <xsp:page language="java" \\ 
?                           --

+ <xsp:page language="java"  
-  xmlns:xsp="http:\\apache.org/xsp" \\ 
?                  --                --

+  xmlns:xsp="http:apache.org/xsp"  
-  xmlns:xsp-session="http:\\apache.org/xsp/session/2.0"  \\ 
?                          --                             --

+  xmlns:xsp-session="http:apache.org/xsp/session/2.0"   
-  xmlns:esql="http:\\apache.org/cocoon/SQL/v2"  \\ 
?                   --                           --

+  xmlns:esql="http:apache.org/cocoon/SQL/v2"   
-  xmlns:xsp-request="http:\\apache.org/xsp/request/2.0" \\ 
?                          --                            --

+  xmlns:xsp-request="http:apache.org/xsp/request/2.0"  
- > \\ 
?   --

+ >  
-  \\ 
+   
- <xsp:structure> \\ 
?                 --

+ <xsp:structure>  
- 	<xsp:include>org.apache.cocoon.environment.Session</xsp:include> \\ 
? 	                                                                 --

+ 	<xsp:include>org.apache.cocoon.environment.Session</xsp:include>  
- 	<xsp:include>org.apache.avalon.framework.component.ComponentManager</xsp:include> \\ 
? 	                                                                                  --

+ 	<xsp:include>org.apache.avalon.framework.component.ComponentManager</xsp:include>  
- 	<xsp:include>org.apache.oro.text.regex.*</xsp:include>	 \\ 
? 	                                                        --

+ 	<xsp:include>org.apache.oro.text.regex.*</xsp:include>	  
- 	<xsp:include>java.util.ArrayList</xsp:include>	 \\ 
? 	                                                --

+ 	<xsp:include>java.util.ArrayList</xsp:include>	  
- 	<xsp:include>java.util.Collection</xsp:include>		 \\ 
? 	                                                  --

+ 	<xsp:include>java.util.Collection</xsp:include>		  
- </xsp:structure> \\ 
?                  --

+ </xsp:structure>  
-  \\ 
+   
- <page> \\ 
?        --

+ <page>  
-  \\ 
+   
- <xsp:logic> \\ 
?             --

+ <xsp:logic>  
- 	Object[] myarray = null; \\ 
? 	                         --

+ 	Object[] myarray = null;  
- 	java.util.Collection list = new ArrayList(); \\ 
? 	                                             --

+ 	java.util.Collection list = new ArrayList();  
- 	String typeid = "b"; \\ 
? 	                     --

+ 	String typeid = "b";  
- 	 	int limit, interps; \\ 
? 	                      --

+ 	 	int limit, interps;  
- 	    PatternMatcher matcher = new Perl5Matcher(); \\ 
? 	                                                 --

+ 	    PatternMatcher matcher = new Perl5Matcher();  
- 	    Pattern pattern = null; \\ 
? 	                            --

+ 	    Pattern pattern = null;  
- 	    PatternCompiler compiler = new Perl5Compiler(); \\ 
? 	                                                    --

+ 	    PatternCompiler compiler = new Perl5Compiler();  
- 	    String regularExpression, input, result, firstsplit, secondsplit; \\ 
? 	                                                                      --

+ 	    String regularExpression, input, result, firstsplit, secondsplit;  
- 		 		 \\ 
? 		    --

+ 		 		  
- 	    input             = <xsp:session:get-attribute-names/>; \\ 
? 	                                                            --

+ 	    input             = <xsp:session:get-attribute-names/>;  
- 	 \\ 
? 	 --

+ 	  
- <!-- My input = "uprofileWOCDB-WEBPortal|UserInfo:User_admin_TFRGHM00" --> \\ 
?                                                                            --

+ <!-- My input = "uprofileWOCDB-WEBPortal|UserInfo:User_admin_TFRGHM00" -->  
- <!-- So adapt your regularExpression depending on your desire --> \\ 
?                                                                   --

+ <!-- So adapt your regularExpression depending on your desire -->  
- regularExpression = "see_comment"; <!-- "//|" but the slashes must be backslashes --> \\ 
?                                                                                       --

+ regularExpression = "see_comment"; <!-- "//|" but the slashes must be backslashes -->  
-  \\ 
+   
- 	    try { \\ 
? 	          --

+ 	    try {  
- 	      pattern = compiler.compile(regularExpression); \\ 
? 	                                                     --

+ 	      pattern = compiler.compile(regularExpression);  
- 	    } catch(MalformedPatternException e){ \\ 
? 	                                          --

+ 	    } catch(MalformedPatternException e){  
- 	      System.err.println("Bad pattern."); \\ 
? 	                                          --

+ 	      System.err.println("Bad pattern.");  
- 	      System.err.println(e.getMessage()); \\ 
? 	                                          --

+ 	      System.err.println(e.getMessage());  
- 	      System.exit(1); \\ 
? 	                      --

+ 	      System.exit(1);  
- 	    } \\ 
? 	      --

+ 	    }  
- 		Util.split(list,matcher,pattern,input); \\ 
? 		                                        --

+ 		Util.split(list,matcher,pattern,input);  
-  \\ 
+   
- 		 \\ 
? 		 --

+ 		  
- 	    regularExpression = ":";	 \\ 
? 	                              --

+ 	    regularExpression = ":";	  
- 	    try { \\ 
? 	          --

+ 	    try {  
- 	      pattern = compiler.compile(regularExpression); \\ 
? 	                                                     --

+ 	      pattern = compiler.compile(regularExpression);  
- 	    } catch(MalformedPatternException e){ \\ 
? 	                                          --

+ 	    } catch(MalformedPatternException e){  
- 	      System.err.println("Bad pattern."); \\ 
? 	                                          --

+ 	      System.err.println("Bad pattern.");  
- 	      System.err.println(e.getMessage()); \\ 
? 	                                          --

+ 	      System.err.println(e.getMessage());  
- 	      System.exit(1); \\ 
? 	                      --

+ 	      System.exit(1);  
- 	    } \\ 
? 	      --

+ 	    }  
- 	     \\ 
? 	     --

+ 	      
- 	    myarray = list.toArray(); \\ 
? 	                              --

+ 	    myarray = list.toArray();  
- 	    firstsplit = myarray[1].toString(); \\ 
? 	                                        --

+ 	    firstsplit = myarray[1].toString();  
-  \\ 
+   
- 	    list.clear(); \\ 
? 	                  --

+ 	    list.clear();  
- 		Util.split(list,matcher,pattern,firstsplit); \\ 
? 		                                             --

+ 		Util.split(list,matcher,pattern,firstsplit);  
-  \\ 
+   
- 		myarray = list.toArray(); \\ 
? 		                          --

+ 		myarray = list.toArray();  
- 		firstsplit = myarray[1].toString(); \\ 
? 		                                    --

+ 		firstsplit = myarray[1].toString();  
- 		 \\ 
? 		 --

+ 		  
- 		regularExpression = "_";	 \\ 
? 		                          --

+ 		regularExpression = "_";	  
- 	    try { \\ 
? 	          --

+ 	    try {  
- 	      pattern = compiler.compile(regularExpression); \\ 
? 	                                                     --

+ 	      pattern = compiler.compile(regularExpression);  
- 	    } catch(MalformedPatternException e){ \\ 
? 	                                          --

+ 	    } catch(MalformedPatternException e){  
- 	      System.err.println("Bad pattern."); \\ 
? 	                                          --

+ 	      System.err.println("Bad pattern.");  
- 	      System.err.println(e.getMessage()); \\ 
? 	                                          --

+ 	      System.err.println(e.getMessage());  
- 	      System.exit(1); \\ 
? 	                      --

+ 	      System.exit(1);  
- 	    } \\ 
? 	      --

+ 	    }  
- 	     \\ 
? 	     --

+ 	      
- 	    list.clear(); \\ 
? 	                  --

+ 	    list.clear();  
- 		Util.split(list,matcher,pattern,firstsplit); \\ 
? 		                                             --

+ 		Util.split(list,matcher,pattern,firstsplit);  
- 		 \\ 
? 		 --

+ 		  
- 		myarray = list.toArray(); \\ 
? 		                          --

+ 		myarray = list.toArray();  
- 		 \\ 
? 		 --

+ 		  
- 		firstsplit = myarray[2].toString(); \\ 
? 		                                    --

+ 		firstsplit = myarray[2].toString();  
- 		secondsplit = myarray[3].toString(); \\ 
? 		                                     --

+ 		secondsplit = myarray[3].toString();  
- </xsp:logic> \\ 
?              --

+ </xsp:logic>  
-  \\ 
+   
- <a><xsp:attribute name="href">home</xsp:attribute><loadingimg/></a>  \\ 
?                                                                      --

+ <a><xsp:attribute name="href">home</xsp:attribute><loadingimg/></a>   
- <xsp:logic> \\ 
?             --

+ <xsp:logic>  
- 	String sector = null; \\ 
? 	                      --

+ 	String sector = null;  
- </xsp:logic> \\ 
?              --

+ </xsp:logic>  
- <esql:connection> \\ 
?                   --

+ <esql:connection>  
- 	<esql:pool>wfmgt</esql:pool>	 \\ 
? 	                              --

+ 	<esql:pool>wfmgt</esql:pool>	  
-    		<esql:execute-query> \\ 
?                           --

+    		<esql:execute-query>  
- 		  <esql:query> \\ 
? 		               --

+ 		  <esql:query>  
- 		    SELECT ur_sector \\ 
? 		                     --

+ 		    SELECT ur_sector  
- 		    FROM  Users \\ 
? 		                --

+ 		    FROM  Users  
- 			WHERE ur_name = '<xsp:expr>secondsplit</xsp:expr>' \\ 
? 			                                                   --

+ 			WHERE ur_name = '<xsp:expr>secondsplit</xsp:expr>'  
- 		  </esql:query> \\ 
? 		                --

+ 		  </esql:query>  
- 		  <esql:results> \\ 
? 		                 --

+ 		  <esql:results>  
- 			<esql:row-results> \\ 
? 			                   --

+ 			<esql:row-results>  
- 				<xsp:logic> \\ 
? 				            --

+ 				<xsp:logic>  
- 					sector = <esql:get-string column="ur_sector"/>;  \\ 
? 					                                                 --

+ 					sector = <esql:get-string column="ur_sector"/>;   
- 					session.setAttribute("sector",sector); \\ 
? 					                                       --

+ 					session.setAttribute("sector",sector);  
- 				</xsp:logic> \\ 
? 				             --

+ 				</xsp:logic>  
- 			</esql:row-results> \\ 
? 			                    --

+ 			</esql:row-results>  
- 		  </esql:results>		   \\ 
? 		                      --

+ 		  </esql:results>		    
- 		</esql:execute-query> \\ 
? 		                      --

+ 		</esql:execute-query>  
- </esql:connection> \\ 
?                    --

+ </esql:connection>  
- <xsp:logic> \\ 
?             --

+ <xsp:logic>  
- 	session.setAttribute("user",<xsp:expr>secondsplit</xsp:expr>);  \\ 
? 	                                                                --

+ 	session.setAttribute("user",<xsp:expr>secondsplit</xsp:expr>);   
- 	session.setAttribute("role",<xsp:expr>firstsplit</xsp:expr>); \\ 
? 	                                                              --

+ 	session.setAttribute("role",<xsp:expr>firstsplit</xsp:expr>);  
- </xsp:logic>						 \\ 
?                    --

+ </xsp:logic>						  
- </body> \\ 
?         --

+ </body>  
- </html> \\ 
?         --

+ </html>  
- </xsp:page> \\ 
?             --

+ </xsp:page>  
-  \\ 
-  \\ 
+ }}}
+