/// <summary> /// Configure SwaggerUIOptions with client id. /// </summary> /// <param name="swaggerUIOptions">the SwaggerUIOptions instance to extend.</param> /// <param name="clientId">The ClientId for oauth2 endpoint.</param> public static void ConfigureOauth2Authentication(this SwaggerUIOptions swaggerUIOptions, string clientId) { if (clientId == null) { throw new ArgumentNullException(nameof(clientId)); } swaggerUIOptions.OAuthClientId(clientId); swaggerUIOptions.OAuthRealm(clientId); swaggerUIOptions.OAuthScopeSeparator(" "); }
public virtual void SetupSwaggerCommonUi(SwaggerUIOptions options) { options.EnableDeepLinking(); options.EnableFilter(); options.DocumentTitle = $"{this.MicroServiceTitle} - Swagger UI"; options.RoutePrefix = SwaggerUiRoutePrefix; options.HeadContent += "<meta name=\"robots\" content=\"none\" />"; options.OAuthClientId(Configuration.GetValue <string>("SwaggerClientId")); options.OAuthClientSecret(Configuration.GetValue <string>("SwaggerClientSecret")); options.OAuthAppName(Configuration.GetValue <string>("SwaggerAppName")); options.OAuthScopeSeparator(" "); options.OAuthUsePkce(); }
/// <summary> /// Set up some properties for swagger UI /// </summary> /// <param name="settings"></param> public static void SwaggerSettings(SwaggerUIOptions settings) { settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}"); settings.RoutePrefix = SwaggerUrl; settings.DocumentTitle = "Microservice API"; settings.DefaultModelExpandDepth(0); settings.DefaultModelRendering(ModelRendering.Model); settings.DefaultModelsExpandDepth(0); settings.DocExpansion(DocExpansion.None); settings.OAuthClientId("microservice1"); settings.OAuthScopeSeparator(" "); settings.OAuthClientSecret("secret"); settings.DisplayRequestDuration(); settings.OAuthAppName("Microservice API (with IdentityServer4) module API documentation"); }
/// <summary> /// Set up some properties for swagger UI /// </summary> /// <param name="settings"></param> public static void SwaggerSettings(SwaggerUIOptions settings) { settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}"); settings.HeadContent = $"{ThisAssembly.Git.Branch.ToUpper()} {ThisAssembly.Git.Commit.ToUpper()}"; settings.DocumentTitle = $"{AppTitle}"; settings.DefaultModelExpandDepth(0); settings.DefaultModelRendering(ModelRendering.Model); settings.DefaultModelsExpandDepth(0); settings.DocExpansion(DocExpansion.None); settings.OAuthClientId("microservice1"); settings.OAuthScopeSeparator(" "); settings.OAuthClientSecret("secret"); settings.DisplayRequestDuration(); settings.OAuthAppName("Microservice module API"); }
/// <summary> /// Set up some properties for swagger UI /// </summary> /// <param name="settings"></param> public static void SwaggerSettings(SwaggerUIOptions settings) { settings.SwaggerEndpoint(SwaggerConfig, $"{AppTitle} v.{AppVersion}"); settings.RoutePrefix = SwaggerUrl; settings.DocumentTitle = "Catalog API documentation"; settings.DefaultModelExpandDepth(0); settings.DefaultModelRendering(ModelRendering.Model); settings.DefaultModelsExpandDepth(0); settings.DocExpansion(DocExpansion.None); settings.OAuthClientId("microservice1"); settings.OAuthScopeSeparator(" "); settings.OAuthClientSecret("secret"); settings.DisplayRequestDuration(); settings.OAuthAppName("Micro service"); settings.OAuthUseBasicAuthenticationWithAccessCodeGrant(); }
public virtual void SetupSwaggerUI(SwaggerUIOptions options, IApiVersionDescriptionProvider provider) { var swaggerJsonRoutePrefix = string.IsNullOrEmpty(SwaggerUiRoutePrefix) ? "./swagger" : "."; foreach (var description in provider.ApiVersionDescriptions) { options.SwaggerEndpoint($"{swaggerJsonRoutePrefix}/{description.GroupName}/swagger.json", description.GroupName.ToUpperInvariant()); } options.EnableDeepLinking(); options.EnableFilter(); options.RoutePrefix = SwaggerUiRoutePrefix; options.HeadContent += "<meta name=\"robots\" content=\"none\" />"; options.OAuthClientId(Configuration.GetValue <string>("SwaggerClientId")); options.OAuthClientSecret(Configuration.GetValue <string>("SwaggerClientSecret")); options.OAuthAppName(Configuration.GetValue <string>("SwaggerAppName")); options.OAuthScopeSeparator(" "); options.OAuthUsePkce(); }