Skip to content

Instantly share code, notes, and snippets.

@PradeepLoganathan
Last active June 24, 2020 06:43
Show Gist options
  • Select an option

  • Save PradeepLoganathan/aeedbdfc22fcf936ea78c5fee2ba4203 to your computer and use it in GitHub Desktop.

Select an option

Save PradeepLoganathan/aeedbdfc22fcf936ea78c5fee2ba4203 to your computer and use it in GitHub Desktop.
OpenApiSecurityScheme securityScheme = new OpenApiSecurityScheme()
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
AuthorizationCode = new OpenApiOAuthFlow
{
AuthorizationUrl = new Uri("/auth-server/connect/authorize", UriKind.Relative),
TokenUrl = new Uri("/auth-server/connect/token", UriKind.Relative),
Scopes = new Dictionary<string, string>
{
{"readAccess", "Access read operations"},
{"writeAccess", "Access write operations"}
}
}
}
};
options.AddSecurityDefinition("oauth2", securityScheme);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment