Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1using System;
2using Microsoft.AspNetCore.Authentication;
3using Microsoft.Extensions.DependencyInjection;
4using NzbDrone.Core.Authentication;
5
6namespace Radarr.Http.Authentication
7{
8 public static class AuthenticationBuilderExtensions
9 {
10 public static AuthenticationBuilder AddApiKey(this AuthenticationBuilder authenticationBuilder, string name, Action<ApiKeyAuthenticationOptions> options)
11 {
…lines 12–25 unchanged (14 lines)
26 {
27 return authenticationBuilder.AddScheme<AuthenticationSchemeOptions, NoAuthenticationHandler>(name, options => { });
28 }
29
30 public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection services)
31 {
32 return services.AddAuthentication()
33 .AddNone(AuthenticationType.None.ToString())
34 .AddExternal(AuthenticationType.External.ToString())
35 .AddBasic(AuthenticationType.Basic.ToString())
36 .AddCookie(AuthenticationType.Forms.ToString(), options =>
37 {
38 options.Cookie.Name = "RadarrAuth";
39 options.AccessDeniedPath = "/login?loginFailed=true";
40 options.LoginPath = "/login";
41 options.ExpireTimeSpan = TimeSpan.FromDays(7);
42 options.SlidingExpiration = true;
43 options.ReturnUrlParameter = "returnUrl";
44 })
45 .AddApiKey("API", options =>
46 {
47 options.HeaderName = "X-Api-Key";
48 options.QueryName = "apikey";
49 })
50 .AddApiKey("SignalR", options =>
…lines 51–58 unchanged (8 lines)

After

1using System;
2using System.Web;
3using Microsoft.AspNetCore.Authentication;
4using Microsoft.AspNetCore.Authentication.Cookies;
5using Microsoft.Extensions.DependencyInjection;
6using NzbDrone.Core.Authentication;
7using NzbDrone.Core.Configuration;
8
9namespace Radarr.Http.Authentication
10{
11 public static class AuthenticationBuilderExtensions
12 {
13 public static AuthenticationBuilder AddApiKey(this AuthenticationBuilder authenticationBuilder, string name, Action<ApiKeyAuthenticationOptions> options)
…lines 14–28 unchanged (15 lines)
29 {
30 return authenticationBuilder.AddScheme<AuthenticationSchemeOptions, NoAuthenticationHandler>(name, options => { });
31 }
32
33 public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection services)
34 {
35 services.AddOptions<CookieAuthenticationOptions>(AuthenticationType.Forms.ToString())
36 .Configure<IConfigFileProvider>((options, configFileProvider) =>
37 {
38 // Url Encode the cookie name to account for spaces or other invalid characters in the configured instance name
39 var instanceName = HttpUtility.UrlEncode(configFileProvider.InstanceName);
40
41 options.Cookie.Name = $"{instanceName}Auth";
42 options.AccessDeniedPath = "/login?loginFailed=true";
43 options.LoginPath = "/login";
44 options.ExpireTimeSpan = TimeSpan.FromDays(7);
45 options.SlidingExpiration = true;
46 options.ReturnUrlParameter = "returnUrl";
47 });
48
49 return services.AddAuthentication()
50 .AddNone(AuthenticationType.None.ToString())
51 .AddExternal(AuthenticationType.External.ToString())
52 .AddBasic(AuthenticationType.Basic.ToString())
53 .AddCookie(AuthenticationType.Forms.ToString())
54 .AddApiKey("API", options =>
55 {
56 options.HeaderName = "X-Api-Key";
57 options.QueryName = "apikey";
58 })
59 .AddApiKey("SignalR", options =>
…lines 60–67 unchanged (8 lines)

Before

compilation_unit
using_directive
using "using"
identifier "System"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "Microsoft"
. "."
identifier "AspNetCore"
. "."
identifier "Authentication"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "Microsoft"
. "."
identifier "Extensions"
. "."
identifier "DependencyInjection"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "NzbDrone"
. "."
identifier "Core"
. "."
identifier "Authentication"
; ";"
namespace_declaration
namespace "namespace"
qualified_name
qualified_name
identifier "Radarr"
. "."
identifier "Http"
. "."
identifier "Authentication"
declaration_list
{ "{"
class_declaration
modifier
public "public"
modifier
static "static"
class "class"
identifier "AuthenticationBuilderExtensions"
declaration_list
{ "{"
method_declaration (+53 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration
modifier
public "public"
modifier
static "static"
identifier "AuthenticationBuilder"
identifier "AddAppAuthentication"
parameter_list
( "("
parameter
modifier "this"
identifier "IServiceCollection"
identifier "services"
) ")"
block
{ "{"
return_statement
return "return"
invocation_expression
member_access_expression
invocation_expression
member_access_expression
invocation_expression
member_access_expression (+68 nodes collapsed)
argument_list
( "("
argument
invocation_expression
member_access_expression
member_access_expression
identifier "AuthenticationType"
. "."
identifier "Forms"
. "."
identifier "ToString"
argument_list
( "("
) ")"
, ","
argument
lambda_expression
implicit_parameter "options"
=> "=>"
block
{ "{"
expression_statement
assignment_expression
member_access_expression
member_access_expression
identifier "options"
. "."
identifier "Cookie"
. "."
identifier "Name"
= "="
string_literal
" "\""
string_literal_content "RadarrAuth"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "AccessDeniedPath"
= "="
string_literal
" "\""
string_literal_content "/login?loginFailed=true"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "LoginPath"
= "="
string_literal
" "\""
string_literal_content "/login"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "ExpireTimeSpan"
= "="
invocation_expression
member_access_expression
identifier "TimeSpan"
. "."
identifier "FromDays"
argument_list
( "("
argument
integer_literal "7"
) ")"
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "SlidingExpiration"
= "="
boolean_literal
true "true"
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "ReturnUrlParameter"
= "="
string_literal
" "\""
string_literal_content "returnUrl"
" "\""
; ";"
} "}"
) ")"
. "."
identifier "AddApiKey"
argument_list (+40 nodes collapsed)
. "."
identifier "AddApiKey"
argument_list (+40 nodes collapsed)
; ";"
} "}"
} "}"
} "}"

After

compilation_unit
using_directive
using "using"
identifier "System"
; ";"
using_directive
using "using"
qualified_name
identifier "System"
. "."
identifier "Web"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "Microsoft"
. "."
identifier "AspNetCore"
. "."
identifier "Authentication"
; ";"
using_directive
using "using"
qualified_name
qualified_name
qualified_name
identifier "Microsoft"
. "."
identifier "AspNetCore"
. "."
identifier "Authentication"
. "."
identifier "Cookies"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "Microsoft"
. "."
identifier "Extensions"
. "."
identifier "DependencyInjection"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "NzbDrone"
. "."
identifier "Core"
. "."
identifier "Authentication"
; ";"
using_directive
using "using"
qualified_name
qualified_name
identifier "NzbDrone"
. "."
identifier "Core"
. "."
identifier "Configuration"
; ";"
namespace_declaration
namespace "namespace"
qualified_name
qualified_name
identifier "Radarr"
. "."
identifier "Http"
. "."
identifier "Authentication"
declaration_list
{ "{"
class_declaration
modifier
public "public"
modifier
static "static"
class "class"
identifier "AuthenticationBuilderExtensions"
declaration_list
{ "{"
method_declaration (+53 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration (+49 nodes collapsed)
method_declaration
modifier
public "public"
modifier
static "static"
identifier "AuthenticationBuilder"
identifier "AddAppAuthentication"
parameter_list
( "("
parameter
modifier "this"
identifier "IServiceCollection"
identifier "services"
) ")"
block
{ "{"
expression_statement
invocation_expression
member_access_expression
invocation_expression
member_access_expression
identifier "services"
. "."
generic_name
identifier "AddOptions"
type_argument_list
< "<"
identifier "CookieAuthenticationOptions"
> ">"
argument_list
( "("
argument
invocation_expression
member_access_expression
member_access_expression
identifier "AuthenticationType"
. "."
identifier "Forms"
. "."
identifier "ToString"
argument_list
( "("
) ")"
) ")"
. "."
generic_name
identifier "Configure"
type_argument_list
< "<"
identifier "IConfigFileProvider"
> ">"
argument_list
( "("
argument
lambda_expression
parameter_list
( "("
parameter
identifier "options"
, ","
parameter
identifier "configFileProvider"
) ")"
=> "=>"
block
{ "{"
comment "// Url Encode the cookie name to account for spaces or other"...
local_declaration_statement
variable_declaration
implicit_type
var "var"
variable_declarator
identifier "instanceName"
= "="
invocation_expression
member_access_expression
identifier "HttpUtility"
. "."
identifier "UrlEncode"
argument_list
( "("
argument
member_access_expression
identifier "configFileProvider"
. "."
identifier "InstanceName"
) ")"
; ";"
expression_statement
assignment_expression
member_access_expression
member_access_expression
identifier "options"
. "."
identifier "Cookie"
. "."
identifier "Name"
= "="
interpolated_string_expression
interpolation_start "$"
" "\""
interpolation
interpolation_brace "{"
identifier "instanceName"
interpolation_brace "}"
string_content "Auth"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "AccessDeniedPath"
= "="
string_literal
" "\""
string_literal_content "/login?loginFailed=true"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "LoginPath"
= "="
string_literal
" "\""
string_literal_content "/login"
" "\""
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "ExpireTimeSpan"
= "="
invocation_expression
member_access_expression
identifier "TimeSpan"
. "."
identifier "FromDays"
argument_list
( "("
argument
integer_literal "7"
) ")"
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "SlidingExpiration"
= "="
boolean_literal
true "true"
; ";"
expression_statement
assignment_expression
member_access_expression
identifier "options"
. "."
identifier "ReturnUrlParameter"
= "="
string_literal
" "\""
string_literal_content "returnUrl"
" "\""
; ";"
} "}"
) ")"
; ";"
return_statement
return "return"
invocation_expression
member_access_expression
invocation_expression
member_access_expression
invocation_expression
member_access_expression (+68 nodes collapsed)
argument_list
( "("
argument
invocation_expression
member_access_expression
member_access_expression
identifier "AuthenticationType"
. "."
identifier "Forms"
. "."
identifier "ToString"
argument_list
( "("
) ")"
) ")"
. "."
identifier "AddApiKey"
argument_list (+40 nodes collapsed)
. "."
identifier "AddApiKey"
argument_list (+40 nodes collapsed)
; ";"
} "}"
} "}"
} "}"