-
-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per Tenant JWTBearer Options failed with authentication #827
Comments
I also experienced the same issue. It was resolved by specifying the scheme name during
|
Thanks, But I tried to add the JwtBearerDefaults.AuthenticationScheme as you suggested, still the authorization fails. |
Hi, do you mind posting a link to a repository with a basic project that reproduces the problem? |
I got it fixed @AndrewTriesToCode . Actually @aswin-ingenuous suggestion works perfect. This is what I missed. Also, Removing the line .WithRemoteAuthenticationCallbackStrategy() hasn't made any impact. Somehow, when I tried it yesterday missed to keep the middleware in right orders, So I got the same error. But now I tried this fix with fresh application, and everything works as expected. Thank you guys for the valuable solution. |
[heart] Aswin Trisnadi reacted to your message:
…________________________________
From: KarthikEK20 ***@***.***>
Sent: Thursday, May 16, 2024 2:01:38 PM
To: Finbuckle/Finbuckle.MultiTenant ***@***.***>
Cc: Aswin Trisnadi ***@***.***>; Mention ***@***.***>
Subject: Re: [Finbuckle/Finbuckle.MultiTenant] Per Tenant JWTBearer Options failed with authentication (Issue #827)
I got it fixed @AndrewTriesToCode<https://github.com/AndrewTriesToCode> . Actually @aswin-ingenuous<https://github.com/aswin-ingenuous> suggestion works perfect. This is what I missed.
Somehow, when I tried it yesterday missed to keep the middleware in right orders, So I got the same error. But now I tried this fix with fresh application, and everything works as expected. Thank you guys for the valuable solution.
—
Reply to this email directly, view it on GitHub<#827 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AT3ICOLZ7A4HTE2ZB6R3F5DZCS34FAVCNFSM6AAAAABHVPLYA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVGMZTKNRXGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I'm trying to use the latest version 7.0.1. of the Finbuckle to resolve multitenant and to authorize per tenant basis. Hence, I need to set JWTBearerOptions that is Authority based on tenant-resolved domain URL. I have followed doc, and some older samples,
https://www.finbuckle.com/MultiTenant/Docs/Options
#303
Both have details on how to do it, but if I follow the same, it doesn't work as expected. The problem I'm facing is, that I can see the JWTBearerOption set per tenant by using the "builder.Services.ConfigurePerTenant" line, but still, the authorisation fails because of authority don't have any value.
Here is the example code I followed.
// Configure Services
services.AddHttpContextAccessor();
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer();
// Configure Middleware
//Note - I tried to position the UseMultiTenant() middleware before Use Authentication line, still no use.
If I tried without "PerTenantOption", the authorisation works. Below is the service part code.
// Configure Services
services.AddHttpContextAccessor();
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = "https://mydomain.com/";
options.Audience = "API"; // API Resource Name
}););
So, changing the JWTBearerOptions using "services.ConfigurePerTenant<JwtBearerOptions, TenantInfo>" is something irrelevant with actual JWTBearerOptions? Could you please explain what I'm missing?
Thanks in advance.
The text was updated successfully, but these errors were encountered: