Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bdovaz committed Apr 23, 2024
1 parent e8223bf commit 1a8463c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0"/>
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
</ItemGroup>

<ItemGroup Label="Release">
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
<PackageVersion Include="MinVer" Version="5.0.0"/>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var value = role.GetString();

var matchingClaim = identity.Claims.FirstOrDefault(claim =>
claim.Type.Equals(this.roleClaimType, StringComparison.OrdinalIgnoreCase) &&
claim.Value.Equals(value, StringComparison.OrdinalIgnoreCase));
var matchingClaim = identity.Claims.FirstOrDefault(claim =>
claim.Type.Equals(this.roleClaimType, StringComparison.InvariantCultureIgnoreCase) &&
claim.Value.Equals(value, StringComparison.InvariantCultureIgnoreCase));

if (matchingClaim is null && !string.IsNullOrWhiteSpace(value))
{
Expand Down Expand Up @@ -119,9 +119,9 @@ public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
var value = role.GetString();

var matchingClaim = identity.Claims.FirstOrDefault(claim =>
claim.Type.Equals(this.roleClaimType, StringComparison.OrdinalIgnoreCase) &&
claim.Value.Equals(value, StringComparison.OrdinalIgnoreCase));
var matchingClaim = identity.Claims.FirstOrDefault(claim =>
claim.Type.Equals(this.roleClaimType, StringComparison.InvariantCultureIgnoreCase) &&
claim.Value.Equals(value, StringComparison.InvariantCultureIgnoreCase));

if (matchingClaim is null && !string.IsNullOrWhiteSpace(value))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keycloak.AuthServices.Authorization;
namespace Keycloak.AuthServices.Authorization;

using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Options;
Expand Down Expand Up @@ -31,7 +31,7 @@ public ProtectedResourcePolicyProvider(
var builder = new AuthorizationPolicyBuilder();
var tokens = policyName.Split('#');

if (tokens is not { Length: 2 })
if (tokens is not {Length: 2})
{
return default;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public partial class RealmAccessRequirementHandler : AuthorizationHandler<RealmA
/// <summary>
/// </summary>
/// <param name="logger"></param>
public RealmAccessRequirementHandler(ILogger<RealmAccessRequirementHandler> logger) => this.logger = logger;
public RealmAccessRequirementHandler(ILogger<RealmAccessRequirementHandler> logger)
{
this.logger = logger;
}

[LoggerMessage(100, LogLevel.Debug,
"[{Requirement}] Access outcome {Outcome} for user {UserName}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<Description>Utils for Keycloak.AuthServices</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Keycloak.AuthServices.Sdk/Admin/IKeycloakUserClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keycloak.AuthServices.Sdk.Admin;
namespace Keycloak.AuthServices.Sdk.Admin;

using Constants;
using Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace Keycloak.AuthServices.Sdk.Admin;
namespace Keycloak.AuthServices.Sdk.Admin;

using Common;

/// <summary>
/// Defines a set of options used to perform Admin HTTP Client calls
/// </summary>
public sealed class KeycloakAdminClientOptions : KeycloakInstallationOptions
public sealed class KeycloakAdminClientOptions: KeycloakInstallationOptions
{
/// <summary>
/// Default section name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Keycloak.AuthServices.Sdk.HttpMiddleware;
namespace Keycloak.AuthServices.Sdk.HttpMiddleware;

using IdentityModel.Client;
using Microsoft.AspNetCore.Authentication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
<ProjectReference Include="..\Keycloak.AuthServices.Common\Keycloak.AuthServices.Common.csproj" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Refit" />
<PackageReference Include="Refit.HttpClientFactory" />
Expand Down

0 comments on commit 1a8463c

Please sign in to comment.