You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Renato Romano <r....@set-network.com> on 2002/02/14 16:00:19 UTC

Tomcat Auth

Is it possible to use different Authentication Realms for different
applications running on Tomcat4.0 ? Or at least use different DataBase,
tables etc... ?And if yes how ?
Thanks everyone.

Renato


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Again Tomcat Auth

Posted by Renato Romano <r....@set-network.com>.
>Is it possible to use different Authentication Realms for different
>applications running on Tomcat4.0 ? Or at least use different DataBase,
>tables etc... ?And if yes how ?
>Thanks everyone.

Maybe it is possible in older versions of Tomcat ?

Renato


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


changing a user's password on linux using jsp exec.

Posted by Al-Qalb el-Mounir <fa...@yahoo.com>.
Is it possible? I wrote this jsp file, but nothing
seems to happen. Any ideas?

================== Code ===========
<%@ page import="java.io.DataInputStream"%>
<%@ page import="java.io.DataOutputStream"%>

<%@ page import="java.io.BufferedWriter"%>
<%@ page import="java.io.FileWriter"%>
<%@ page import="java.io.IOException"%>



<%

String username = "TestUserId";

String old_p_word = "oldPassword";

String new_p_word = "newPassword";

   Process proc = null;
  
  	 
    Runtime thisRun = Runtime.getRuntime();
    
    String cmd = "passwd " + username;
    
    proc = thisRun.exec(cmd); 
   

//Returns a Stream connected to the output of the
child process. 
   
 DataInputStream inputstream = new
DataInputStream(proc.getInputStream());
 //Reads output from process
 
 String procOutputline = inputstream.readLine();
   
    if (procOutputline != null)
    {
       out.println("Process output: " +
procOutputline);
    }
    
//Returns a Stream connected to the input of the child
process. 
//we assume user exists and that the process will ask
for the old password first.

DataOutputStream outputstream = new
DataOutputStream(proc.getOutputStream());
outputstream.writeBytes(old_p_word);

 
//read output from process. We assume that the process
will ask for the new password
 procOutputline = inputstream.readLine();
    
     if (procOutputline != null)
     {
        out.println("Process output: " +
procOutputline);
    }

//send value of new password to the process.    
outputstream.writeBytes(new_p_word);


//Process should ask us to confirm the new password
//Returns a Stream connected to the output of the
child process. 

 procOutputline = inputstream.readLine();
    
     if (procOutputline != null)
     {
        out.println("Process output: " +
procOutputline);
    }

//confirm the new password to the process.    
outputstream.writeBytes(new_p_word);


 //Waits for the subprocess to complete. 
 proc.waitFor();

 //Returns the exit value for the subprocess.    
   out.println("Process existed with value: "
+proc.exitValue());
 
 //Returns the an InputStream connected to the error
stream of the child process. 
    DataInputStream errorinputstream = new
DataInputStream(proc.getErrorStream());
     String line = errorinputstream.readLine();
    
     if (line != null)
     {
        throw new Exception("There was a problem
changing password for : " + username + " --" + line);
     }
    
    //out.println("The output string is
"+proc.toString()); 
    proc.destroy(); 
  
  
%>

================= End of code.



__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Tomcat Auth

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 14 Feb 2002, Renato Romano wrote:

> Date: Thu, 14 Feb 2002 16:00:19 +0100
> From: Renato Romano <r....@set-network.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      r.romano@set-network.com
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Tomcat Auth
>
> Is it possible to use different Authentication Realms for different
> applications running on Tomcat4.0 ? Or at least use different DataBase,
> tables etc... ?And if yes how ?
> Thanks everyone.
>

Yes.  All you need to do is create a <Context> element in server.xml for
each element, and put the <Realm> element for that application inside it.
The gory details are in the Server Configuration Reference, which is
available once you start up Tomcat 4 at:

  http://localhost:8080/tomcat-docs/config/

> Renato
>

Craig


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>