-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Feature suggestion: Identity Server - multiple valid issuers #5589
Comments
Now, when I look for new "Authorization Code Flow for the Angular UI" - is this maybe solution for "issuer problem" described in this topic? @hikalkan, @maliming? Do I understand correctly this new workflow for Angular app? Does it solve this particular "issuer" problem? |
@hikalkan and @maliming, @ebicoglu I found solution (and is not a hack!) for this. I suggest, that you add two additional parameters (which) in appsettings.json under AuthServer object in HttpApi.Host project (not in IdentityServer project in case of separated IDS). "AuthServer": { "RequireHttpsMetadata" is not related directly, but it would nice to have this also in settings (rather than hardcoded directly in .cs code). So instead of this code in xyzHttpApiModule.cs:
I suggest something like this:
I used different overload for AddIdentityServerAuthentication method. You use the first method (blue underline), but I use the last one (red underline). This is applicable to abp and abp Commercial! Please, let me know if you will do this change in configuration. |
hi @leonkosak I will check it, Thanks. |
[14:26:26 INF] Failed to validate the token. |
options.TokenValidationParameters.ValidateAudience = false; |
hi @leonkosak We should continue to use Maybe we shouldn't add context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "MyProjectName";
options.TokenValidationParameters.ValidIssuers = configuration.GetSection("AuthServer:ValidIssuers").Get<string[]>();
}); "AuthServer": {
"Authority": "https://localhost:44301",
"RequireHttpsMetadata": "true",
"ValidIssuers": [
"https://localhost:44301",
"https://localhost:44302"
]
} |
@maliming, any particular reason for that? |
These codes are useful for specific deployment methods (Docker, reverse proxy,...). If developers find a problem, they should understand the problem and use |
That's true. But a lot of deployments nowadays are at least behind reverse proxy. :) Having "placeholder" in appsettings.json for valid issuers saves time in all aspects (and it's not something so specific like having for instance RabbitMQ part of configuration in appsettings.json). |
Adding this code into the API fixed a massive headache that I was having with trying to implement domain resolved multi-tenancy in my application. The identity server in my application is separated from the API and with this architecture, the valid issuer list is required. This is not currently in the documentation (which is quite sparse for the trouble that I had implementing it!) and even the latest sample released with 4.3 didn't really help as my architecture of Angular with a seperated identity server was not covered. In my opinion, this solution needs to be added to the template and the documentation for multi-tenancy needs to be updated to handle this and also the configuration of SSL certificates for the sub-domains whilst developing. |
@DWCS-Dworrall, yes - I can confirm that this part of code for "AuthServer:ValidIssuers" is crucial and must-have for most of abp-based installations (especially for containerized installations like Docker/Kubernetes). Offtopic: |
I find this issue because I got a exception.
Thanks for DWCS-Dworrall's answer. Added environment:
- AuthServer__Authority=http://auth-server:51511
- AuthServer__ValidIssuers__0=http://auth-server:51511
- AuthServer__ValidIssuers__1=http://127.0.0.1:51511 |
Based on "modern" deployment methods (Docker, reverse proxy,...) there are some challenges how to deal with authentication (especially with "issuer").
For instance: #5125 (comment)
Related posts:
https://leastprivilege.com/2017/10/09/new-in-identityserver4-v2-simplified-configuration-behind-load-balancers-or-reverse-proxies/
https://blog.novacare.no/identity-multiple-valid-issuers-jwt/
Currently in abp (and abp Commercial) is just "Authority" url in appsettings.json configuration file, which is "PublicOrigin" (Issuer URL).
Wouldn't be useful if there would be additional parameter in appsettings.json which would be "PrivateOrigin" (for instance Docker internal URL/IP to Identity Server)? Or maybe comma-separated valid issuers?
Thi "PrivateOrigin" would be empty by default.
With such additional configuration option, this could be additional solution to "loopback" from external IP/URL back to Identity Server in Docker for instance.
Are there any additional security-related concerns if this functionality (configuration) would be implemented?
Thanks for feedback. :)
The text was updated successfully, but these errors were encountered: