Skip to content

Instantly share code, notes, and snippets.

public async Task InvokeAsync(HttpContext httpContext)
{
var token = httpContext.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
if (!string.IsNullOrEmpty(token))
{
httpContext.Response.Cookies.Append("jwtCookie", token);
}
await _next(httpContext);
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var accessToken = _httpContextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "DirimOpsManagement")?.Value;
var refreshToken = _httpContextAccessor.HttpContext.User.Claims.FirstOrDefault(x => x.Type == "RefreshToken")?.Value;
if (!string.IsNullOrWhiteSpace(accessToken))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
}
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using WebApplication1.Controllers;
using WebApplication1.Models;
using Moq;
using Xunit;
namespace WebApplication1.Test
{
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: myservice-ingress
namespace: myservice
annotations:
nginx.org/mergeable-ingress-type: "minion"
nginx.org/rewrites: "serviceName=myservice-webapi rewrite=/$2 break"
spec:
ingressClassName: nginx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Mvc.Routing;
public static class RouteManipulator
{
// wwwroot/camera.js
let currentStream = null;
async function openCamera(facingMode) {
if (currentStream) {
currentStream.getTracks().forEach(track => track.stop());
await new Promise(resolve => setTimeout(resolve, 500)); // add 500ms
}
@{
ViewData["Title"] = "Test Page";
}
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>테스트 페이지</title>
<style>
body {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sidebar Test</title>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css' rel='stylesheet'>
<script type='text/javascript' src='#'></script>
<style>
builder.Services.AddControllersWithViews(options =>
{ // Not found in my side, So I comment them
//options.ConfigureInvalidAccessorMessage();
//options.AddStringModelBinderProvider();
//options.AddCustomComplexTypeModelBinderProvider();
//options.Filters.Add(new ServiceFilterAttribute(typeof(BosRequestLimitAttribute)));
//options.Filters.Add(new ServiceFilterAttribute(typeof(FreeTextValidationAttribute)));
options.EnableEndpointRouting = false;
})
.AddRazorRuntimeCompilation()
app.UseHsts();
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors("AllowSpecificOrigin");
app.UseAuthentication();