You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background: I have an API where the endpoints have a specific authentication schema specified via the Authorize attribute, e.g. [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] because the project supports multiple different auth schemas.
Unfortunately, that means the built-in AuthenticationStub in Alba doesn't work, since it replaces the existing schemas with the "Test" schema.
The workaround I ended up with is the following type, which you may want to include in Alba, or you may want to do something else that achieves the same goal:
It works much like Alba's AuthenticationStub, you can add claims to it, etc., the difference is that you specify which schema the stub should replace, so now you can have it replace a specific schema, e.g. new AuthenticationSchemaStub(JwtBearerDefaults.AuthenticationScheme).
Background: I have an API where the endpoints have a specific authentication schema specified via the
Authorize
attribute, e.g.[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
because the project supports multiple different auth schemas.Unfortunately, that means the built-in
AuthenticationStub
in Alba doesn't work, since it replaces the existing schemas with the "Test" schema.The workaround I ended up with is the following type, which you may want to include in Alba, or you may want to do something else that achieves the same goal:
It works much like Alba's
AuthenticationStub
, you can add claims to it, etc., the difference is that you specify which schema the stub should replace, so now you can have it replace a specific schema, e.g.new AuthenticationSchemaStub(JwtBearerDefaults.AuthenticationScheme)
.Related to #135.
The text was updated successfully, but these errors were encountered: