Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lock user account for a period of time after failed login attempt (#3261
- Loading branch information
Showing
21 changed files
with
695 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/NuGetGallery/Authentication/AuthenticateExternalLoginResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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.Security.Claims; | ||
using NuGetGallery.Authentication.Providers; | ||
|
||
namespace NuGetGallery.Authentication | ||
{ | ||
public class AuthenticateExternalLoginResult | ||
{ | ||
public AuthenticatedUser Authentication { get; set; } | ||
public ClaimsIdentity ExternalIdentity { get; set; } | ||
public Authenticator Authenticator { get; set; } | ||
public Credential Credential { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/NuGetGallery/Authentication/PasswordAuthenticationResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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. | ||
|
||
namespace NuGetGallery.Authentication | ||
{ | ||
public class PasswordAuthenticationResult | ||
{ | ||
public enum AuthenticationResult | ||
{ | ||
AccountLocked, // The account is locked | ||
BadCredentials, // Bad user name or password provided | ||
Success // All good | ||
} | ||
|
||
/// <summary> | ||
/// The authentication status | ||
/// </summary> | ||
public AuthenticationResult Result { get; } | ||
|
||
/// <summary> | ||
/// If the account is locked, this is the period of time until unlock. | ||
/// </summary> | ||
public int LockTimeRemainingMinutes { get; } | ||
|
||
/// <summary> | ||
/// Is authentication was successful, this is the user details. | ||
/// </summary> | ||
public AuthenticatedUser AuthenticatedUser { get; } | ||
|
||
public PasswordAuthenticationResult(AuthenticationResult result, AuthenticatedUser authenticatedUser = null, int lockTimeRemainingMinutes = 0) | ||
{ | ||
Result = result; | ||
LockTimeRemainingMinutes = lockTimeRemainingMinutes; | ||
AuthenticatedUser = authenticatedUser; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.