Witam mam mały problem: loguję się do aplikacji wszystko działa poprawnie i chciałbym pobrać login tego mojego user'a żeby wyświetlić na konsolę lecz nie bardzo mi to wychodzi :/
widok logowania:
<form name='f'
action='${pageContext.request.contextPath}/j_spring_security_check'
method='post'>
<table>
<tr>
<td>Login:</td>
<td><input type='text' name='j_username' value=''></td>
</tr>
<tr>
<td>Hasło:</td>
<td><input type='password' name='j_password' /></td>
</tr>
<tr>
<td></td>
<td colspan='2'><input name="submit" type="submit"
value="Zaloguj" /></td>
</tr>
</table>
</form>
Kontroler:
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String showLogin(){
return "login";
}
@RequestMapping(value = "/j_spring_security_check", method = RequestMethod.POST)
public void showLoginn(){
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
System.out.println("Username: " + name);
}
Różne kombinację robiłem w tym żądaniu POST jednak na marne :/