About 837,000 results
Open links in new tab
  1. java - How to manually set an authenticated user in Spring

    Jan 12, 2011 · In the new-account-form controller I am creating a UsernamePasswordAuthenticationToken and setting it in the SecurityContext manually: SecurityContextHolder.getContext().setAuthentication(authentication); On that same page I later check that the user is logged in with: SecurityContextHolder.getContext().getAuthentication().getAuthorities();

  2. java - Springboot get username from Authentication via Controller ...

    Mar 28, 2018 · In case of spring security, you can get your current logged in user by 1. Object user = Authentication authentication (as you are already doing) 2. Object user = SecurityContextHolder.getContext().getAuthentication() .getPrincipal();

  3. Authentication and Authorization in Spring Boot 3.0 with Spring ...

    Mar 24, 2025 · Step 2: Create a UserController. Go to the src > main > java > controller and create a class UserController and put the below code. In this, we have created a simple REST API in our controller class. Step 3: Create a SecurityConfig Class. Go to the src > main > java > config and create a class SecurityConfig and put the below code.

  4. java - Spring Security login from controller - Stack Overflow

    Jan 25, 2013 · I'm trying to login a user from a controller after the signup. My code in the controller is: ... User user = new User(); BeanUtils.copyProperties(userVO, user); userService.save(user); List<

  5. Guide to the Java Authentication And Authorization Service (JAAS)

    Jan 8, 2024 · Java Authentication And Authorization Service (JAAS) is a Java SE low-level security framework that augments the security model from code-based security to user-based security. We can use JAAS for two purposes: Authentication: Identifying the entity that is currently running the code

  6. Authentication and authorization with Spring-Boot

    Nov 24, 2023 · In this tutorial we'll see how to protect, authenticate and authorize the users of a Spring-Boot application in a native way and following the good practices of the framework. We'll be using the following technologies:

  7. How to Implement User Authentication in Java Web …

    Discover a step-by-step guide on implementing user authentication in Java web applications to enhance security and user management.

  8. Spring Security - Get Current Logged-In User Details - Java Guides

    In this article, we will discuss different ways to retrieve the currently logged-in user details in Spring Security. Let's see how programmatic access currently authenticated user. 1. Using SecurityContextHolder + Authentication.getName ()

  9. Spring Boot Security Role-based Authorization - HowToDoInJava

    In this Spring Security tutorial, we will explore the implementation of role-based authorization in the Spring boot web application. We will also delve into the core concepts of configuring role-based authorization through the code examples specifically tested with Spring Boot 3 …

  10. JAAS Authorization Tutorial - Oracle Help Center

    JAAS authorization augments the existing code-centric access controls with new user-centric access controls. Permissions can be granted based not just on what code is running but also on who is running it. When an application uses JAAS authentication to authenticate the user (or other entity such as a service), a Subject is created as a result.

  11. Some results have been removed
Refresh