Esempio n. 1
0
        private ClaimSecurityAttributeBuilder CreateBuilder()
        {
            if (StringValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, StringValue));
            }
            else if (ULongValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, ULongValue));
            }
            else if (LongValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, LongValue));
            }
            else if (BoolValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, BoolValue));
            }
            else if (SidValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, SidValue));
            }
            else if (FqbnValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, FqbnValue));
            }
            else if (OctetValue != null)
            {
                return(ClaimSecurityAttributeBuilder.Create(Name, Flags, OctetValue));
            }

            throw new ArgumentException("Invalid security attribute type");
        }
Esempio n. 2
0
        /// <summary>
        /// Overridden ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            if (Attribute != null)
            {
                Name = Attribute.Select(a => a.Name).ToArray();
            }

            var builders = Name.Select(n => ClaimSecurityAttributeBuilder.Create(n, 0, new long[0]));
            var ops      = Enumerable.Repeat(TokenSecurityAttributeOperation.Delete, Name.Length);

            Token.SetSecurityAttributes(builders, ops);
        }