Hi,
We are currently working on an update of our aspnet zero based application from version 10.3 to version 12.3 Asp Net Core Angular. At this point of time we get all working except the configuration of OpenId Connect.
The old working setting is:
"OpenId": { "IsEnabled": "true", "ClientId": "xxxx", "ClientSecret": "xxxx", "LoginUrl": "https://login.microsoftonline.com/xxx/oauth2/v2.0/authorize", "ValidateIssuer": "true", "ClaimsMapping": [ { "claim": "unique_name", "key": "preferred_username" }, { "claim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "key": "http://schemas.microsoft.com/identity/claims/objectidentifier" } ] },
After upgrading the code we not are able to log in anymore.
What I am able to see is that the login.service.ts calls the oauthService to retrieve provider informations GetExternalAuthenticationProviders ( { "name": "OpenIdConnect", "clientId": "xxx", "additionalParams": { "Authority": "https://login.microsoftonline.com/xxx/v2.0", "LoginUrl": "https://login.microsoftonline.com/xxx/oauth2/v2.0/authorize", "ValidateIssuer": "True", "ResponseType": "" } } ). Next step is passing the information to the oauthService via configure method and retrieveing the claims. And the step to retrieve the claims fails with an null object.
login.service.ts:
public openIdConnectLoginCallback(resp) { this.initExternalLoginProviders(() => { let openIdProvider = _filter(this.externalLoginProviders, { name: 'OpenIdConnect', })[0]; console.log("Provider ", openIdProvider); let authConfig = this.getOpenIdConnectConfig(openIdProvider); console.log("Config ", authConfig); this.oauthService.configure(authConfig); this.spinnerService.show();
** let claims = this.oauthService.getIdentityClaims();**
claims is null. -> service-proxies.ts:42047 ERROR TypeError: Cannot read properties of null (reading 'sub')
Do you have some informations what has changed between this versions, or what I currently do wrong?
Regards,
Frank
Please answer the following questions before submitting an issue.
What is your product? ->10.3.0
What is your product type (Angular or MVC)? -> Angular
What is product framework type (.net framework or .net core)? -> net (Core) 5.0
One Solution
Dear Sirs and Madams.
I have downloaded the newest version of aspnetzero with an Angular net5.0 project. While creating the project there is a difference to your documentation. Before I'm going tzo implement can you please check the documentation vs. the created project structure. In your documentation overview you describe that there are two web (console) application ((....Web.Host and ....Web.Public) in the downloaded solution(Single Solution) i can find three applications (....Web.Core, ....Web.Host, ....Web.Public). You also describe that the web.host shall not contain any web content (e.g.: css, js and so on). But that is the case in the currently downloaded project. Can you confirm that the created solution is the right one? Or the documentation is up to date?
Documentation:
Created Solution:
Best Regards
Frank Jablonsky