Skip to main content

Principal

Learn Principal (Request Handling, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Principal ( java.security.Principal ) represents the authenticated user; its getName() returns the username. Spring MVC injects it as a controller parameter; it is null when no one is logged in and no security is configured. With Spring Security the real object is an Authentication (a Principal) holding authorities and details.

More lessons in Request Handling