Skip to main content

Posts

Showing posts from January, 2015

OWIN, OAuth - Bearer tokens: Authentication and Authorization for unit tests

It is a fact that nowadays, SPA applications are used in almost all new web project. In general behind a SPA application we have multiple REST endpoints that are used to get data, execute different actions and many more. Token base authentication is worldwide use when we need to secure a REST endpoint and offer a mechanism for authentication and authorization. In general when we create a SPA application using AngularJS we will use token based authentication. This mean that we will have an endpoint called ‘token’ (or other path) where users can send their username and password and receive a token that can be used to access different resources. Once we have the token, we will set the bearer token value of the authorization heather. Beside this we need to be able to write unit tests or integration tests that hit our REST services and validate their functionality. For this purpose we need to have a code that simulates the authentication step and inject in the REST request th...

Cascade delete is not working anymore in EF with SQLite

Two in one. In today post we will talk about two different topics: An example from real life that shows why unit tests are important An odd behavior of SQLite combined with Entity Framework  Why Unit Tests are important This days we had to update an application with the latest and greatest version of Entity Framework and SQLite. After a few hours of working we manage to update SQLite and EF to the new version and we manage to make the application to compile and start. Now was the moment of true, to check if the unit tests are still green. And surprise, some of them are red, even if the application seems to run without any kind of problem. It seems that in the new version of EF or SQLite the behavior or functionality of a specific feature was changed. Odd behavior of SQLite and Entity Framework Before the update: PRAGMA foreign_keys = ON; DELETE FROM CarsHistory WHERE (julianday(datetime('now'))-julianday(CarBuyDate))>360 Executed as a SQL command from Entit...

How to replicate Azure Blobs

In today post we will talk about how we can replicate content in multiple storage accounts of Azure. If you remember the last post that I had , this one is related to it and describes the replication process. First of all Why we need to do something like this? There are cases when we have a system that is distributed on multiple data centers and we want to be able to have the specific content in all locations around the globe. We don’t want a user from China to requests binary content from Europe if the system is deployed in China also. We could use CDNs but CDNs don’t have support for Shared Access Signature (SAS) Beside this, if we have a lot of clients that will requests the same blob content than we will have a problem. A blob can handle maximum 500 requests and the bandwidth that is available per blob is around 60MB. This mean that if we have 100 clients, that wants to download the content with 1MB each than... will have a small problem. When we talk about replication don’t ...

Azure Storage: How to reduce distribution time from 16 days to 8h with only 11 cents

Cloud is sold out like an environment without limits, where you can have as many resource you want. The true is that each service offered by a cloud provider has some limitations – like a normal service. For each service we can mitigate in different way this boundaries. But what is happening when we reach the limits of a service? For a part of this services, there are best practices related on how we can scale over a service limitation. But for others services we need to put our mind at work and find different ways how you can scale above cloud limits. In today post we will talk about Azure Storage and what we should do if we want to scale over Azure Storage limits. Before jumping to the problem, let’s see some limitations of Azure Storage. Context The biggest limitation is not the storage capacity that can reach 500 TB of data per Azure account – the biggest problem is the bandwidth. Based on the next two characteristics, the available outbound bandwidth can vary from 10 ...

Comparison of different Azure messaging systems

In theory sending a message over a wire to another device it is a simple task. But sending a message in a reliable and secure way can be a pretty hard job. In IoT era, where every day the number of devices that are connected to the internet increase drastically we need to find different communication mechanisms. Because we cannot control when a device it is connected to the internet and ready to receive our package we need to find different ways to communicate with it. In this post we will look over different messaging system that are offer by Microsoft Azure. For each messaging system we will try to identify what are strengths and when we should use this messaging system. Once we understand each messaging system we will compare them one by one. In the end of this post we will not be able to find a perfect messaging system that can be used in any situations. For different use cases we may need to use different messaging systems, based on our needs. The messaging solutions that will...

First impression of Visual Studio Online

2015 started in full force. I’m starting a new project with an interesting setup. Because of political reasons we decided to go with Visual Studio Online. The initial setup was pretty okay, we configured with success everything we need, from permissions and rights to folder structure and list of tasks. I was impressed how nice and useful the task board in Visual Studio Online is. Nothings complicate, simple and easy to use. You have the ability to define custom flows, like in the on-premises version of TFS with Scrum and Agile support. This is the second project where I am  involved where Visual Studio Online it used. Document Management The first thing that hit us pretty hard was the integration with a document management system. It seems that there is no full support in this moment to create and integrate a SharePoint web site with Visual Studio Online. I expected to be able to create directly from Visual Studio Online a SharePoint web site for my project or to offer an...