Interface AuthenticationUtils

  • All Known Implementing Classes:
    DefaultAuthenticationUtils

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

      • 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
      • 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
      • 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