Results 1 to 3 of 3

Thread: Authenticate with CAS & Mysql DB

  1. #1
    Join Date
    Jun 2009
    Location
    Poughkeepsie, NY
    Posts
    18
    Rep Power
    6

    Default Authenticate with CAS & Mysql DB

    Hi everyone

    I have had a Zimbra server working great and authenticating via CAS. We are looking at testing a new server that authenticates by CAS but checks the CAS_FILTER_USER against a MySql database on another server where it retrieves the appropriate account name. The idea is, we want multiple users to access an account with their own CAS credentials.

    I have added the following to the previously working preauth.jsp:

    Code:
    //Get CAS User from server and split username to only CWID
    String casUser = (String) session.getAttribute(edu.yale.its.tp.cas.client.filter.CASFilter.CAS_FILTER_USER);
    String[]cwid = casUser.split("@");
    out.println(cwid[0]);
    
    
    //START MYSQL CONNECTION AND QUERY
    String DRIVER = "com.mysql.jdbc.Driver";
    Class.forName(DRIVER).newInstance();
    
    Connection con=null;
    ResultSet rst=null;
    Statement stmt=null;
    
    String url="jdbc:mysql://test.other.server:3306/test?user=mickey&password=mouse";
    
    con=DriverManager.getConnection(url);
    stmt=con.createStatement();
    rst=stmt.executeQuery("select cwid from members WHERE cwid='cwid[0]'");
    
    while(rst.next()) {
    
    String cwid2 = rst.getString(0);
    
    }//end of while
    
    rst.close();
    stmt.close();
    con.close();
    
    String redirect = generateRedirect(request,cwid2+"@test.zimbra.server");
    out.println(redirect);
    response.sendRedirect(redirect);
    The following appears in the /opt/zimbra/log/mailbox.log:

    Code:
    2009-10-13 14:47:24,936 WARN  [btpool0-9] [] log - /zimbra/preauth.jsp
    org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP
    
    PWC6197: An error occurred at line: 90 in the jsp file: /preauth.jsp
    PWC6199: Generated servlet error:
    cwid2 cannot be resolved
    Any help in the right direction would be greatly appreciated.

    ~Tim

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,017
    Rep Power
    24

    Default

    Code:
    generateRedirect(request,cwid2+"@test.zimbra.server");
    not a java person but will it not see cwid2+ as a var and not cwid ?

  3. #3
    Join Date
    Jun 2009
    Location
    Poughkeepsie, NY
    Posts
    18
    Rep Power
    6

    Default

    The working preauth.jsp on the other server uses the following generateRedirect parameters so I don't believe it is the variable type:

    Code:
    generateRedirect(request,cwid[0]+"@test.zimbra.server");

Similar Threads

  1. Zimbra fails after working for 2 weeks
    By Linsys in forum Administrators
    Replies: 10
    Last Post: 10-07-2008, 12:42 AM
  2. [SOLVED] Install Problem in Ubuntu 6.06 Server
    By xtimox in forum Installation
    Replies: 16
    Last Post: 03-27-2008, 09:36 AM
  3. DNS Questions and Trouble Installing
    By smurraysb in forum Installation
    Replies: 22
    Last Post: 03-14-2008, 03:27 PM
  4. Replies: 18
    Last Post: 03-20-2006, 01:22 PM
  5. Can't start MySQL to init db - Gentoo
    By fak3r in forum Installation
    Replies: 3
    Last Post: 10-10-2005, 06:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •