Programming is hard and then you die

June 6, 2018, 7:04 a.m.

I seem to be constantly struggling on my path to be a decent programmer. Lately I have been trying to set up authentication for multiple type of users with Spring Security. I feel that I am so close to get it to work which makes it even more frustrating.

This was so easy with Node. All I had to do was make separate endpoints to login, query different tables in database and that was the end of it. But now with the combination of Spring Boot / Spring Security / Hibernate it seems to be a lot harder. All that extra layers of abstraction makes it that much harder. I did manage to get registration to work for both types of users and login for one. I am hoping to solve this problem by the end of this week though. This kinda feels like the same problem as I had with Django which ultimately made me to switch back to Node.

So what the hell am I doing with Spring Boot? That is a valid question. I'm trying to get this to work with that instead of Node because as soon as the projects grows over 1000 lines it just feels like a big mess no matter how I try to organize my code. There is another reason as well and not just my messy architecture. For some reason it just feels better to use Java. I enjoy coding a lot more when I fire up IntelliJ IDEA CE and start typing that verbose Java code.

But my project might use other languages than Java as well if I manage to get everything to work like I want to since I want to do microservices instead of a monolithic application.

I'm actually in the middle of changing my programming environment, too. I have started migrating to Ubuntu 18.04 from my Windows machine but it's not that big of a deal since it's just a virtual machine I'm going to use for development so still going to use my beloved Windows PC. The reason for this change is that suddenly npm stopped working and nothing seems to fix that. I did plan to make the switch anyways in the near future just to keep my main PC clean of all of those programming related dependencys like code editors, databases and languages. Sure I could have (and probably should have) used Docker containers. But I got too much on my plate w/o Docker already. 

 

Update: three days later (read three hours of coding) I managed to solve the puzzle. What I actually needed to do was create two custom authentication providers (actually I do have to create a third one for admin users). I had managed to figure that our earlier but the implementation was the problem. It does feel simple enough now that I have made it but the process was a pain in the ass given my stupidity and lack of experience.