Skip to main content

Posts

Showing posts from April, 2014

Azure Active Directory - What user information can we access?

In this blog post we will try to see what kind of user information we can access using Microsoft.IdentityModel.Clients.ActiveDirectory library. In the last post we saw how we can get access token from a native application. If you are using Active Directory client library to generate an access token for different client application you should be aware about what kind of client data you can access except the one that your application access it. AuthenticationContext authenticationContext = new AuthenticationContext(_loginUrl); AuthenticationResult result = authenticationContext.AcquireToken( "https://outlook.office365.com/", //This is resource id for Exchange Server from Office 365 "clientID", new Uri("http://localhost/")); string myCoolToken = result.AccessToken; From the start you should know that you cannot access user password. Once you get the authentication result object that contains the token itself, you will be able to access some user

Problem solving in a company - Don't wait too long

What is happening when something goes wrong in a big company? First things is a buzz, then people start to talk between them, after that a lot of meetings are organized at different level to see identify the root problem, the causes and discuss a lot of around what they should do. In the end a committee is organized, with a stakeholder, an accountable and other so on. This committee will start all the process from beginning, will try to understand exactly what went wrong and prepare one or more solutions. Of course each solution has a strict plan, with new process and imaginary solutions. Why imaginary solutions? Well, none of them were tested. Unfortunately, people from the committee didn't worked on the 'war' field and don't know the voice of the 'people'. Because of this solutions proposed by them will not be seen with good eyes by people. A lot of time, this solutions don't have any connection with the real problem, are very complicated and are c

[Code refactoring] Releasing resources that you still need

Let’s look over the following code and see if we can find the bug. When the Callback method is called, the _callbackAction field is null all the time (except 2-3 exception). public class FooReader: IDisposable { private ExternalComResource _externalResource; private Action<Foo> _callbackAction; public void Start(Action<Foo> callbackAction) { lock (this) { _callbackAction = callbackAction; _externalResource = new ExternalComResource(); ... _externalResource.Callback += Callback; _externalResource.Start(1); } } public void Stop() { StopAndReleaseResources(); } private void Callback(object source, EventArgs e) { ... StopCapture(); ... if (_callbackAction != null) { _callbackAction.Invoke(someData); } ... } public void Dispose() { StopAndReleaseResources(); } private void StopAndReleaseR

How to access local web site or service from Windows Phone Emulator

In today post we will talk about a simple problem that many developers have when they start to develop an application for Windows Phone. Almost any Windows Phone application needs to communicate with a backend or with a website. In this cases, the backend can be already developed or the develop will write it from scratch. In both cases there are times when you need to host your backend on your local machine and test different cases. In that moment you will observer that you cannot access your local machine and services from the emulator. This is happening because the emulator runs in another network. Also, you cannot access a service using localhost. The localhost in the emulator will be the emulator itself. There is a very simple solution for this problem. 1. Get the IP of your machine (ipconfig) 2. Update applicationhost.config file of IIS or the configuration file that has the binding configuration File path: c:\Users\[userName]\Documents\IISExpress\config\applicationhost.co

Azure Active Directory - How to get access token for Office 365 from a native application (SL,WPF, Store)

In the last post we talked a little about Azure Active Directory (AAD) and we discover what are the main features. Today, we will see how we can get an authentication token from AAD of Office 365 and use it from a native application. When we are talking authentication and tokens around AAD for native application we need to know two important things. The first thing is around Microsoft Azure portal, where you will need to create a native application for AAD and give the specific rights.  For more information related to this topic see the last post . The second thing is related to the code that we need to write to be able to authenticate and get the token. For different platforms like Silverlight, WPF or Store application Microsoft already delivered a NuGet package that can be used to generate and use the token. The name of the NuGet package is “Active Directory Authentication Library”. Once you added this package to your project, you will need to create an instance of Authenticat

[Post-Event] Microsoft Azure Workshop in Sibiu - April 12, 2014

This week we organized ( Codecamp Romania ) a Microsoft Azure event in Sibiu . This event was dedicated to all students from Sibiu that wanted to learn more about cloud and Microsoft Azure. During the 5 hours of the event we had the opportunity to talk and play with the most important services and features of Microsoft Azure. In the first part of the day, students had opportunity to learn what does a real cloud provider means and the most importance features that define Microsoft Azure. In the second part of the day we decided to go in the development area. We started a 2 hours’ workshop around web sites and Microsoft Azure Storage. In that moment all the students realized that working with Azure Storage or Web Sites is very simple. With a mature API, accessing Azure storage is simple like accessing a file from the disk and managing web sites hosted on Windows Azure is simple than managing a server with IIS – great job Azure. Thank you Sibiu, see you next time! Special Thanks to  F

[Event] Microsoft Azure Workshop in Sibiu - April 12, 2014

At the end of this week we will have a special event for all students or developers from Sibiu that are interested to discover the world of Microsoft Azure. In April 12, CodeCamp Romania will hold a 4 hours’ workshop about Microsoft Azure. During this 4 hours we will try to look over the most important services that are support on Azure. This is a presentation dedicated to students and people that didn’t had the opportunity to work with cloud services. Because of this we will explain in details each service. If you want to register to this event please use the following link: https://www.eventbrite.com/e/windows-azure-codecamp-at-sibiu-dedicated-to-students-developers-tickets-11078555257  Special thanks to: Faculty of Science of Sibiu that hosts this event iQuest Group that will offer snacks and soda

Azure Active Directory - How to create an application (part 1)

I’m starting a series of blog post that will be about Azure Active Directory (AAD). This blog posts will cover the following topics: How to create an application for AAD How to get access token for Office 365 from a native application (SL,WPF, Store) How to get access token for Office 365 from a web application or Windows Phone 8 Multi-factor Authentication  In this post we will talk about AAD and application over AAD. When we are working with AAD, we can manage users, groups and credentials similar with the Active Directory system that we have on-premises. Both of them are very similar, only the administration UI is a little different. To be able to access different resources in the name of the user we need to authenticate the user in only one place. In this way, the 3rd parties’ application will not handle the user credentials. This is the most important thing that we should take into account. This can be done using AAD because we have native support for Single Sign-On.

Azure Automation - A new service available on Microsoft Azure

There is a new great service available on Microsoft Azure. Yes, you heard me, another new service! The new service that is available now on cloud is called Azure Automation and it is can be very useful when you need to manage application hosted on Microsoft Azure. Before talking about Azure Automation let’s see what we didn’t had until now. Imagine that we have an application that contains a web sites, 2-3 worker roles, a database and use different services from Azure like Service Bus, Storage and Media Services. At each deploy, we need to ensure that we follow the steps defined in our deployment document. If something’s would go wrong or we forget a step that we are doomed, there are cases when we cannot revert the action that we done. Also, at monitoring level, our team will do the same tasks over and over again, they will get bored – in the end we lose time and money when we don’t automate this kind of actions (also human errors can appear very easily). A solution that we have

AOP and Unity

In one of posts I talked about the base principles of AOP and how we can implement the base concept of AOP using features of .NET 4.5, without using other frameworks . In this post we look at Unity and see how we can use this framework to implement AOP. Recap Before this, let’s see if we can remember what is AOP and how we can use it in .NET 4.5 without any other frameworks. Aspect Oriented Programming (AOP) is a programming paradigm with the main goal of increasing modularity of an application. AOP tries to achieve this goal by allowing separation of cross-cutting concerns, using interception of different commands or requests. A good example for this case is the audit and logging. Normally, if we are using OOP to develop an application that needs logging or audit we will have in one form or another different calls to our logging mechanism in our code. In OOP this can be accepted, because this is the only way to write logs, to do profiling and so on. When we are using AOP, the impl

A meeting cannot be friend with a notebook or a phone

This is a topic that I want to approach in more detail in the near future, but for now I only want to talk about one thing: Notebooks, Tables and Phones in a meeting. When you take part in a meeting means that you are interested about the topic. This means that you already allocated the time for it! During the meeting you are involved in discussion as an active or passive player, but you follow the meeting discussion. In many situations I saw people that are only with their body in the meeting, chatting on notebook or phone with somebody else, responding to emails or working on other tasks. From time to time, this people only put a stupid question during the meeting or say something that was already discussed and clarified. What we should do? This is a good question and you need to have a ‘political’/green approach. First of all you need to share with people the guidelines of a meeting and try to make them to understand that you only add value to a meeting only if you focuse

[Post-Event] Talking about Code Quality and SonarQube in front of students of UBB

Today I had the opportunity to talk in front of students from Babes-Bolyai University (computer science) about code quality and software metrics. I decided to use a part of slides and content from an older presentation related to this topic that can be found on Slideshare (you can find the slides below). I was pleasantly surprised that some started to use SonarQube at work - being at master, a part of them already work for different companies. I hope that we will meet you soon, with another occasion.

[Event] ITCamp 2014 - Early Bird, don't miss this great offer (May 22-23 2014)

If you work in IT industry, then you should booked a ticket for ITCamp that will be held in May 22-23, in Cluj-Napoca. This is the 4th year when this great event is organized and each year the number of participants is greater, the number of session and tracks is higher and higher. Also the quality and level of sessions increased drastically every year. As usually, ITCamp will bring in Cluj-Napoca great speakers from all over the world. If I look on the list of speakers, I hardly wait to take part of session held by Tim Huckaby, Peter Leeson, Alex Ionescu, David Gard, Tobiasz Koprowski and other valuable speakers. This year, agenda look very interesting. We will have 4 tracks in parallel. Yes, you heard well, 4 tracks in parallel. It will be pretty hard to decide on what track you should attend. The good news is that all the session will be recorded and you will be able to watch them offline. Personally, when I look on the agenda I already have problems because I don’t know on wha

[Post-Event] Global Windows Azure Bootcamp in Cluj-Napoca, March 29

Last weekend Cluj-Napoca was on the map of Windows Azure Boot Camp . This was the second year when CodeCamp Romania organized this event in Cluj. There were a lot of participants that were interested to learn how to use cloud technologies – Windows Azure. During the day participants had the opportunity to discover the world of web sites and how easy is to create and manage web sites over Windows Azure. Because every web site or application needs a data storage, the next session was dedicated to storage. It was extremely interesting for each participant to discover how easily you can save a picture to blobs, shared a private link using Shared Access Signature and save all picture meta-data to a Windows Azure Blobs. Also, actions like converting a picture to another format can be made send in a very simple way if we use Windows Azure Queues. Last session was dedicated to CRON jobs. All the available methods that are used to create a CRON jobs were explain in details. At the end, partic