Skip to content

Commit

Permalink
Update SwaggerUiConfig.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dezzzu authored Jan 22, 2024
1 parent 611e370 commit 8f027db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Swagger.Net/Application/SwaggerUiConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public SwaggerUiConfig(IEnumerable<string> discoveryPaths, Func<HttpRequestMessa
{ "%(OAuth2Realm)", "" },
{ "%(OAuth2AppName)", "" },
{ "%(OAuth2ScopeSeparator)", " " },
{ "%(UsePkceWithAuthorizationCodeGrant)", "false" },
{ "%(OAuth2AdditionalQueryStringParams)", "{}" }
};
_rootUrlResolver = rootUrlResolver;
Expand Down Expand Up @@ -183,6 +184,7 @@ public void EnableOAuth2Support(
string realm,
string appName,
string scopeSeperator = " ",
bool usePkce = true,
Dictionary<string, string> additionalQueryStringParams = null)
{
_templateParams["%(OAuth2Enabled)"] = "true";
Expand All @@ -191,6 +193,7 @@ public void EnableOAuth2Support(
_templateParams["%(OAuth2Realm)"] = realm;
_templateParams["%(OAuth2AppName)"] = appName;
_templateParams["%(OAuth2ScopeSeparator)"] = scopeSeperator;
_templateParams["%(UsePkceWithAuthorizationCodeGrant)"] = usePkce ? "true" : "false";

if (additionalQueryStringParams != null)
_templateParams["%(OAuth2AdditionalQueryStringParams)"] = JsonConvert.SerializeObject(additionalQueryStringParams);
Expand Down Expand Up @@ -233,4 +236,4 @@ public enum DefaultModelRender
Model,
Example
}
}
}

0 comments on commit 8f027db

Please sign in to comment.