Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5a0687b9

Přidáno uživatelem Dominik Chlouba před téměř 4 roky(ů)

Merged ad-auth with frontend

Zobrazit rozdíly:

Leuze.sln
35 35
EndProject
36 36
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Tests.Core.Domain", "tests\Core\Leuze.Tests.Core.Domain\Leuze.Tests.Core.Domain.csproj", "{8ECAEA01-61F3-402D-B94E-E54FC0C94C8E}"
37 37
EndProject
38
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Leuze.Core.Infrastructure.ActiveDirectory", "src\Core\Infrastructure\Leuze.Core.Infrastructure.ActiveDirectory\Leuze.Core.Infrastructure.ActiveDirectory.csproj", "{1407144F-48F6-404E-A890-961B739D030D}"
38
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Core.Infrastructure.ActiveDirectory", "src\Core\Infrastructure\Leuze.Core.Infrastructure.ActiveDirectory\Leuze.Core.Infrastructure.ActiveDirectory.csproj", "{1407144F-48F6-404E-A890-961B739D030D}"
39 39
EndProject
40
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Leuze.Tests.Core.Infrastructure.ActiveDirectory", "tests\Core\Leuze.Tests.Core.Infrastructure.ActiveDirectory\Leuze.Tests.Core.Infrastructure.ActiveDirectory.csproj", "{C1813611-5FF2-4E70-B7E5-A4E8553F0B66}"
40
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Leuze.Tests.Core.Infrastructure.ActiveDirectory", "tests\Core\Leuze.Tests.Core.Infrastructure.ActiveDirectory\Leuze.Tests.Core.Infrastructure.ActiveDirectory.csproj", "{C1813611-5FF2-4E70-B7E5-A4E8553F0B66}"
41 41
EndProject
42 42
Global
43 43
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
src/Core/Application/Leuze.Core.Application.UI/App.razor
1 1
@using System.Reflection
2 2
@using ExtCore.Infrastructure
3

  
4
<Router AppAssembly="@typeof(CoreUIExtension).Assembly" AdditionalAssemblies="LoadAdditionalAssemblies">
5
    <Found Context="routeData">
6
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
7
    </Found>
8
    <NotFound>
9
        <LayoutView Layout="@typeof(MainLayout)">
10
            <p>Sorry, there's nothing at this address.</p>
11
        </LayoutView>
12
    </NotFound>
13
</Router>
3
<CascadingAuthenticationState>
4
    <Router AppAssembly="@typeof(CoreUIExtension).Assembly" AdditionalAssemblies="LoadAdditionalAssemblies">
5
        <Found Context="routeData">
6
            <AuthorizeRouteView RouteData="@routeData"/>
7
        </Found>
8
        <NotFound>
9
            <LayoutView Layout="@typeof(MainLayout)">
10
                <p>Sorry, there's nothing at this address.</p>
11
            </LayoutView>
12
        </NotFound>
13
    </Router>
