/// <summary> /// Initializes a new instance of the SimpleWebTokenAuthAttribute class. /// </summary> public SimpleWebTokenAuthAttribute() { // If configuration app settings do not include an assembly from which to create a mock SimpleWebTokenAuthAttribute // instance, use this object. Otherwise, create an instance of the mock class. string mockApiAuthAssembly = ConfigurationManager.AppSettings["mockApiAuth"]; if (string.IsNullOrWhiteSpace(mockApiAuthAssembly)) { this.simpleWebTokenAuthAttributeInstance = this; } else { this.simpleWebTokenAuthAttributeInstance = LateBinding.BuildObjectFromLateBoundAssembly <IApiAuthAttribute>( "SimpleWebTokenAuthAttribute", LateBinding.GetLateBoundAssemblyTypes(mockApiAuthAssembly)); } }
/// <summary> /// Initializes a new instance of the ApiAuthAttribute class. /// </summary> /// <param name="roles"> /// The roles for which the user must be authorized. /// </param> /// <param name="flags"> /// The flags. /// </param> public ApiAuthAttribute(string[] roles = null, string[] flags = null) { this.Roles = roles; this.Flags = flags == null ? new HashSet <string>() : new HashSet <string>(flags); // If configuration app settings do not include an assembly from which to create a mock ApiAuthAttribute instance, // use this object. Otherwise, create an instance of the mock class. string mockApiAuthAssembly = ConfigurationManager.AppSettings["mockApiAuth"]; if (string.IsNullOrWhiteSpace(mockApiAuthAssembly)) { this.apiAuthAttributeInstance = this; } else { this.apiAuthAttributeInstance = LateBinding.BuildObjectFromLateBoundAssembly <IApiAuthAttribute>( "ApiAuthAttribute", LateBinding.GetLateBoundAssemblyTypes(mockApiAuthAssembly)); } }