Posts

Showing posts with the label AngularJs

Fixing empty files with grunt-typescript

Image
I recently faced the problem of an empty app.js file while working with gulp and the typescript compiler, which was wrapped using the grunt-typescript module.



Synopsis: Almost every third or fourth call, the concatenated app.js was empty at the time where other gulp-tasks where running. The dependencies where all fine, and the gulp-output showed that the typescript-Task has successfully completed before the dependent task was started. However, the file was empty a the moment the dependent task tried to do anything with it.


As you can see, the build:ts and even the build-task has completed without errors.

Solution: After hours of work (debugging grunt-plugins is a pain), I found a solution which helped to actually wait for the particular file to exist or has its contents written to it.

Its a simple task, which I have added to the chain of tasks immediately before the task which actually needs the missing file to exist
var fs = require("fs") // Load the filesystem …

JWT Token-Based Auth with AngularJs

Image
Recently I developed a large customer portal where users should be able to login via different authentication providers. The backend is purely written in C# where as the frontent is basically a AngularJS Application.
Authentication Flow

As our entry point is an AngularJS application, we decided to use the Hybrid-Authentication Flow as defined in this RFC and explained in this article (http://www.heise.de/developer/artikel/Flexible-und-sichere-Internetdienste-mit-OAuth-2-0-2068404.html?artikelseite=2)

Backend-Implementation From the backend perspective, the whole authentication process is delegated to the Identity Server from ThinkTecture, a C# Component which provides an OpenId-Connect (also known as OIDC) compilant authentication-server.


Check it out at https://identityserver.github.io/Documentation/docsv2/, the version 2.0 was just released a few days ago.
As per this delegation, a trusted relationship needs to be established between the backend-system (a .NET Application in our cas…