Can you be a little bit more specific as to what is not working?  I just
spend 2 days trying to get EJBUserManager to work, and I am happy to report
that I was successful.  I assume your functions are getting called, so you
have properly registered your user manager is the orion-application.xml.
What specifically is not working?

-AP_

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jesse Schoch
Sent: Friday, January 11, 2002 11:21 AM
To: Orion-Interest
Subject: can't figure out this one. need help: logging, reloading custom
usermanager class


ok so i tried to write a custom usermanager but it will not work and will
not give me any clue as to why.  I have followed the directions on the
support site, and have turned on -verbosity 10, i think i may have had it
wrong the first time i compiled it but i don't know how to find out what
version of my class i am using.

Is there a way to see the date of the class file that's loaded?  how do you
insure that it is reloaded?  i've done touch application.xml web.xml and
every other xml that i can think of.

here is my code. it compiles fine, and this is from my active login system
so i'm pretty sure the code works.  how do i get the damn logging to work?
System.out.println() does not show up on my logs or STDOUT from running
orion.jar

package jesse;

import java.util.*;
import com.orionsupport.security.SimpleUserManager;
import java.sql.*;
import java.io.*;
import javax.sql.*;
import javax.naming.*;
//
// fuck some shit up with da user manager.
//

public class uM extends SimpleUserManager
        {
        private Map users  = new HashMap();
        protected boolean userExists( String username )
                {
                boolean result = false;
                try
                        {
                        Context ctx = new InitialContext();
                        DataSource ds = (DataSource) ctx.lookup("jdbc/mysql");
                        Connection con = ds.getConnection();
                        Statement st = con.createStatement();
                        Statement st2 = con.createStatement();
                        String q = "select count(*) from stamps.users where
username='"+username+"'";
                        ResultSet rs = st.executeQuery(q);
                        int test = rs.getInt(1);
                        if (test == 1)
                                {
                                result = true;
                                }
                        if (result){}
                        else {System.out.println("user: " +username+" does not 
exist\n");}
                        con.close();
                        }
                catch (SQLException e)
                        {System.out.println("SQL error: "+e);}
                catch (NamingException er)
                        {System.out.println("jndi naming error"+ er);}
                return result;

                }

  protected boolean checkPassword( String username, String password )
        {
        boolean result = false;
    try
                {
                Context ctx = new InitialContext();
                DataSource ds = (DataSource) ctx.lookup("jdbc/mysql");
                Connection con = ds.getConnection();
                Statement st = con.createStatement();
                Statement st2 = con.createStatement();
                if (userExists(username))
                        {
                        String q = "select password user_id from stamps.users where
username='"+username+"'";
                        ResultSet rs = st.executeQuery(q);
                        while (rs.next())
                        {
                        String u = rs.getString(2);
                                String p = rs.getString(1);
                            String q2 = "select password('"+password+"')";
                            ResultSet rs2 = st2.executeQuery(q2);
                            rs2.next();
                            String enpass = rs2.getString(1);
                            if (p.equals(enpass))
                                {
                                result = true;
                                users.put(username,u);
                                }
                                }
                        }
                if (result){}
                else {System.out.println("user: " +username+" failed pass check\n");}
                con.close();
                }
        catch (SQLException e)
                {System.out.println("SQL error: "+e);}
        catch (NamingException er)
                {System.out.println("jndi naming error"+ er);}
        return result;
        }
  protected boolean inGroup( String username, String groupname )
        {
        return true;
        }
  protected String getUID(String username)
        {
        String result = (String)users.get(username);
        return result;
        }
}


Reply via email to