oidc by default aus, oidc Button nur wenn oidc aktiviert, release pipeline

This commit is contained in:
2025-06-22 09:48:12 +02:00
parent 4c764b99f1
commit d9eecaa2d9
4 changed files with 30 additions and 18 deletions

View File

@@ -6,18 +6,26 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Options;
using Watcher.Data;
using Watcher.ViewModels;
namespace Watcher.Controllers;
public class AppSettings
{
public Boolean oidc { get; set; }
}
public class AuthController : Controller
{
private readonly AppDbContext _context;
private readonly AppSettings _settings;
public AuthController(AppDbContext context)
public AuthController(AppDbContext context, IOptions<AppSettings> options)
{
_context = context;
_settings = options.Value;
}
[HttpGet]
@@ -27,6 +35,8 @@ public class AuthController : Controller
{
ReturnUrl = returnUrl
};
ViewBag.oidc = _settings.oidc;
return View(model);
}

View File

@@ -2,6 +2,7 @@
@{
Layout = "~/Views/Shared/_LoginLayout.cshtml";
ViewData["Title"] = "Login";
var oidc = ViewBag.oidc;
}
<style>
@@ -79,9 +80,13 @@
<hr class="my-4" />
<form asp-controller="Auth" asp-action="SignIn" method="get">
<div class="d-grid gap-2">
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
</div>
</form>
@if (ViewBag.oidc)
{
<form asp-controller="Auth" asp-action="SignIn" method="get">
<div class="d-grid gap-2">
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
</div>
</form>
}
</div>

View File

@@ -18,7 +18,7 @@
"Authentication": {
"UseLocal": true,
"PocketIDEnabled": true,
"PocketIDEnabled": false,
"PocketID": {
"Authority": "https://pocketid.triggermeelmo.com",
"ClientId": "629a5f42-ab02-4905-8311-cc7b64165cc0",