Пример #1
0
        /// <summary>
        /// Add a Security scheme definitions that can be used across the specification.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="scheme">
        /// The scheme.
        /// </param>
        /// <returns>
        /// The <see cref="SwaggerRootBuilder"/>.
        /// </returns>
        public SwaggerRootBuilder SecurityDefinition(string name, SecuritySchemeBuilder scheme)
        {
            if (this.securityDefinitions == null)
            {
                this.securityDefinitions = new Dictionary <string, SecurityScheme>();
            }

            this.securityDefinitions.Add(name, scheme.Build());
            return(this);
        }
        public static void AddSecuritySchemeBuilder(SecuritySchemeBuilder builder, string name)
        {
            if (_securitySchemes == null)
            {
                _securitySchemes = new Dictionary<string, SecuritySchemeBuilder>();
            }

            if (_securitySchemes.ContainsKey(name))
            {
                _securitySchemes.Remove(name);
            }

            _securitySchemes.Add(name, builder);
        }
 public static void SetSecuritySchemeBuilder(SecuritySchemeBuilder builder, string name)
 {
     _securitySchemes = null;
     AddSecuritySchemeBuilder(builder, name);
 }