This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for token storage in auth properties
- Loading branch information
1 parent
9c3abb7
commit 66307f2
Showing
6 changed files
with
449 additions
and
9 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
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,22 @@ | ||
// Copyright (c) Duende Software. All rights reserved. | ||
// See LICENSE in the project root for license information. | ||
|
||
using Microsoft.Extensions.Options; | ||
|
||
namespace Duende.AccessTokenManagement.Tests; | ||
|
||
public class TestOptionsMonitor<TOptions>(TOptions? currentValue = null) : IOptionsMonitor<TOptions> | ||
where TOptions : class, new() | ||
{ | ||
public TOptions CurrentValue { get; set; } = currentValue ?? new(); | ||
|
||
public TOptions Get(string? name) | ||
{ | ||
return CurrentValue; | ||
} | ||
|
||
public IDisposable? OnChange(Action<TOptions, string?> listener) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
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,72 @@ | ||
// Copyright (c) Duende Software. All rights reserved. | ||
// See LICENSE in the project root for license information. | ||
|
||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authentication.Cookies; | ||
|
||
namespace Duende.AccessTokenManagement.Tests; | ||
|
||
public class TestSchemeProvider : IAuthenticationSchemeProvider | ||
{ | ||
public TestSchemeProvider(string signInSchemeName = "testScheme") | ||
{ | ||
DefaultSignInScheme = new AuthenticationScheme(signInSchemeName, signInSchemeName, typeof(CookieAuthenticationHandler)); | ||
} | ||
|
||
public AuthenticationScheme? DefaultSignInScheme { get; set; } | ||
|
||
public Task<AuthenticationScheme?> GetDefaultSignInSchemeAsync() | ||
{ | ||
return Task.FromResult(DefaultSignInScheme); | ||
} | ||
|
||
#region Not Implemented (No tests have needed these yet) | ||
|
||
public void AddScheme(AuthenticationScheme scheme) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<IEnumerable<AuthenticationScheme>> GetAllSchemesAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<AuthenticationScheme?> GetDefaultAuthenticateSchemeAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<AuthenticationScheme?> GetDefaultChallengeSchemeAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<AuthenticationScheme?> GetDefaultForbidSchemeAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
public Task<AuthenticationScheme?> GetDefaultSignOutSchemeAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<IEnumerable<AuthenticationScheme>> GetRequestHandlerSchemesAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Task<AuthenticationScheme?> GetSchemeAsync(string name) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void RemoveScheme(string name) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
#endregion | ||
} |
Oops, something went wrong.