Repository navigation
Expand file tree
/
Copy pathBaseContext.cs
More file actions
65 lines (57 loc) · 1.97 KB
/
Copy pathBaseContext.cs
File metadata and controls
65 lines (57 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Authentication
{
/// <summary>
/// Base class used by other context classes.
/// </summary>
public abstract class BaseContext<TOptions> where TOptions : AuthenticationSchemeOptions
{
/// <summary>
/// Constructor.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="scheme">The authentication scheme.</param>
/// <param name="options">The authentication options associated with the scheme.</param>
protected BaseContext(HttpContext context, AuthenticationScheme scheme, TOptions options)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
if (scheme == null)
{
throw new ArgumentNullException(nameof(scheme));
}
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
HttpContext = context;
Scheme = scheme;
Options = options;
}
/// <summary>
/// The authentication scheme.
/// </summary>
public AuthenticationScheme Scheme { get; }
/// <summary>
/// Gets the authentication options associated with the scheme.
/// </summary>
public TOptions Options { get; }
/// <summary>
/// The context.
/// </summary>
public HttpContext HttpContext { get; }
/// <summary>
/// The request.
/// </summary>
public HttpRequest Request => HttpContext.Request;
/// <summary>
/// The response.
/// </summary>
public HttpResponse Response => HttpContext.Response;
}
}