상상코딩 입니다. ^^;

이렇게 하면 되지 않을까 하는...

지금 블로그에만 들어와 있는 상황인지라... 

//Startup class 의 ConfigureServices method 에 다음을 추가합니다.
services.AddHttpContextAccessor();
// WoojjaExcludeAuthFilter 라는 Custom Attribute 를 생성합니다.
public class WoojjaExcludeAuthFilter : AuthorizeAttribute, IAuthorizationFilter
{
    public WoojjaAuthFilter(params string[] roles)
    {
        ProtectedRoles = roles;
    }

    public string[] ProtectedRoles { get; }

    public void OnAuthorization(AuthorizationFilterContext context)
    {
	//container 로부터 IHttpContextAccessor haccess 를 Resolve
        var haccess = context.HttpContext.RequestServices.GetRequiredService<IHttpContextAccessor>();
	ClaimsPrincipal cp = hcontext.User;

/*
	// 또는 WebApi 에서 Claim 을 조회.
        using var httpClient = httpClientFactory.CreateClient();

        var resp = await httpClient.GetAsync("https://woojja.com/API/GetAccountClaims/woojja");
        ProtectedRoles = await resp.Content.ReadAsStringAsync();
*/

	for(int i = 0: i < ProtectedRoles.Count: i++){
		if(cp.Claims.Where(c => c.Type == jwtClaim.ToString()).Count > 0){			
			context.Result = new UnauthorizedResult();
		}
	}
    }
}

그리고 Action Result 에 적용합니다. 

[Authorize(Roles = "Administrators"]
[WoojjaExcludeAuthFilter("Sales","HRM")]
public async Task<IActionResult> Index()

조만간 적용해 보고 다시 글을 올리겠습니다. ^^;;;

 

행복한 고수되셔요...

 

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

VisualStudio 오류를 확인하던 중 ASCII 값에 대한 내용을 기록으로 남깁니다. ^^

 

System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindUsages.DefinitionItem.Create(ImmutableArray`1 tags, ImmutableArray`1 displayParts, ImmutableArray`1 sourceSpans, ImmutableArray`1 nameDisplayParts, ImmutableDictionary`2 properties, Boolean displayIfNoReferences)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.FindUsages.DefinitionItem.Create(ImmutableArray`1 tags, ImmutableArray`1 displayParts, ImmutableArray`1 sourceSpans, ImmutableArray`1 nameDisplayParts, Boolean displayIfNoReferences)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.GoToDefinition.NamedDefinitionItemExtensions.TryGetNavigableDefinitionItem(NamedDefinitionItem namedDefinition, Project currentProject, IFilePathDefinitionItemProvider filePathDefinitionItemProvider, JoinableTaskContext joinableTaskContext, DefinitionItem&amp; definitionItem)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.TypeScript.Features.GoToDefinition.TypeScriptGoToSymbolService.&lt;GetSymbolsAsync&gt;d__4.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Editor.NavigableSymbols.NavigableSymbolService.NavigableSymbolSource.&lt;GetNavigableSymbolAsync&gt;d__5.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.&lt;QueryNavigableSymbolAsync&gt;d__35.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.&lt;SetMouseCursorAndNavigableSpanHelperAsync&gt;d__33.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.&lt;SetMouseCursorAndNavigableSpanHelperAsync&gt;d__33.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.&lt;&gt;c__DisplayClass32_0.&lt;&lt;SetMouseCursorAndNavigableSpanAsync&gt;b__0&gt;d.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Threading.JoinableTask.&lt;JoinAsync&gt;d__78.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Threading.JoinableTask`1.&lt;JoinAsync&gt;d__3.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.&lt;SetMouseCursorAndNavigableSpanAsync&gt;d__32.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.&lt;CallExtensionPointAsync&gt;d__32.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
더보기
System.NullReferenceException: Object reference not set to an instance of an object.    at Microsoft.CodeAnalysis.FindUsages.DefinitionItem.Create(ImmutableArray`1 tags, ImmutableArray`1 displayParts, ImmutableArray`1 sourceSpans, ImmutableArray`1 nameDisplayParts, ImmutableDictionary`2 properties, Boolean displayIfNoReferences)    at Microsoft.CodeAnalysis.FindUsages.DefinitionItem.Create(ImmutableArray`1 tags, ImmutableArray`1 displayParts, ImmutableArray`1 sourceSpans, ImmutableArray`1 nameDisplayParts, Boolean displayIfNoReferences)    at Microsoft.CodeAnalysis.Editor.TypeScript.Features.GoToDefinition.NamedDefinitionItemExtensions.TryGetNavigableDefinitionItem(NamedDefinitionItem namedDefinition, Project currentProject, IFilePathDefinitionItemProvider filePathDefinitionItemProvider, JoinableTaskContext joinableTaskContext, DefinitionItem& definitionItem)    at Microsoft.CodeAnalysis.Editor.TypeScript.Features.GoToDefinition.TypeScriptGoToSymbolService.<GetSymbolsAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.CodeAnalysis.Editor.NavigableSymbols.NavigableSymbolService.NavigableSymbolSource.<GetNavigableSymbolAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.<QueryNavigableSymbolAsync>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.<SetMouseCursorAndNavigableSpanHelperAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.<SetMouseCursorAndNavigableSpanHelperAsync>d__33.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.<>c__DisplayClass32_0.<<SetMouseCursorAndNavigableSpanAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__78.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Threading.JoinableTask`1.<JoinAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Language.Intellisense.Implementation.GoToDefMouseHandler.<SetMouseCursorAndNavigableSpanAsync>d__32.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)    at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.<CallExtensionPointAsync>d__32.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

 

 

 

https://www.facebook.com/groups/MHVB.Net/permalink/1679882212162998/

 

보안 확인 필요

메뉴를 열려면 alt + / 키 조합을 누르세요

www.facebook.com

 

행복한 고수되셔요.

 

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

'ETC' 카테고리의 다른 글

[ETC] Virtual Location  (0) 2021.10.06
[ETC] Paypal 개인결제 링크 만들기  (0) 2021.09.28
[ETC] File Signatures  (0) 2017.10.12
[ETC] YouTube image Size  (0) 2016.04.06
[ETC] LG UPlus 결제모듈 연동을 위한 서버설정.  (0) 2014.10.08

asp.net mvc5 에서 ES5 Setting 하는 방법에 대해 알아봤습니다.

 

다음과 같은 글이 있어 공유합니다.

 

https://sung.codes/blog/2017/05/22/setting-es6-environment-asp-net-mvc-5/

 

Setting up an ES6 Environment for ASP.NET MVC 5

UPDATE : October 13th, 2018 Following post uses Babel 7 & Webpack 4. https://sung.codes/blog/2018/10/13/setting-up-a-react-environment-for…

sung.codes

 

 

행복한 고수되십시오.

 

woojja ))*

]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]

반응형

+ Recent posts