j-security-check

j_security_check redirect

▼魔方 西西 提交于 2019-11-30 05:44:38
问题 I am learning Java servlets on Tomcat environment. I am learning how to use form based login authentication using j_security_check. So, in my servlet, I have a login page that has j_username and j_password. In web.xml file of that servlet, I have the welcome page list indicating my landing page, "landing.html". So, ideally, after successful login, I want the user to get redirected to "landing.html" page. Without the authentication (no form based authentication), My servlet opens up and goes

UTF-8 encoded j_security_check username incorrectly decoded as Latin-1 in Tomcat realm

六月ゝ 毕业季﹏ 提交于 2019-11-29 16:42:32
I'm investigating an issue where a username with Latin-1 character is introduced in a login form. The username contains character á. I investigate the server part where I have: public class MyRealm extends RealmBase implements Realm { public Principal authenticate(String username, String password) { ... actual authentication implemented here } } If I print out the bytes : username.getBytes() I see that character á has: C3 83 C2 A1 Normally character á in UTF8 encoding shoul have : C3 A1. If I encode this in UTF8 again the I get: C3 83 C2 A1 what my software prints out. I checked in the network

Request to j_security_check return 408 error only with right paramters

拟墨画扇 提交于 2019-11-29 12:54:30
I want to send request to j_security_check from servlet and get auth cookie from response. Code: String url = "http://someserver:8080/j_security_check?j_username=user&j_password=qwerty"; HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); If I put wrong auth parameters then on response I get a default wrong-login page, but if I put right auth parameters I got server code 408. What's wrong? To get some resource on the tomcat server with j_security_check auth it is necessary to implement three steps: Send GET request to the needed private resource, in response you

UTF-8 encoded j_security_check username incorrectly decoded as Latin-1 in Tomcat realm

感情迁移 提交于 2019-11-28 11:37:39
问题 I'm investigating an issue where a username with Latin-1 character is introduced in a login form. The username contains character á. I investigate the server part where I have: public class MyRealm extends RealmBase implements Realm { public Principal authenticate(String username, String password) { ... actual authentication implemented here } } If I print out the bytes : username.getBytes() I see that character á has: C3 83 C2 A1 Normally character á in UTF8 encoding shoul have : C3 A1. If I

Request to j_security_check return 408 error only with right paramters

梦想与她 提交于 2019-11-28 06:44:11
问题 I want to send request to j_security_check from servlet and get auth cookie from response. Code: String url = "http://someserver:8080/j_security_check?j_username=user&j_password=qwerty"; HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); If I put wrong auth parameters then on response I get a default wrong-login page, but if I put right auth parameters I got server code 408. What's wrong? 回答1: To get some resource on the tomcat server with j_security_check auth

How to get number of connected users and their role using j_security_check?

眉间皱痕 提交于 2019-11-28 05:08:30
I get the username of the connected user (using j_security_check) this way, through a managed bean: ...... username = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName(); And then display it in a jsf page this way : #{userBean.username} But I figured no way to get the number of connected users and get their role. In other words, I want to display besides the username, the user role and the number of connected users. How can I achieve this!? Thanks in advance for your help! EDIT: I can now get the Role of the connected user, using a namedquery in a managed bean :

How to get number of connected users and their role using j_security_check?

旧街凉风 提交于 2019-11-27 00:48:40
问题 I get the username of the connected user (using j_security_check) this way, through a managed bean: ...... username = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName(); And then display it in a jsf page this way : #{userBean.username} But I figured no way to get the number of connected users and get their role. In other words, I want to display besides the username, the user role and the number of connected users. How can I achieve this!? Thanks in advance

ViewExpiredException not thrown on ajax request if JSF page is protected by j_security_check

天涯浪子 提交于 2019-11-26 09:10:25
问题 I have a JSF page which is not protected by j_security_check . I perform the following steps: Open the JSF page in a browser. Restart the server. Click a command button on the JSF page to initiate an ajax call. Firebug shows that a ViewExpiredException is raised, as expected. Post: javax.faces.ViewState=8887124636062606698:-1513851009188353364 Response: <partial-response> <error> <error-name>class javax.faces.application.ViewExpiredException</error-name> <error-message>viewId:/viewer.xhtml -

Performing user authentication in Java EE / JSF using j_security_check

走远了吗. 提交于 2019-11-25 22:58:27
问题 I\'m wondering what the current approach is regarding user authentication for a web application making use of JSF 2.0 (and if any components do exist) and Java EE 6 core mechanisms (login/check permissions/logouts) with user information hold in a JPA entity. The Oracle Java EE tutorial is a bit sparse on this (only handles servlets). This is without making use of a whole other framework, like Spring-Security (acegi), or Seam, but trying to stick hopefully with the new Java EE 6 platform (web