Exemplo n.º 1
0
        public double TradeSecurity(string ticker, int quantity)
        {
            Console.WriteLine("Claim made at " + System.DateTime.Now.TimeOfDay);
            System.ServiceModel.OperationContext opx;
            opx = OperationContext.Current;
            if (opx != null)
            {
                System.IdentityModel.Policy.AuthorizationContext ctx =
                    opx.ServiceSecurityContext.AuthorizationContext;
                foreach (System.IdentityModel.Claims.ClaimSet cs in ctx.ClaimSets)
                {
                    Console.WriteLine("Claim Issued by : " + cs.Issuer);
                    foreach (System.IdentityModel.Claims.Claim claim in cs)
                    {
                        Console.WriteLine("Claim Type - " + claim.ClaimType);
                        Console.WriteLine("Claim Resource name - " + claim.Resource);
                        Console.WriteLine("Claim Right - " + claim.Right);
                    }
                }
            }
            if (quantity < 1)
            {
                throw new ArgumentException(
                          "Invalid quantity", "quantity");
            }
            switch (ticker.ToLower())
            {
            case "ibm":
                return(quantity * IBM_Price);

            case "msft":
                return(quantity * MSFT_Price);

            default:
                throw new ArgumentException(
                          "Don't know - only MSFT & IBM", "ticker");
            }
        }
 public ServiceSecurityContext(System.IdentityModel.Policy.AuthorizationContext authorizationContext)
 {
 }
 public ServiceSecurityContext(System.IdentityModel.Policy.AuthorizationContext authorizationContext, System.Collections.ObjectModel.ReadOnlyCollection <System.IdentityModel.Policy.IAuthorizationPolicy> authorizationPolicies)
 {
 }
Exemplo n.º 4
0
 public abstract bool CheckAccess(System.ServiceModel.EndpointIdentity identity, System.IdentityModel.Policy.AuthorizationContext authContext);