-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #378: Authentication handlers #379
base: development
Are you sure you want to change the base?
Fix #378: Authentication handlers #379
Conversation
…tern; add AnonymousAuthenticationHandler to support Carter modules that do not require authentication
…nd Serilog.AspNetCore
…openid-authentication
@@ -2,7 +2,7 @@ | |||
// <copyright file="IAuthenticationPersonDao.cs" company="Starion Group S.A."> | |||
// Copyright (c) 2015-2023 Starion Group S.A. | |||
// | |||
// Author: Sam Geren�, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Th�ate | |||
// Author: Sam Geren�, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Th�ate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something wrong with encoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -108,12 +109,21 @@ public async Task<AuthenticationPerson> Authenticate(string username, string pas | |||
|
|||
return null; | |||
} | |||
catch (NpgsqlException ex) | |||
{ | |||
transaction?.RollbackAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to rollback? i don;t think we are writing anything, so nothing to rollback to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/// <summary> | ||
/// Provides the expiration times of a generated JWT token, in minutes | ||
/// </summary> | ||
private const int ExpirationMinutes = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i propose we make this configurable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
CometServer/CometServer.csproj.orig
Outdated
<Exec Command="dotnet $(VersionFileCreatorDllPath) path:$(OutDir) " YieldDuringToolExecution="True" ConsoleToMSBuild="True" /> | ||
<Message Importance="High" Text="------ VersionFileCreator tool Finished ------ " /> | ||
</Target> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/// <returns>Value of the assert</returns> | ||
public static bool DoesAuthorizationHeaderMatches(this HttpRequest request, string expectedAuthorizationScheme) | ||
{ | ||
var authorizationHeader = request.Headers.Authorization; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add argumentnull check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
CometServer/Modules/10-25/ApiBase.cs
Outdated
this.logger.LogWarning("Identifier claim {ClaimName} missing User Claims", | ||
appConfigService.AppConfig.AuthenticationConfig.ExternalJwtAuthenticationConfig.IdentifierClaimName); | ||
|
||
throw new AuthorizationException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not add textual description to exceptino, similar to log statemnt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
}); | ||
|
||
app.MapGet("/logout", async (HttpRequest req, HttpResponse res) => { | ||
app.MapPost("/logout", async (HttpRequest req, HttpResponse res) => | ||
{ | ||
//return webServiceAuthentication.LogOutResponse(req.HttpContext); | ||
throw new NotImplementedException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we implement this? not sure what we need to do though
app.MapGet("/username", async (HttpRequest req, HttpResponse res) => | ||
{ | ||
await res.WriteAsync(res.HttpContext.User.Identity.Name); | ||
}).RequireAuthorization(new[] { BasicAuthenticationDefaults.AuthenticationScheme }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this only work with basic then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I support everything is necessary?
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
Prerequisites
Description
Fix #378
Allows 3 kind of authentication: