-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2460 from domaindrivendev/make-auth-infer-opt-in
Make auth infer opt in
- Loading branch information
Showing
5 changed files
with
156 additions
and
130 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
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
47 changes: 47 additions & 0 deletions
47
test/Swashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/FakeAuthenticationSchemeProvider.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,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Authentication; | ||
|
||
namespace Swashbuckle.AspNetCore.SwaggerGen.Test | ||
{ | ||
public class FakeAuthenticationSchemeProvider : IAuthenticationSchemeProvider | ||
{ | ||
private readonly IEnumerable<AuthenticationScheme> _authenticationSchemes; | ||
|
||
public FakeAuthenticationSchemeProvider(IEnumerable<AuthenticationScheme> authenticationSchemes) | ||
{ | ||
_authenticationSchemes = authenticationSchemes; | ||
} | ||
|
||
public void AddScheme(AuthenticationScheme scheme) | ||
=> throw new NotImplementedException(); | ||
public Task<IEnumerable<AuthenticationScheme>> GetAllSchemesAsync() | ||
=> Task.FromResult(_authenticationSchemes); | ||
|
||
public Task<AuthenticationScheme> GetDefaultAuthenticateSchemeAsync() | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public Task<AuthenticationScheme> GetDefaultChallengeSchemeAsync() | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public Task<AuthenticationScheme> GetDefaultForbidSchemeAsync() | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public Task<AuthenticationScheme> GetDefaultSignInSchemeAsync() | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public Task<AuthenticationScheme> GetDefaultSignOutSchemeAsync() | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public Task<IEnumerable<AuthenticationScheme>> GetRequestHandlerSchemesAsync() | ||
=> throw new NotImplementedException(); | ||
|
||
public Task<AuthenticationScheme> GetSchemeAsync(string name) | ||
=> Task.FromResult(_authenticationSchemes.First()); | ||
|
||
public void RemoveScheme(string name) | ||
=> throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.