how to get the resultset from users-by-username-query in Spring -


I use Spring Long system using the following 2 questions:

1)

  user-by-user name-query = "e-mail, select password, utente_autenticazione from where email =?"  

2)

  official-to-user name-query = "u1.email, utente_autenticazione u1 to u2.ruolo, utente_autorizzazione u2 where u1.id_utente Selection = U2.id_utente and u1.email =?  

Is there a way to handle those resulsets within a class? I am able to know the email, password etc. after a user's log

You can create a custom filter for:

< Strong> 1) spring-security.xml

  & lt; authentication-manager r F = "authenticationManager" & gt; & lt; Authentication Provider User's service-ref = "customUserDetailsService" & gt; & lt; password has encoder hash = "bcrypt" /> & gt; & authentication provider & gt; ; & Lt; / Authentication-manager & gt; & lt; bean: beam id = "loginUrlAuthenticationEntryPoint" class = "org.springframework.security.web.authentication Login URLAthationEntepoint "& gt; SEM: Property Name =" LoginForm URL "VA LUE =" / LOGIN "/>  gt; SEAM: Been ID =" Successful Endor "class = "Com.demo.service.impl.LoginSuccessHandler" & gt; Beans: Property Name = "defaultSuccessUrl" value = "user" /> & lt; / bean: beans & gt; bean: Bean id = "faileddollar" class = "com.demo.service.impl.loginFailureHandler" & gt; beans: property name = "defaultfileer URL" value = "failure" />    Logout invalid- Session = "true" logout-success-url = "/ logout / success" logout-url = "/ logout" /> & gt; logout logout-success-url = "/ login? Error "/>  
  • Same: Bean id =" authentication filter "class =" org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter "> : property name = "Authentication Manager" Riff = "Authentication Manager" /> Sub: Properties Name = "Filter Process Above" Value = "/ j_spring_security_check" /> & lt; Beans: Property Name = "Authentication Success Book" Riff = "Successful Threader" /> & lt; / bean: Sam & gt;
  • After doing this, you can use a username, password, from LoginSuccessHandler.

    2) LoginSuccessHandler

      Public class loginInsoftHandler Authentication successfully applied {Personal strings default SUUccessUrl; @Override; Public Zero onAuthenticationSuccess (HttpServletRequest request, HttpServletResponse response, authentication authentication) throws IOException, ServletException {string user name = auth.getName (); Println ("username & gt; & gt;" + username); Response.sendRedirect (defaultSuccessUrl); }}  

    In the same way you can also call LoginFailureHandler to do some work like user block on the number of invalids trials for admission.

    Hope this helps.


    Comments