I have setup a asp.net core Web API 2 project with authorisation and when I migrated my Entity Framework code first it created the AspNetUsers. I have now added my swagger doc to the site but their is no methods to register a user etc how do I register the asp.net Identity methods to register a user verify a user etc to the swagger site.
Do I need to create my own AccountController? Or is there a way to expose those methods to swagger?
services.AddSwaggerGen(c => {
c.SwaggerDoc("v1", new OpenApiInfo { Title = "App Manager - Running Buddies", Version = "v1" });
//Expose XML comments in doc.
c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme {
Description =
"JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below.\r\n\r\nExample: \"Bearer 12345abcdef\"",
Name = "Authorization",
In = ParameterLocation.Header,
Type = SecuritySchemeType.ApiKey,
Scheme = "Bearer"
});
c.AddSecurityRequirement(new OpenApiSecurityRequirement()
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme,
Id = "Bearer"
},
Scheme = "oauth2",
Name = "Bearer",
In = ParameterLocation.Header
},
new List<string>()
}
});
});
