Spring Security: Get Logged-in User's Details

preview_player
Показать описание
In this video, I will share with you how to retrieve the UserDetails object that represents the currently logged-in user in a Spring Boot application with Spring Security and Thymeleaf, to display the user's details in the view such as username, full name, assigned roles (authorities), any properties of the class that implements the UserDetails interface defined by Spring Security.

You will also learn how a simple way to get the UserDetails object in Spring controller's handler methods, for further processing based on the user's details retrieved.
Рекомендации по теме
Комментарии
Автор

awesome vid, did not found this info anywhere else.

nicolasfelipe
Автор

Hello, you have one of the best tutorials on spring boot on youtube . Most of the time when following your tutorials i come across some interesting stuff like MANAGE USER page which I am asking if you can make a tutorial on that. I want to do something like that but i dont know how. Thank you

solomonotoo
Автор

Good tutorials. If you can implement a full system it would be a help for all students. Thank you!

randunumysterio
Автор

Does your udemy course already updated with the latest spring boot version with the latest spring security?

lenskyaizen
Автор

in my DB I have full Name I want to retrieve that only that logged user How to do I am able to get mail roles but not full name pls tell

world
Автор

I am having a problem getting user details, I did everything you explained but my problem is that when the user makes changes to their profile, like changing their username, changes don't reflect immediately unless the user is re-authenticated(logout) and also because I am using <span when i refresh the page that calls this authentication method it gives me a white error. My guess is because of the authentication. is there a way I can dynamically update the changes made in the database to reflect on the thymleaf template without having to logout and login. Thanks in anticipation

janeodum
Автор

Is there an updated version of this pls

imkawtarr
Автор

Hello, sir. I wrote the getter for lastName in my CustomUserDetail class which implements UserDetails, but when I try to call sec:authentication="principal.lastName", it does not find my custom method. It only find the ones which are overriden. This is my getMethod public String getLastName() {
return this.user.getLastName();
}

dariustinculescu
Автор

hi nam ha minh, i want display current user image from database, how i can do that ??

germand
Автор

Hi,
Thanks for the tutorial,
Can you make a tutorial showing how to update the user details after they logged-in please AND refresh automatically user details on the page Without having to log in and log out please?

aideng
Автор

Hello,

Great tutorial !
Can you make a tutorial showing how to update the user details after they logged-in please ?

aideng
Автор

Pls is it still working for spring security 6?

imkawtarr
Автор

hi sir, it's a great video, but it's hard to follow the project from the beginning, can you add all video about Shopme into a list from the beginning video to the latest, thank you, sir!

mersy
Автор

hello sir, can you make a tutorial about to update the user details after they logged-in?? thank you

Rynex
Автор

A cho em xin link video hướng dẫn project ShopMe này đc ko ạ? hoặc cho e xin source code cũng được. Cám ơn a nhìu lắm!

ktn
Автор

@Code Java Can uplease provide github link of this code please

atharvamishra
Автор

The video is good . But voice is not clear

redfly