AbishkarKafle
AbishkarKafle
CC#
Created by AbishkarKafle on 11/14/2024 in #help
How Can I add Security Definition in Scalar
No description
4 replies
CC#
Created by AbishkarKafle on 11/14/2024 in #help
How Can I add Security Definition in Scalar
No description
4 replies
CC#
Created by AbishkarKafle on 11/14/2024 in #help
How Can I add Security Definition in Scalar
Fixed
internal sealed class BearerSecuritySchemeTransformer(IAuthenticationSchemeProvider authenticationSchemeProvider) : IOpenApiDocumentTransformer
{
public async Task TransformAsync(OpenApiDocument document, OpenApiDocumentTransformerContext context, CancellationToken cancellationToken)
{
var authenticationSchemes = await authenticationSchemeProvider.GetAllSchemesAsync();
if (authenticationSchemes.Any(authScheme => authScheme.Name == "Bearer"))
{
var requirements = new Dictionary<string, OpenApiSecurityScheme>
{
["Bearer"] = new OpenApiSecurityScheme
{
Type = SecuritySchemeType.Http,
Scheme = "bearer", // "bearer" refers to the header name here
In = ParameterLocation.Header,
BearerFormat = "Json Web Token"
}
};
document.Components ??= new OpenApiComponents();
document.Components.SecuritySchemes = requirements;
}
}
}
internal sealed class BearerSecuritySchemeTransformer(IAuthenticationSchemeProvider authenticationSchemeProvider) : IOpenApiDocumentTransformer
{
public async Task TransformAsync(OpenApiDocument document, OpenApiDocumentTransformerContext context, CancellationToken cancellationToken)
{
var authenticationSchemes = await authenticationSchemeProvider.GetAllSchemesAsync();
if (authenticationSchemes.Any(authScheme => authScheme.Name == "Bearer"))
{
var requirements = new Dictionary<string, OpenApiSecurityScheme>
{
["Bearer"] = new OpenApiSecurityScheme
{
Type = SecuritySchemeType.Http,
Scheme = "bearer", // "bearer" refers to the header name here
In = ParameterLocation.Header,
BearerFormat = "Json Web Token"
}
};
document.Components ??= new OpenApiComponents();
document.Components.SecuritySchemes = requirements;
}
}
}
should be used and
builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddOpenApi(options =>
{
options.AddDocumentTransformer<BearerSecuritySchemeTransformer>();
});
builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddOpenApi(options =>
{
options.AddDocumentTransformer<BearerSecuritySchemeTransformer>();
});
using this authentication and authorization can be used
Micrsoft.AspNetCore.Authentication.JwtBearer
Micrsoft.AspNetCore.Authentication.JwtBearer
package is important that's what I found
4 replies
CC#
Created by AbishkarKafle on 9/15/2024 in #help
Issue with not being able to register with google ReCaptcha v2
ahh captcha cookies
10 replies
CC#
Created by AbishkarKafle on 9/15/2024 in #help
Issue with not being able to register with google ReCaptcha v2
is this it?
10 replies
CC#
Created by AbishkarKafle on 9/15/2024 in #help
Issue with not being able to register with google ReCaptcha v2
builder.Services.Configure<CookiePolicyOptions>(options =>
{

options.MinimumSameSitePolicy = SameSiteMode.Lax;
options.Secure = CookieSecurePolicy.SameAsRequest;
});
builder.Services.Configure<CookiePolicyOptions>(options =>
{

options.MinimumSameSitePolicy = SameSiteMode.Lax;
options.Secure = CookieSecurePolicy.SameAsRequest;
});
10 replies
CC#
Created by AbishkarKafle on 9/15/2024 in #help
Issue with not being able to register with google ReCaptcha v2
in program.cs file
10 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
yes
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
to teh same database?
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
i am learning to make api and integrate
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
where should I call it what is the strandard?
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
both are different project but they are running locally
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
uhh what do you mean? like use httpClientFactory
24 replies
CC#
Created by AbishkarKafle on 3/29/2024 in #help
is this how you are suppose to use update using api in asp.net?
ok
24 replies
CC#
Created by AbishkarKafle on 8/15/2023 in #help
❔ the data inside my datagrid is showing twice
i will see that
8 replies
CC#
Created by AbishkarKafle on 8/15/2023 in #help
❔ the data inside my datagrid is showing twice
or codes
8 replies
CC#
Created by AbishkarKafle on 8/15/2023 in #help
❔ the data inside my datagrid is showing twice
this is the code
8 replies
CC#
Created by AbishkarKafle on 8/15/2023 in #help
❔ the data inside my datagrid is showing twice
8 replies