14
</CascadingAuthenticationState>
14 15

  
15 16
@code {
16 17
    public IEnumerable<Assembly> LoadAdditionalAssemblies { get; set; } = null!;
src/Core/Application/Leuze.Core.Application.UI/Pages/Index.razor
1 1
@page "/"
2
@layout MainLayout
2 3

  
3 4
<h1>Hello, world!</h1>
4 5

  
src/Core/Application/Leuze.Core.Application.UI/Shared/MainLayout.razor
1 1
@inherits LayoutComponentBase
2
@inject NavigationManager _navManager
2 3
<div class="top-row px-4">
3
    <img src="Resources/Icons/logo.svg" alt="logo" style="width:111px;height:28px;">
4
    <img src="Resources/Icons/sign-out.svg" style="width:18px;height:20px;">
5

  
4
    <img src="Resources/Icons/logo.svg" alt="logo" style="width:111px;height:28px;"/>
5
    <img src="Resources/Icons/sign-out.svg" style="width:18px;height:20px;"/>
6 6
</div>
7
    <div class="page">  
8
        <div class="sidebar">
9
            <NavMenu />
10
        </div>
7

  
8

  
9
<div class="page">
10
    <div class="sidebar">
11
        <NavMenu />
12
    </div>
11 13

  
12 14
        <div class="main">
13 15
            <div class="content px-4">
......
15 17
            </div>
16 18
        </div>
17 19
    </div>
20

  
21
@code {
22

  
23
    /*protected override void OnAfterRender(bool firstRender)
24
    {
25
        base.OnAfterRender(firstRender);
26
        if (firstRender) _navManager.NavigateTo("account/login");
27
    }*/
28
}
src/Core/Application/Leuze.Core.Application.UI/_Imports.razor
7 7
@using Microsoft.AspNetCore.Components.Web.Virtualization
8 8
@using Microsoft.JSInterop
9 9
@using Leuze.Core.Application.UI.Shared
10
@using Leuze.Core.Application.UI.Components.Login
11
@using BlazorStyled 
10
@using BlazorStyled
11
@using Microsoft.AspNetCore.Authentication
12
@using Microsoft.AspNetCore.Identity
13
@using Leuze.Core.Application.Identity 
14
@using Leuze.Core.Application.UI.Components.Login
src/Core/Application/Leuze.Core.Application/Configuration/Actions.cs
4 4
using FluentValidation;
5 5
using Leuze.Core.Application.Behaviors;
6 6
using MediatR;
7
using Microsoft.Identity.Web;
7 8
using Microsoft.AspNetCore.Builder;
8 9
using Microsoft.AspNetCore.Hosting;
9 10
using Microsoft.Extensions.Configuration;
......
11 12
using Microsoft.Extensions.Hosting;
12 13
using System;
13 14
using System.Linq;
15
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
16
using Microsoft.AspNetCore.Authorization;
17
using Microsoft.AspNetCore.Mvc.Authorization;
18
using Microsoft.Identity.Web.UI;
14 19

  
15 20
namespace Leuze.Core.Application.Configuration
16 21
{
......
74 79
        /// <param name="serviceProvider"></param>
75 80
        public void Execute(IServiceCollection services, IServiceProvider serviceProvider)
76 81
        {
82
            var configuration = serviceProvider.GetRequiredService<IConfiguration>();
77 83
            services.AddAutoMapper(ExtensionManager.Assemblies);
78 84
            services.AddValidatorsFromAssemblies(ExtensionManager.Assemblies);
79 85
            services.AddMediatR(ExtensionManager.Assemblies.ToArray());
......
85 91
            appSettingsSection.Bind(appSettings);
86 92
            services.Configure<AppSettings>(appSettingsSection);
87 93

  
88
            services.AddBlazorStyled();
94
            services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
95
                .AddMicrosoftIdentityWebApp(configuration.GetSection("AzureAd"));
96
            services.AddControllersWithViews()
97
                .AddMicrosoftIdentityUI();
98

  
99
            services.AddAuthorization();
89 100
            services.AddRazorPages();
90
            services.AddServerSideBlazor();
101
            services.AddServerSideBlazor()
102
                .AddMicrosoftIdentityConsentHandler();
103
            services.AddBlazorStyled();
91 104
        }
92 105
    }
93 106
}
src/Core/Application/Leuze.Core.Application/Leuze.Core.Application.csproj
35 35
    <PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="9.5.2" />
36 36
    <PackageReference Include="MediatR" Version="9.0.0" />
37 37
    <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
38
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.5" />
39
    <PackageReference Include="Microsoft.Identity.Web" Version="1.8.2" />
40
    <PackageReference Include="Microsoft.Identity.Web.UI" Version="1.8.2" />
38 41
  </ItemGroup>
39 42

  
40 43
  <ItemGroup>
src/Presentation/Leuze.App/Leuze.App.csproj
17 17
    <DocumentationFile>..\..\..\docs\Leuze.App.xml</DocumentationFile>
18 18
  </PropertyGroup>
19 19

  
20
  <ItemGroup>
21
    <Content Remove="wwwroot\Resources\Icons\microsoft-logo.svg" />
22
  </ItemGroup>
23

  
24
  <ItemGroup>
25
    <None Include="wwwroot\Resources\Icons\microsoft-logo.svg" />
26
  </ItemGroup>
27

  
20 28
  <ItemGroup>
21 29
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.4">
22 30
      <PrivateAssets>all</PrivateAssets>
src/Presentation/Leuze.App/appsettings.Development.json
3 3
    "Path": "..\\Leuze.Modules\\net5.0",
4 4
    "IncludeSubPaths": false
5 5
  },
6
  "AzureAd": {
7
    "Instance": "https://login.microsoftonline.com/",
8
    "Domain": "silentindustries.onmicrosoft.com",
9
    "TenantId": "8320026e-f0c8-4609-ac9e-52b0e2bb6029",
10
    "ClientId": "7be51083-d17e-4916-984e-8567b8137365",
11
    "CallbackPath": "/signin-oidc"
12
  },
6 13
  "AppSettings": {
7 14
    "DatabaseConnection": {
8 15
      "ConnectionString": "Server=localhost;Database=Leuze_Local;User Id=sa;Password=LeuzeDB01;",
src/Presentation/Leuze.App/appsettings.json
3 3
    "Path": "..\\Leuze.Modules\\net5.0",
4 4
    "IncludeSubPaths": false
5 5
  },
6
  "AzureAd": {
7
    "Instance": "https://login.microsoftonline.com/",
8
    "Domain": "silentindustries.onmicrosoft.com",
9
    "TenantId": "8320026e-f0c8-4609-ac9e-52b0e2bb6029",
10
    "ClientId": "7be51083-d17e-4916-984e-8567b8137365",
11
    "CallbackPath": "/signin-oidc"
12
  },
6 13
  "AppSettings": {
7 14
    "DatabaseConnection": {
8 15
      "ConnectionString": "Server=localhost;Database=Leuze_Local;User Id=sa;Password=LeuzeDB01;",

Také k dispozici: Unified diff