First authentication request has been sent

Today’s post is a brief summary what has changed in recent days. Especially, at the weekend. As I explained in the previous post, I changed my workflow. Now I’m working in the task-oriented flow, with branching system on the GIT. Not only can you follow it with the Github repository but also with the Trello board.

I would like to remind you that all of the sources are available in my Github repository. Moreover, in the README file, you can find short project description with its main assumptions.

At first, I set up the front-end module to communicate with the proxy application. Secondly, I refactored both application’s parts to respect configuration gathered by the front-end. During the implementation process, I integrated Travis which is responsible for running tests on each pull request creation and at any change on the master branch. More details I’ll cover later. At the end, resetting login form had been implemented.

Sending requests to the proxy

The process of preparing requests for the proxy was connected more with refactoring rather than implementation. I had to rename the Key class to the Character, create the Gesture class which represents a gesture (previously it was only an array with points). For both, the gesture and the character classes, I added field “type” which points to the type of password element. At the end, I created a simple AJAX call which is responsible for sending a password to the proxy application.

The task “[F-2] Gathering data from a login form (method, URL)“ was created for the purpose of being preparation for task F-5. I had to prepare infrastructure to send something more than just a password. Ordinary login form sends not only a password but also login/username/mail. Assuming, that in the future we want to send configuration, the module needed something more. I created the AuthenticationRequest class which consists of login, password and configuration object. Furthermore, configuration consists of an URL and a request method. That information will be useful when the proxy will be able to forward an authentication request to the client’s application endpoint.

The last thing I want to describe is a trap in which I have fallen into once again. In the PasswordController, as a result, I was returning password’s textual representation. After implementing AJAX call, the proxy was returning proper results with 200 statuses but each response was handled in the error handler:

The reason was prosaic, dataType: JSON. As a response a JSON was expected, but the proxy was returning a string. I was forced to create class MessageResponse which encapsulates text and can be converted into JSON. Easy.

Integrating Travis

In the meantime, I integrated Travis tool. The tool is responsible for running tests when a pull request is created or when changes on the master branch are committed. Below you can see the .travis.yml file which represents the configuration:

If you are familiar with the Maven, then there is nothing that can surprise you. Simple installation phase and tests afterward.

Cosmetics

The last thing I have changed was refreshing login form after submission.

There is no magic. At the beginning basic states are reset, then values from a form are deleted.

 

That’s all for today. Those small changes allowed to send first requests to the proxy and verify whether results are correct. Much to my surprise, I was able to provide a working solution without many changes and tons of refactoring. The map update:

You may also like