deploying the blogs
This commit is contained in:
parent
4398715004
commit
86c268eebd
9 changed files with 52 additions and 54 deletions
|
|
@ -1,16 +1,16 @@
|
|||
<ContentPage xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="PostIt.Views.HomePage"
|
||||
Header="Home">
|
||||
<StackPanel HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="12">
|
||||
<TextBlock Text="Welcome to the Home Page"
|
||||
FontSize="22"
|
||||
FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center"/>
|
||||
<Button Content="Login"
|
||||
Click="OnLoginClick"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="PostIt.Views.HomePage"
|
||||
Header="Home">
|
||||
<StackPanel HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="12">
|
||||
<TextBlock Text="Welcome to the Home Page"
|
||||
FontSize="22"
|
||||
FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center"/>
|
||||
<Button Content="Login"
|
||||
Click="OnLoginClick"
|
||||
HorizontalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</ContentPage>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ internal class Program
|
|||
{
|
||||
policy
|
||||
.RequireAuthenticatedUser()
|
||||
.RequireClaim(JwtClaimTypes.Scope, new string[] { "com" });
|
||||
.RequireClaim(JwtClaimTypes.Scope, new string[] { "api" });
|
||||
});
|
||||
})
|
||||
.AddYavscCors(builder.Configuration)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ using Yavsc.Interface;
|
|||
using Yavsc.Models;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
namespace Yavsc.Blogs;
|
||||
|
||||
internal class Program
|
||||
|
|
@ -32,62 +33,58 @@ internal class Program
|
|||
|
||||
var services = builder.Services;
|
||||
|
||||
// builder.Services.AddDistributedMemoryCache();
|
||||
|
||||
// accepts any access token issued by identity server
|
||||
// adds an authorization policy for scope 'scope1'
|
||||
|
||||
services
|
||||
// MvcBuilder
|
||||
builder.Services
|
||||
.AddAuthorization(options =>
|
||||
{
|
||||
options.AddPolicy("BlogScope", policy =>
|
||||
{
|
||||
policy
|
||||
.RequireAuthenticatedUser()
|
||||
.RequireClaim(JwtClaimTypes.Scope, new string[] { "blogs" });
|
||||
.RequireClaim(JwtClaimTypes.Scope, new string[] { "blog" });
|
||||
});
|
||||
})
|
||||
.AddYavscCors(builder.Configuration)
|
||||
.AddControllers();
|
||||
|
||||
// accepts any access token issued by identity server
|
||||
// AuthenticationBuilder
|
||||
services.AddAuthentication("Bearer")
|
||||
.AddYavscJwtBearer(builder.Configuration);
|
||||
|
||||
// DbContextBuilder
|
||||
services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString(YavscConstants.YavscConnectionStringName)));
|
||||
|
||||
services.AddTransient<ITrueEmailSender, MailSender>()
|
||||
.AddTransient<IBillingService, BillingService>()
|
||||
.AddTransient<ICalendarManager, CalendarManager>();
|
||||
services.AddTransient<IFileSystemAuthManager, FileSystemAuthManager>();
|
||||
services.AddTransient<BlogSpotService>();
|
||||
services.AddScoped<IAuthorizationHandler, PermissionHandler>();
|
||||
|
||||
services.AddLocalization(options =>
|
||||
// other services
|
||||
services
|
||||
.AddTransient<ITrueEmailSender, MailSender>()
|
||||
.AddTransient<IEmailSender<ApplicationUser>, MailSender>()
|
||||
.AddTransient<IBillingService, BillingService>()
|
||||
.AddTransient<ICalendarManager, CalendarManager>()
|
||||
.AddTransient<IFileSystemAuthManager, FileSystemAuthManager>()
|
||||
.AddTransient<BlogSpotService>()
|
||||
.AddScoped<IAuthorizationHandler, PermissionHandler>()
|
||||
.AddLocalization(options =>
|
||||
{
|
||||
options.ResourcesPath = "Resources";
|
||||
});
|
||||
services.AddDistributedMemoryCache();
|
||||
|
||||
services.AddSession(options =>
|
||||
})
|
||||
.AddDistributedMemoryCache()
|
||||
.AddSession(options =>
|
||||
{
|
||||
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
||||
options.Cookie.HttpOnly = true;
|
||||
options.Cookie.IsEssential = false;
|
||||
});
|
||||
|
||||
services.Configure<RequestLocalizationOptions>(options =>
|
||||
}).Configure<RequestLocalizationOptions>(options =>
|
||||
{
|
||||
var supportedCultures = new[] { "fr", "en", "pt" };
|
||||
options.SetDefaultCulture(supportedCultures[0])
|
||||
.AddSupportedCultures(supportedCultures)
|
||||
.AddSupportedUICultures(supportedCultures);
|
||||
});
|
||||
|
||||
|
||||
// App startup
|
||||
using (var app = builder.Build())
|
||||
{
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
|
|
@ -97,13 +94,13 @@ internal class Program
|
|||
.UseAuthorization()
|
||||
.UseCors("default")
|
||||
;
|
||||
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("blog");
|
||||
|
||||
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("blog");
|
||||
|
||||
app.MapGet("/identity", (HttpContext context) =>
|
||||
new JsonResult(context?.User?.Claims.Select(c => new { c.Type, c.Value }))
|
||||
);
|
||||
|
||||
// app.UseSession();
|
||||
app.UseSession();
|
||||
await app.RunAsync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<ItemGroup>
|
||||
<PackageVersion Include="AsciiDocSharp" Version="0.2.0" />
|
||||
<PackageVersion Include="AsciiDocSharp.Converters.Html" Version="0.2.0" />
|
||||
<PackageVersion Include="Google.Apis.Compute.v1" Version="1.75.0.4167" />
|
||||
<PackageVersion Include="Google.Apis.Compute.v1" Version="1.74.0.4138" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.AspNetIdentity" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.EntityFramework.Storage" Version="8.0.5-preview-net9" />
|
||||
<PackageVersion Include="HigginsSoft.IdentityServer8.Security" Version="8.0.5-preview-net9" />
|
||||
|
|
@ -17,8 +17,8 @@
|
|||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="10.0.9" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.SignalR" Version="1.2.11" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.9" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.2.1" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.2.2" />
|
||||
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="10.0.9" />
|
||||
<PackageVersion Include="YamlDotNet" Version="18.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,7 @@
|
|||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
using Google.Apis.Auth.OAuth2;
|
||||
|
|
@ -32,7 +29,6 @@ using Google.Apis.Util.Store;
|
|||
using Google.Apis.Auth.OAuth2.Responses;
|
||||
using Google.Apis.Util;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Calendar;
|
||||
using Yavsc.Services;
|
||||
using Yavsc.Server.Helpers;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
|
|
|||
|
|
@ -17,4 +17,4 @@
|
|||
<PackageVersion Include="pazof.rules" Version="1.1.3" />
|
||||
<PackageVersion Include="RazorEngine.NetCore" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using Google.Apis.Calendar.v3.Data;
|
||||
|
||||
namespace Yavsc.Services
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue