Skip to content

Commit 73de6e1

Browse files
authored
Configured the swagger UI to persist the authentication token (still only valid for 5 minutes, as it cannot use refreshtoken) and added filtering. (#16146)
1 parent f1e43a7 commit 73de6e1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Umbraco.Cms.Api.Common/OpenApi/SwaggerRouteTemplatePipelineFilter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ protected virtual void SwaggerUiConfiguration(
6262
swaggerUiOptions.SwaggerEndpoint($"{name}/swagger.json", $"{apiInfo.Title}");
6363
}
6464

65+
// Add custom configuration from https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
66+
swaggerUiOptions.ConfigObject.PersistAuthorization = true; // persists authorization data so it would not be lost on browser close/refresh
67+
swaggerUiOptions.ConfigObject.Filter = string.Empty; // Enable the filter with an empty string as default filter.
68+
6569
swaggerUiOptions.OAuthClientId(Constants.OAuthClientIds.Swagger);
6670
swaggerUiOptions.OAuthUsePkce();
6771
}

0 commit comments

Comments
 (0)