Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Introducing Windows Azure- P38:The cloud platform is getting more and more attractive to the computing world. Today, service-oriented architecture (SOA) and aspect-oriented programming (AOP) techniques are widely used in enterprise solutions. A question an IT management team or a software development team may ask is, what is the next trend going to be? Cloud computing seems to be the right answer. | CHAPTER 5 AZURE .NET SERVICES ACCESS CONTROL claim.Resource.ToString http docs.oasis-open.org wsfed authorization 200706 claims action claimValue if AccessControlHelper.IsIssuedByIbn claimSet return throw new FaultException Access denied. static bool IsIssuedByIbn ClaimSet claimSet foreach Claim claim in claimSet.Issuer if AccessControlHelper.CheckClaim claim.ClaimType claim.Resource.ToString http schemas.xmlsoap.org ws 2005 05 identity claims dns accesscontrol.windows.net return true return false static bool CheckClaim string claimType string claimValue string expectedClaimType string expectedClaimValue if StringComparer.OrdinalIgnoreCase.Equals claimType expectedClaimType StringComparer.OrdinalIgnoreCase.Equals claimValue expectedClaimValue return true return false Now let s modify the WCF service operation implementation. For all implementations of the operation in the WCF service contract we need to insert the code to demand the claim for the security token by using the previous helper class as Listing 5-18 shows. 163 CHAPTER 5 AZURE .NET SERVICES ACCESS CONTROL Listing5-18. Implementation of the WCFService Contract using System using System.Runtime.Serialization using System.ServiceModel using System.ServiceModel.Channels using System.Collections.Generic using System.IO using System.Xml using System.Xml.Serialization using System.Text namespace AzureForDotNetDeveloper.DotNetService.ServiceBus ServiceBehavior InstanceContextMode InstanceContextMode.Single public class AzureForDotNetDeveloperWCFservice IAzureForDotNetDeveloperWCFservice private User registeredUser null region IUserRegisterService Members public string Ping AccessControlHelper.DemandActionClaim UserRegister.Ping return string.Format I am here 0 this.ToString public void RegisterUser string xmlString try AccessControlHelper.DemandActionClaim UserRegister.RegisterUser XmlDocument xmlDoc new XmlDocument xmlDoc.LoadXml xmlString XmlSerializer serializer new XmlSerializer typeof User StringReader .