Windows Azure AppFabric Access Control Service (ACS) v2 – Programmatically Adding Facebook as an Identity Provider Using Management Service
This simple walkthrough shows how to use Management Service of Windows Azure AppFabric Access Control Service (ACS) v2 to programmatically add Facebook as an identity provider. Complete walkthrough can be found here - Windows Azure AppFabric Access Control Service v2 - Adding Identity Provider Using Management Service.
The code related to Facebook is cannibalized from the end-to-end SaaS sample - FabrikamShipping SaaS Demo Source Code.
Code samples with other functionalities is available here - Code Sample: Management Service.
Other ACS code samples available here - Code Samples Index.
Code related to this post can be found here. Next I will call out changes and differences comparing to Windows Azure AppFabric Access Control Service v2 - Adding Identity Provider Using Management Service.
To complete this walkthrough:
Obtain Facebook application id and application secret. Instructions on how to do so can be found here - How To: Configure Facebook as an Identity Provider. Skip to Step 3 – Obtaining a Facebook Application ID and a Facebook Application Secret.
Identity provider key is based on Facebook’s application id and application secret obtained in previous step. There is related code change:
var facebookKeys = new[] { new IdentityProviderKey { IdentityProvider = facebook, StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddYears(1), Type = "ApplicationKey", Usage = "ApplicationId", Value = Encoding.Default.GetBytes(facebookAppId) }, new IdentityProviderKey { IdentityProvider = facebook, StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddYears(1), Type = "ApplicationKey", Usage = "ApplicationSecret", Value = Encoding.Default.GetBytes(facebookAppSecret) } };
Test your work by running the code and then logging in to Access Control Service Management Portal at https://portal.appfabriclabs.com/. Navigate to Identity Providers page and verify Facebook is added as identity provider.
Related Books
- Programming Windows Identity Foundation (Dev - Pro)
- A Guide to Claims-Based Identity and Access Control (Patterns & Practices) – free online version
- Developing More-Secure Microsoft ASP.NET 2.0 Applications (Pro Developer)
- Ultra-Fast ASP.NET: Build Ultra-Fast and Ultra-Scalable web sites using ASP.NET and SQL Server
- Advanced .NET Debugging
- Debugging Microsoft .NET 2.0 Applications
Related Info
- Windows Azure AppFabric Access Control Service v2 - Adding Identity Provider Using Management Service
- Windows Identity Foundation (WIF) and Azure AppFabric Access Control (ACS) Service Survival Guide
- Videos: Windows Azure Security Essentials For Decision Makers, Security Architecture, Access, and Secure Development
- Video: What’s Windows Azure AppFabric Access Control Service (ACS) v2?
- Video: What Windows Azure AppFabric Access Control Service (ACS) v2 Can Do For Me?
- Video: Windows Azure AppFabric Access Control Service (ACS) v2 Key Components and Architecture
- Video: Windows Azure AppFabric Access Control Service (ACS) v2 Prerequisites