[daisy] Custom AuthenticationScheme

Bruno Dumon bruno at outerthought.org
Thu Jun 7 15:05:11 CDT 2007


On Thu, 2007-06-07 at 15:34 -0400, Kevin wrote:
> Hi,
> 
> I've read the daisy docs about custom authentication schemes, but I'm
> having difficulty deploying my code. I've followed the LDAP code, but
> it doesn't appear work.

The NTLM one (in services/ntlm-auth) might be a better example as it is
packaged standalone, while the ldap one is included in the repository
codebase itself (not sure why).

>  Here is what I've done:
> 
> I added a class SimpleBluepagesAuthenticationFactory which extends
> AbstractAuthenticationFactory and implements Configurable.
> 
> I added a class SimpleBluepagesAuthenticationScheme which implements
> AuthenticationScheme.
> 
> I built a JAR with those classes as well as a BLOCK-INF directory and
> the following block.xml file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <container name="bluepages">
> 
>   <component name="bluepagesLdap"
> class="com.ibm.daisy.authentication.impl.BluepagesAuthenticationFactory">
>     <configuration>
>     </configuration>
>   </component>
> 
>   <component name="bluepagesSimple"
> class="com.ibm.daisy.authentication.impl.SimpleBluepagesAuthenticationFactory">
>     <configuration>
>     </configuration>
>   </component>
> 
>   <classloader>
>     <classpath>
>       <repository>
>         <resource id="ibm:ibm_bluepages_authentication" version="1.0"/>
>       </repository>
>     </classpath>
>   </classloader>
> </container>
> 
> I exported this JAR to \repository\server\DAISY_MERLIN_REPO\daisy\jars\
> 
> I added the following into myconfig.xml:
> 
>   <target path="/daisy/repository/authentication/bluepagesSimple">
>     <configuration>
>       <scheme name="bluepagesSimple" description="Simple Bluepages
> authentication">
>         <cache enabled="true" maxCacheSize="3000" maxCacheDuration="1800000"/>
>         <autoCreateUser>
>           <roles>
>             <role>User</role>
>           </roles>
>           <defaultRole>User</defaultRole>
>           <updateableByUser>true</updateableByUser>
>         </autoCreateUser>
>       </scheme>
>     </configuration>
>   </target>
> 
> Then I updated this element in myconfig.xml:
> 
>   <target path="/daisy/repository/authentication/authenticator">
>     <configuration>
>       <!-- Indicates which authentication scheme to use, if any, to
> automatically create new users. -->
>       <authenticationSchemeForUserCreation>bluepagesSimple</authenticationSchemeForUserCreation>
>     </configuration>
>   </target>
> 
> I added a System.out.println in all of the methods of my
> SimpleBluepagesAuthenticationFactory, but I do not see the output
> anywhere.
> 
> The first question is: where would a System.out.println go? Would it
> go to the console that start-repository was started under or would it
> go to the logs directory under \repository\server\logs, or somewhere
> else? I will need to know this for debugging in the future once I get
> this installation to work.

standard out

> 
> Second question is: did I do everything required or did I miss a step?

I hope someone else can help you out, but here are some quick hints.

You need to add your new component to the
repository/servers/src/conf/block.xml

next to where the current ldap and ntlm includes are. This block.xml is
the main (or root) block.xml, which either needs to list components
explicitely or have include-instructions to include other
jars-with-block.xml.

The include instruction should be something like ibm:jarname, in which
"ibm" corresponds to the subdirectory in your repo:

\repository\server\DAISY_MERLIN_REPO\ibm\jars

Also about this line:

<resource id="ibm:ibm_bluepages_authentication" version="1.0"/>

I don't know what the ibm_bluepages_authentication.jar is, but just to
be sure: it should not be the jar that you are creating, since you don't
need to add that one to the classpath.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org                          bruno at apache.org



More information about the daisy mailing list