Interface CurrentUserSubstitution

All Known Implementing Classes:
CurrentUserSubstitutionImpl

public interface CurrentUserSubstitution
Interface is used to get the information about current user substitution
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.userdetails.UserDetails
    Method returns currently authenticated user (the user who actually logged in).
    org.springframework.security.core.userdetails.UserDetails
    Method returns the substituted user if the substitution happened or authenticated (logged in) user otherwise
    org.springframework.security.core.userdetails.UserDetails
    Method returns the substituted user or null if user substitution didn't happen.
  • Method Details

    • getAuthenticatedUser

      org.springframework.security.core.userdetails.UserDetails getAuthenticatedUser()
      Method returns currently authenticated user (the user who actually logged in). The fact of user substitution is not taken into account.
      Returns:
      currently authenticated user
      Throws:
      RuntimeException - if Authentication is not set to SecurityContext or user information cannot be extracted from current authentication
    • getSubstitutedUser

      @Nullable org.springframework.security.core.userdetails.UserDetails getSubstitutedUser()
      Method returns the substituted user or null if user substitution didn't happen.
      Returns:
      substituted user or null if user substitution didn't happen
    • getEffectiveUser

      org.springframework.security.core.userdetails.UserDetails getEffectiveUser()
      Method returns the substituted user if the substitution happened or authenticated (logged in) user otherwise
      Returns:
      substituted user if the substitution happened or authenticated (logged in) user otherwise