Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ namespace Microsoft.AspNetCore.Authentication.Certificate;
/// </summary>
public class CertificateAuthenticationOptions : AuthenticationSchemeOptions
{
/// <summary>
/// Initializes a new instance of <see cref="CertificateAuthenticationOptions"/>.
/// </summary>
public CertificateAuthenticationOptions()
{
Events = new CertificateAuthenticationEvents();
}

/// <summary>
/// Value indicating the types of certificates accepted by the authentication middleware.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public JwtBearerOptions()
SecurityTokenValidators = new List<ISecurityTokenValidator> { _defaultHandler };
#pragma warning restore CS0618 // Type or member is obsolete
TokenHandlers = new List<TokenHandler> { _defaultTokenHandler };
Events = new JwtBearerEvents();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate;
/// </summary>
public class NegotiateOptions : AuthenticationSchemeOptions
{
/// <summary>
/// Initializes a new instance of <see cref="NegotiateOptions"/>.
/// </summary>
public NegotiateOptions()
{
Events = new NegotiateEvents();
}

/// <summary>
/// The object provided by the application to process events raised by the negotiate authentication handler.
/// The application may use the existing NegotiateEvents instance and assign delegates only to the events it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ namespace Microsoft.AspNetCore.Authentication.Negotiate;

public class NegotiateHandlerTests
{
[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new NegotiateOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task Anonymous_MissingConnectionFeatures_ThrowsNotSupported()
{
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/BearerTokenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ protected override void RegisterAuth(AuthenticationBuilder services, Action<Bear
{
services.AddBearerToken(configure);
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new BearerTokenOptions();
Assert.NotNull(options.Events);
}
}
6 changes: 6 additions & 0 deletions src/Security/Authentication/test/CertificateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ namespace Microsoft.AspNetCore.Authentication.Certificate.Test;

public class ClientCertificateAuthenticationTests
{
[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new CertificateAuthenticationOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task VerifySchemeDefaults()
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/CookieTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ protected override void RegisterAuth(AuthenticationBuilder services, Action<Cook
services.AddCookie(configure);
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new CookieAuthenticationOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task NormalRequestPassesThrough()
{
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/FacebookTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ protected override void ConfigureDefaults(FacebookOptions o)
o.SignInScheme = "auth1";
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new FacebookOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task ThrowsIfAppIdMissing()
{
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/GoogleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ protected override void ConfigureDefaults(GoogleOptions o)
o.SignInScheme = "auth1";
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new GoogleOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task ChallengeWillTriggerRedirection()
{
Expand Down
11 changes: 5 additions & 6 deletions src/Security/Authentication/test/JwtBearerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ public class JwtBearerTests : SharedAuthenticationTests<JwtBearerOptions>

protected override void RegisterAuth(AuthenticationBuilder services, Action<JwtBearerOptions> configure)
{
services.AddJwtBearer(o =>
{
ConfigureDefaults(o);
configure.Invoke(o);
});
services.AddJwtBearer(configure);
}

private void ConfigureDefaults(JwtBearerOptions o)
[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new JwtBearerOptions();
Assert.NotNull(options.Events);
}

[Fact]
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/MicrosoftAccountTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ protected override void ConfigureDefaults(MicrosoftAccountOptions o)
o.SignInScheme = "auth1";
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new MicrosoftAccountOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task ChallengeWillTriggerApplyRedirectEvent()
{
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/OAuthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ protected override void RegisterAuth(AuthenticationBuilder services, Action<OAut
});
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new OAuthOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task ThrowsIfClientIdMissing()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ public class OpenIdConnectTests
static readonly string nonceDelimiter = ".";
const string DefaultHost = @"https://example.com";

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new OpenIdConnectOptions();
Assert.NotNull(options.Events);
}

/// <summary>
/// Tests RedirectForSignOutContext replaces the OpenIdConnectMesssage correctly.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions src/Security/Authentication/test/TwitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ protected override void ConfigureDefaults(TwitterOptions o)
o.SignInScheme = "auth1";
}

[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new TwitterOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task ChallengeWillTriggerApplyRedirectEvent()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation;

public class WsFederationTest
{
[Fact]
public void EventsPropertyIsInitializedOnConstruction()
{
var options = new WsFederationOptions();
Assert.NotNull(options.Events);
}

[Fact]
public async Task VerifySchemeDefaults()
{
Expand Down
Loading