oidc by default aus, oidc Button nur wenn oidc aktiviert, release pipeline
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Deploy
|
name: Development Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -31,16 +31,13 @@ jobs:
|
|||||||
run: dotnet publish -c Release -o out
|
run: dotnet publish -c Release -o out
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: docker build -t watcher:latest .
|
run: docker build -t watcher:v0.1.0 .
|
||||||
|
|
||||||
- name: Docker Login
|
- name: Login to Gitea Container Registry
|
||||||
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login git.triggermeelmo.com -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||||
|
|
||||||
- name: Push Docker Image
|
- name: Tag image
|
||||||
run: docker push watcher:latest
|
run: docker tag watcher:v0.1.0 git.triggermeelmo.com/daniel-hbn/watcher/watcher:v0.1.0
|
||||||
|
|
||||||
- name: Deploy (Beispiel - via SSH)
|
- name: Push image
|
||||||
run: |
|
run: docker push git.triggermeelmo.com/daniel-hbn/watcher/watcher:v0.1.0
|
||||||
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 }}
|
|
@@ -6,18 +6,26 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
using Watcher.Data;
|
using Watcher.Data;
|
||||||
using Watcher.ViewModels;
|
using Watcher.ViewModels;
|
||||||
|
|
||||||
namespace Watcher.Controllers;
|
namespace Watcher.Controllers;
|
||||||
|
|
||||||
|
public class AppSettings
|
||||||
|
{
|
||||||
|
public Boolean oidc { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class AuthController : Controller
|
public class AuthController : Controller
|
||||||
{
|
{
|
||||||
private readonly AppDbContext _context;
|
private readonly AppDbContext _context;
|
||||||
|
private readonly AppSettings _settings;
|
||||||
|
|
||||||
public AuthController(AppDbContext context)
|
public AuthController(AppDbContext context, IOptions<AppSettings> options)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
|
_settings = options.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@@ -27,6 +35,8 @@ public class AuthController : Controller
|
|||||||
{
|
{
|
||||||
ReturnUrl = returnUrl
|
ReturnUrl = returnUrl
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ViewBag.oidc = _settings.oidc;
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
@{
|
@{
|
||||||
Layout = "~/Views/Shared/_LoginLayout.cshtml";
|
Layout = "~/Views/Shared/_LoginLayout.cshtml";
|
||||||
ViewData["Title"] = "Login";
|
ViewData["Title"] = "Login";
|
||||||
|
var oidc = ViewBag.oidc;
|
||||||
}
|
}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -79,9 +80,13 @@
|
|||||||
|
|
||||||
<hr class="my-4" />
|
<hr class="my-4" />
|
||||||
|
|
||||||
<form asp-controller="Auth" asp-action="SignIn" method="get">
|
@if (ViewBag.oidc)
|
||||||
<div class="d-grid gap-2">
|
{
|
||||||
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
|
<form asp-controller="Auth" asp-action="SignIn" method="get">
|
||||||
</div>
|
<div class="d-grid gap-2">
|
||||||
</form>
|
<button type="submit" class="btn btn-pocketid">Mit PocketID anmelden</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
"Authentication": {
|
"Authentication": {
|
||||||
"UseLocal": true,
|
"UseLocal": true,
|
||||||
"PocketIDEnabled": true,
|
"PocketIDEnabled": false,
|
||||||
"PocketID": {
|
"PocketID": {
|
||||||
"Authority": "https://pocketid.triggermeelmo.com",
|
"Authority": "https://pocketid.triggermeelmo.com",
|
||||||
"ClientId": "629a5f42-ab02-4905-8311-cc7b64165cc0",
|
"ClientId": "629a5f42-ab02-4905-8311-cc7b64165cc0",
|
||||||
|
Reference in New Issue
Block a user