상상코딩 입니다. ^^;

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

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

//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 ))*

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




Posted by woojja

댓글을 달아 주세요

2020. 4. 16. 10:34

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 ))*

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




Posted by woojja

댓글을 달아 주세요

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 ))*

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




Posted by woojja

댓글을 달아 주세요

  1. 빅샤크3 젤리몬스터 대소동 다시보기 수정/삭제 댓글쓰기 댓글주소
    2020.08.27 11:35

    관리자의 승인을 기다리고 있는 댓글입니다

Controller 에 RoutePrefix Attribute 를 설정해도 작동하지 않는 경우가 있다.

이는 한가지를 설정해주지 않아서 일텐데...

 

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            
            routes.MapMvcAttributeRoutes();
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }

 

위와 같이 routes.MapMvcAttributeRoutes(); 를 추가해준다.

 

위 구문을 추가해주면 각 Controller 의 노출된 Action Method 에 기본적으로 Route Attribute 를 추가해주어야 한다.

 

 

 

 

행복한 고수되셔요.

 

woojja ))*

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




Posted by woojja

댓글을 달아 주세요

ls -l 명령어는 사용가능하지만 ll 명령어는 찾을 수 없다는 메세지를 뱉을 때는...

 

sudo nano ~/.bashrc 를 입력하여 

주석처리되어 있는 아래 구문의 주석을 제거해준다.

#alias ll='ls -l' 

#alias la='ls -A'

#alias l='ls -CF'

 

이보다 먼저

sudo nano .bash_profile

를 열어

export PATH=%PATH:/bin:/usr/local/bin:/usr/bin

가 추가되어 있는지 확인해 보는 것도 좋다.

 

 

행복한 고수되셔요.

woojja ))*

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




'ETC > Raspberry Pi' 카테고리의 다른 글

[Raspberry Pi] ll, la 명령어 활성하는 방법  (0) 2020.03.12
[Raspberry Pi] WiFi 설정  (0) 2020.03.11
[Raspberry Pi] Raspberry pi SSH 연결  (0) 2020.03.11
Posted by woojja

댓글을 달아 주세요