Uploaded image for project: 'WildFly Elytron'
  1. WildFly Elytron
  2. ELY-2391

Add a test case to BasicAuthenticationMechanismTest that attempts to use the wrong password for the user

    XMLWordPrintable

Details

    Description

      Add a new test case to BasicAuthenticationMechanismTest for the case where the wrong user password is provided.

      Take a look at an existing test in this class. Notice that the username and password to be used comes from the Basic authorization header (e.g., Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==).

      For example, if we wanted to test using Aladdin as the username and open sesame as the password, the authorization header to use for the test could be formed using CodePointIterator.ofString("Aladdin:open sesame").asUtf8().base64Encode() which returns QWxhZGRpbjpvcGVuIHNlc2FtZQ==.

      Calling testBasic using testBasic("Aladdin", "WallyWorld", "open sesame", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==") sets Aladdin and open sesame as the expected username and password on the server side and it specifies that Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== is the authorization header to use to represent the username and password from the client side.

      This task is to add a new test case that attempts to specify the wrong password on the client side. In this case, when evaluating the request, authentication should fail and we should receive a 404 when calling request.getResponse().

      Attachments

        Activity

          People

            Unassigned Unassigned
            fjuma1@redhat.com Farah Juma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: