Class AuthUtils


  • public class AuthUtils
    extends Object
    • Constructor Detail

      • AuthUtils

        public AuthUtils()
    • Method Detail

      • encode64

        public static String encode64​(String value)
      • getForBasic

        public static AuthenticationDto getForBasic​(String dtoName,
                                                    String userId,
                                                    String password)
        DTO representing the use of authentication via HTTP Basic (RFC-7617)
        Parameters:
        dtoName - a name used to identify this dto. Mainly needed for debugging
        userId - the id of a user
        password - password for that user
        Returns:
        a DTO
      • getForAuthorizationHeader

        public static AuthenticationDto getForAuthorizationHeader​(String dtoName,
                                                                  String authorizationValue)
        DTO representing the use of authentication via the "Authorization" header
        Parameters:
        dtoName - a name used to identify this dto. Mainly needed for debugging
        authorizationValue - the content of the "Authorization" header
        Returns:
        a DTO
      • getForDefaultSpringFormLogin

        public static AuthenticationDto getForDefaultSpringFormLogin​(String dtoName,
                                                                     String username,
                                                                     String password)
        DTO representing the use of authentication via a X-WWW-FORM-URLENCODED POST submission. Assuming default names and endpoint used in SpringSecurity for default formLogin() configuration. When using this kind of DTO, EM will first do a POST on such endpoint with valid credentials, and then use the resulting cookie for the following HTTP requests.
        Parameters:
        dtoName - a name used to identify this dto. Mainly needed for debugging
        username - the id of a user
        password - password for that user
        Returns:
        a DTO