Skip to content

Commit 485caaa

Browse files
Add TODO note related to ValidatorsFactory lifetime
1 parent c7cb661 commit 485caaa

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/MakingSense.AspNetCore.Authentication.SimpleToken/SimpleTokenAppBuilderExtensions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ public static IApplicationBuilder UseSimpleTokenAuthentication(this IApplication
3838

3939
if (options.SecurityTokenValidatorsFactory == null)
4040
{
41+
// TODO: fix it because it is using app services, and it should use scope services,
42+
// a work around could be:
43+
// ```
44+
// SecurityTokenValidatorsFactory = () =>
45+
// {
46+
// var context = app.ApplicationServices.GetService<IHttpContextAccessor>().HttpContext;
47+
// return context.RequestServices.GetServices<ISecurityTokenValidator>();
48+
// }
49+
// ```
4150
options.SecurityTokenValidatorsFactory = () => app.ApplicationServices.GetServices<ISecurityTokenValidator>();
4251
}
4352

0 commit comments

Comments
 (0)