Interface AuthenticationUtils

All Known Implementing Classes:
DefaultAuthenticationUtils

public interface AuthenticationUtils
The common utility that contains some useful methods around Authentication.
Author:
Sunny Yu
  • Method Details

    • getAuthentication

      @Nullable default org.springframework.security.core.Authentication getAuthentication()
      Retrieve the current Spring Authentication instance associated with the current flow, if any.
      Returns:
      The current Spring Authentication instance associated with the current flow
    • getAuthenticationAttributes

      Map<String,Object> getAuthenticationAttributes()
      Retrieves the attributes on the current Authentication. This method is expected to return the attributes in a map which is generally achieved by a registered Converter bean.
      Returns:
      the attributes, if any, on the current Authentication
    • userIsAnonymous

      boolean userIsAnonymous()
      Checks if the authenticated user is anonymous.
      Returns:
      true if the authenticated user is anonymous, otherwise false
    • getAuthenticatedFullName

      @Nullable String getAuthenticatedFullName()
      Retrieves the full name of the authenticated user, if any.
      Returns:
      the full name of the authenticated user, if any
    • getAuthenticatedUsername

      @Nullable String getAuthenticatedUsername()
      Retrieves the username of the authenticated user, if any.
      Returns:
      the username of the authenticated user, if any
    • getAuthenticatedCustomerId

      @Nullable String getAuthenticatedCustomerId()
      Retrieves the id of the authenticated customer, if any.
      Returns:
      the id of the authenticated customer, if any
    • getAuthenticatedAccountId

      @Nullable String getAuthenticatedAccountId()
      Retrieves the account id found on the authentication of the current security context.
      Returns:
      the account id found on the authentication of the current security context
    • getAuthenticatedParentAccountIds

      List<String> getAuthenticatedParentAccountIds()
      Retrieves a list of all parent account ids of the getAuthenticatedAccountId().

      The returned list does not include the account id found on the authentication of the current security context.

      Returns:
      list of all parent account ids of the getAuthenticatedAccountId()
    • getAuthenticatedCustomerSegmentIds

      List<String> getAuthenticatedCustomerSegmentIds()
      Retrieves the customer segment ids found on the authentication of the current security context.
      Returns:
      list of customer segment ids found on the authentication of the current security context
    • userIsCSR

      boolean userIsCSR()
      Checks if the authenticated user is CSR.
      Returns:
      true if the authenticated user is CSR, otherwise false
    • userIsCSRActingAsSelf

      default boolean userIsCSRActingAsSelf()
      Checks if the authenticated user is CSR acting as neither an impersonated customer nor an anonymous customer but as themselves. This is used in situations such as when a CSR is managing quote requests on the storefront.
      Returns:
      true if the authenticated user is CSR, otherwise false
    • userIsCSRAnonymous

      boolean userIsCSRAnonymous()
      Checks if the authenticated user is CSR anonymous.
      Returns:
      true if the authenticated user is CSR anonymous, otherwise false
    • getAuthenticatedCsrUserId

      @Nullable String getAuthenticatedCsrUserId()
      Retrieves the id of the CSR user, if any.
      Returns:
      the id of the CSR user, if any
    • getAuthenticatedCsrUsername

      @Nullable String getAuthenticatedCsrUsername()
      Retrieves the username of the CSR user, if any.
      Returns:
      the username of the CSR user, if any
    • userIsInAdminContext

      default boolean userIsInAdminContext()
      Whether or not the current user is in an admin context.
      Returns:
      true if the user is in an admin context