AuthenticationBdjobs 1.0.4
dotnet add package AuthenticationBdjobs --version 1.0.4
NuGet\Install-Package AuthenticationBdjobs -Version 1.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AuthenticationBdjobs" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AuthenticationBdjobs --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AuthenticationBdjobs, 1.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AuthenticationBdjobs as a Cake Addin #addin nuget:?package=AuthenticationBdjobs&version=1.0.4 // Install AuthenticationBdjobs as a Cake Tool #tool nuget:?package=AuthenticationBdjobs&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
How to Add RecruiterAuthorize
To use RecruiterAuthorize
in your class in your BaseController like this:
[ApiController]
[RecruiterAuthorize]
public class APIBaseController : ControllerBase
{
}
Add those in the Program.cs
file.
builder.Services.AddSwaggerGen(option =>
{
option.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
{
In = ParameterLocation.Header,
Description = "Enter a valid JSON web token here",
Name = "Authorization",
Type = SecuritySchemeType.Http,
BearerFormat = "JWT",
Scheme = "Bearer"
});
option.AddSecurityRequirement(new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type=ReferenceType.SecurityScheme,
Id="Bearer"
}
},
Array.Empty<string>()
}
});
});
var jwtSettings = new JwtSettings();
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = jwtSettings.Issuer,
ValidAudience = jwtSettings.Audience,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSettings.Key))
};
});
app.UseMiddleware<UnauthorizedMiddleware>();
Make a middleware UnauthorizedMiddleware.cs
to handle unauthorized access.
public class UnauthorizedMiddleware
{
private readonly RequestDelegate _next;
public UnauthorizedMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
await _next(context);
if (context.Response.StatusCode == StatusCodes.Status401Unauthorized)
{
context.Response.ContentType = "application/json";
var responseData = new
{
statusCode = StatusCodes.Status401Unauthorized,
message = "Unauthorized",
};
var json = JsonSerializer.Serialize(responseData);
await context.Response.WriteAsync(json);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- AspNetCoreRateLimit (>= 5.0.0)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.6)
- Microsoft.AspNetCore.OpenApi (>= 8.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 8.0.6)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- RecruiterAuth.Authentication.Commons (>= 1.0.0)
- RecruiterAuth.Authentication.Services (>= 1.0.0)
- Serilog (>= 3.1.1)
- Serilog.AspNetCore (>= 8.0.0)
- Swashbuckle.AspNetCore (>= 7.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.4 | 56 | 1/30/2025 |