Skip to content

Commit

Permalink
Declarative Authorization, step 6. #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Jan 27, 2024
1 parent f6d09a8 commit 54c7ffb
Show file tree
Hide file tree
Showing 23 changed files with 615 additions and 384 deletions.
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
<ItemGroup Condition="'$(IsPlatformProject)'=='true' AND '$(IsTestProject)'!='true' AND '$(IsRoslynComponent)'!='true' AND '$(ExcludeFromPlatformAnalyzers)'!='true'">
<ProjectReference Include="$(MSBuildThisFileDirectory)\Tools.Analyzers.Platform\Tools.Analyzers.Platform.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup Condition="'$(IsPlatformProject)'!='true' AND '$(IsTestProject)'!='true' AND '$(IsRoslynComponent)'!='true' AND '$(ExcludeFromSubdomainAnalyzers)'!='true'">
<ProjectReference Include="$(MSBuildThisFileDirectory)\Tools.Analyzers.Subdomain\Tools.Analyzers.Subdomain.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ItemGroup Condition="'$(IsPlatformProject)'!='true' AND '$(IsTestProject)'!='true' AND '$(IsRoslynComponent)'!='true' AND '$(ExcludeFromNonPlatformAnalyzers)'!='true'">
<ProjectReference Include="$(MSBuildThisFileDirectory)\Tools.Analyzers.NonPlatform\Tools.Analyzers.NonPlatform.csproj" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<!-- Build configurations -->
Expand Down
4 changes: 3 additions & 1 deletion src/Infrastructure.Web.Api.IntegrationTests/AuthNApiSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Application.Resources.Shared;
using Common.Configuration;
using Domain.Interfaces;
using Domain.Interfaces.Authorization;
using Domain.Services.Shared.DomainServices;
using FluentAssertions;
using IdentityInfrastructure.ApplicationServices;
Expand Down Expand Up @@ -117,7 +118,8 @@ private static string CreateJwtToken(IConfigurationSettings settings, ITokensSer
return new JWTTokensService(settings, tokensService)
.IssueTokensAsync(new EndUserWithMemberships
{
Id = "auserid"
Id = "auserid",
Roles = new List<string> { PlatformRoles.Standard.Name }
}).GetAwaiter().GetResult().Value.AccessToken;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Infrastructure.Web.Api.Operations.Shared.EndUsers;

[Route("/users/{id}/roles", ServiceOperation.Post, AccessType.Token)]
[Authorize(Interfaces.Roles.Platform_Operations, Features.Platform_PaidTrial)]
[Authorize(Interfaces.Roles.Platform_Operations)]
public class AssignPlatformRolesRequest : UnTenantedRequest<AssignPlatformRolesResponse>
{
public required string Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Infrastructure.Web.Api.Operations.Shared.TestingOnly;

[Route("/testingonly/authn/hmac/get", ServiceOperation.Get, AccessType.HMAC, true)]
[Authorize(Roles.Platform_ServiceAccount)]
public class GetCallerWithHMACTestingOnlyRequest : IWebRequest<GetCallerTestingOnlyResponse>
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Infrastructure.Web.Api.Operations.Shared.TestingOnly;

[Route("/testingonly/authn/token/get", ServiceOperation.Get, AccessType.Token, true)]
[Authorize(Roles.Platform_Standard)]
public class GetCallerWithTokenOrAPIKeyTestingOnlyRequest : IWebRequest<GetCallerTestingOnlyResponse>
{
}
Expand Down
4 changes: 2 additions & 2 deletions src/SaaStack.sln
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AncillaryDomain", "Ancillar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AncillaryDomain.UnitTests", "AncillaryDomain.UnitTests\AncillaryDomain.UnitTests.csproj", "{AA82B265-66A9-483C-BD4B-3AD35D51ABED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.Subdomain", "Tools.Analyzers.Subdomain\Tools.Analyzers.Subdomain.csproj", "{8EE34354-4B11-41AD-BE92-845356A36D00}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.NonPlatform", "Tools.Analyzers.NonPlatform\Tools.Analyzers.NonPlatform.csproj", "{8EE34354-4B11-41AD-BE92-845356A36D00}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.Common", "Tools.Analyzers.Common\Tools.Analyzers.Common.csproj", "{D09C110B-9639-43D7-8A85-7F2A102554E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.Subdomain.UnitTests", "Tools.Analyzers.Subdomain.UnitTests\Tools.Analyzers.Subdomain.UnitTests.csproj", "{3EF40C54-AACB-45B7-A013-BB46F3F8FC35}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools.Analyzers.NonPlatform.UnitTests", "Tools.Analyzers.NonPlatform.UnitTests\Tools.Analyzers.NonPlatform.UnitTests.csproj", "{3EF40C54-AACB-45B7-A013-BB46F3F8FC35}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infrastructure.Web.Interfaces", "Infrastructure.Web.Interfaces\Infrastructure.Web.Interfaces.csproj", "{11871155-F741-4AFD-BD9E-9AE7C7670B1C}"
EndProject
Expand Down
Loading

0 comments on commit 54c7ffb

Please sign in to comment.