[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
For anyone interested I solved it. I needed to add Principal user = request.getUserPrincipal(); |String username = user.getName(); | | | | in the doGet method http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825783#3825783";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825783>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
OK this is wierd. When I change my login to FORM authentication instead of BASIC The page doesn't display the username with the code below but if I don't cloas ethe browser and I go back and access my servlet again it shows my username. | | import javax.servlet.http.HttpServlet; | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletResponse; | // Support classes | import java.io.IOException; | import java.io.PrintWriter; | import java.security.Principal; | | public class MessageServlet extends HttpServlet { | | ... | | // Handle the GET HTTP Method | public void doGet(HttpServletRequest request, | HttpServletResponse response) | throws IOException { | String username = ""; | | String message; | message = processRequest(request); | generateResponse(message, username, response); | } | | // Handle the POST HTTP Method | public void doPost(HttpServletRequest request, | HttpServletResponse response) | throws IOException { | // String username = request.getParameter("j_username"); | |Principal user = request.getUserPrincipal(); |String username = user.getName(); | |String message; |message = processRequest(request); |generateResponse(message, username, response); | } | | // Process the request | private String processRequest(HttpServletRequest request) { | | ... | | int msg_index = (int) (Math.random() * list.length); | | return list[msg_index]; | } | | // Generate the HTML response | private void generateResponse(String message, String username, | HttpServletResponse response) | throws IOException { | | response.setContentType("text/html"); | PrintWriter out = response.getWriter(); | | out.println(""); | out.println(""); | out.println("Message Servlet"); | out.println(""); | out.println(""); | out.println("Hi " + username); | out.println("Your message is: "); | out.println("" + message + ""); | out.println(""); | out.println(""); | | out.close(); | } | } http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825714#3825714";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825714>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
Access to the getUserPrincipal does not depend on the auth method used. It works for basic and form auth. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825553#3825553";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825553>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
starksm, That works for BASIC but not for FORM authentication. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825389#3825389";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825389>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
It is not working :-( here are the sniplets from my code public void doPost(HttpServletRequest request, | HttpServletResponse response) | throws IOException { | // String username = request.getParameter("j_username"); | |Principal user = request.getUserPrincipal(); |String username = user.getName(); | |String message; |message = processRequest(request); |generateResponse(message, username, response); | } private void generateResponse(String message, String username, | HttpServletResponse response) | throws IOException { | | response.setContentType("text/html"); | PrintWriter out = response.getWriter(); | | out.println(""); | out.println(""); | out.println("Message Servlet"); | out.println(""); | out.println(""); | out.println("Hi" + username); | out.println("The message is: "); | out.println("" + message + ""); | out.println(""); | out.println(""); | | out.close(); | } http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825387#3825387";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825387>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
| import java.security.Principal; | | public class SnoopServlet extends HttpServlet | { |protected void doGet(HttpServletRequest request, HttpServletResponse response) | throws ServletException, IOException |{ | // getUserPrincipal returns non-null only when the servlet is secured | Principal user = request.getUserPrincipal(); | String username = user.getName(); |} | } | http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825385#3825385";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825385>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
Sorry fo rthe double posting I wanted to explain what I am trying to accomplish. I need to get the username in my servlet after the user logs in. I am using Basic authentication but I am not sure how to get the username I thought with a form I could pass it as a parameter to the servlet. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825379#3825379";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825379>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
Juha, I did that but I get a 404 error and my username and password are being passed in the url here is what I am getting. http://localhost:8080/WebMessage/j_security_check%20METHOD=?j_username=x&j_password=&Login=Submit http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825378#3825378";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825378>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
I've done my form as yours, but the users are not authenticated, even my loginError.jsp is called. Should I import some package from login.jsp or loginError.jsp? See my configurations: web.xml: Secure Pages /cadastro/web/ConsultaAluno.jsp GET POST professor NONE Grupo dos professores professor FORM testeSec /login.jsp /loginError.jsp login-config.xml: java:/AcademicoDB select passwd from users where username=? select userRoles, roleGroup from userroles where username=? http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825371#3825371";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825371>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
The action is "j_security_check" that is recognized by your servlet container as an authentication form. http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825356#3825356";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825356>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
I actually did this but it still didn't work. I am using the browseldapmodule to authenticate with Active Directory. I have an index.html page that points to a servlet with the url mapping of /message when you try to access /message the login form comes up. What do I set the action of the login form to be? http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825353#3825353";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825353>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Making a login form
| | | User: | Password: | | | | http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3825332#3825332";>View the original post http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3825332>Reply to the post --- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click ___ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user