Hi,

 I am trying to login using my own class in magnolia.


I am trying this using following code.


import javax.naming.*;
import javax.naming.directory.*;
import javax.naming.ldap.*;
import info.magnolia.context.*;
import info.magnolia.cms.security.*;
import info.magnolia.jaas.sp.jcr.*;
import info.magnolia.jaas.sp.*;
import java.util.*;
import javax.security.auth.callback.*;
import javax.security.auth.Subject.*;
import javax.security.auth.*;
import com.sun.security.auth.callback.TextCallbackHandler;


Public class Test {


        public static void main(String args[]) {
        
                try {
                        CallbackHandler cbh = new TextCallbackHandler();
                        JCRAuthorizationModule jc = new
JCRAuthorizationModule ();
                        jc.initialize(new Subject(),cbh,new
Hashtable(),new Hashtable());
                        if(jc.login()) {

                          Sytem.out.println("Authentication Succeded");
                        }

                }catch(Exception e){e.printStackTrace();}
}


It asks me for the username and password in command prompt. But when I
enter a valid username and password (Even I have tried superuser). It
gives an exception which is:


WARN   info.magnolia.cms.beans.config.ContentRepository
ContentRepository.java(g
etRepositoryMapping:564) 02.03.2007 11:07:22  no mapping for the
repository [use
rs]
java.lang.NullPointerException
        at
info.magnolia.jaas.sp.jcr.JCRAuthorizationModule.isValidUser(JCRAutho
rizationModule.java:63)
        at
info.magnolia.jaas.sp.jcr.JCRAuthenticationModule.login(JCRAuthentica
tionModule.java:74)
        at Test.main(Test.java:53)



If anyone can help me out in this authentication method. I am really
stuck at the moment. It would be great if anyone can send me response
ASAP.


Thanks in advance.

Saqib.

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to