File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed
src/Server/src/AspNet/Security Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -30,32 +30,38 @@ public async Task InvokeAsync(HttpContext context)
3030
3131 return ;
3232 }
33- else
33+
34+ if ( context . Request . Path . StartsWithSegments ( "/api" )
35+ || context . Request . Path . StartsWithSegments ( "/graphql" )
36+ || context . Request . Path . StartsWithSegments ( "/signalR" )
37+ || context . Request . Path . StartsWithSegments ( "/error" ) )
3438 {
35- if ( context . Request . Path . StartsWithSegments ( "/api" )
36- || context . Request . Path . StartsWithSegments ( "/graphql" )
37- || context . Request . Path . StartsWithSegments ( "/signalR" )
38- || context . Request . Path . StartsWithSegments ( "/error" ) )
39+ if ( HasIdOpsRole ( context ) )
3940 {
40- if ( HasIdOpsRole ( context ) )
41- {
42- await _next ( context ) ;
43- }
44- else
45- {
46- context . Response . StatusCode = 403 ;
47- await context . Response . WriteAsync ( "Access denied!" ) ;
48- }
41+ await _next ( context ) ;
4942 }
50- else if ( ! context . User . Identity . IsAuthenticated )
43+ else
44+ {
45+ context . Response . StatusCode = 403 ;
46+ await context . Response . WriteAsync ( "Access denied!" ) ;
47+ }
48+ }
49+ else if ( ! context . User . Identity . IsAuthenticated )
50+ {
51+ if ( context . Request . Path == "/" )
5152 {
5253 await context . ChallengeAsync ( ) ;
5354 }
5455 else
5556 {
56- await _next ( context ) ;
57+ context . Response . StatusCode = 403 ;
58+ await context . Response . WriteAsync ( "Access denied!" ) ;
5759 }
5860 }
61+ else
62+ {
63+ await _next ( context ) ;
64+ }
5965 }
6066
6167 private bool HasIdOpsRole ( HttpContext context )
You can’t perform that action at this time.
0 commit comments