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

@@ -1,4 +1,4 @@
name: Build and Deploy
name: Development Build
on:
push:
@@ -31,16 +31,13 @@ jobs:
run: dotnet publish -c Release -o out
- name: Build Docker Image
run: docker build -t watcher:latest .
run: docker build -t watcher:v0.1.0 .
- name: Docker Login
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- name: Login to Gitea Container Registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login git.triggermeelmo.com -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push Docker Image
run: docker push watcher:latest
- name: Tag image
run: docker tag watcher:v0.1.0 git.triggermeelmo.com/daniel-hbn/watcher/watcher:v0.1.0
- name: Deploy (Beispiel - via SSH)
run: |
ssh daniel-hbn@git.triggermeelmo.com "docker pull deine-app:latest && docker stop watcher || true && docker rm watcher || true && docker run -d --name watcher -p 5000:5000 deine-app:latest"
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Push image
run: docker push git.triggermeelmo.com/daniel-hbn/watcher/watcher:v0.1.0

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",