abp icon indicating copy to clipboard operation
abp copied to clipboard

IdentityServer CurrentUser is null

Open cocosip opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

Upgrade ABP from 7.2.2 to 8.0.0 , get api /api/abp/application-configuration current user is null

"currentUser": {
		"isAuthenticated": false,
		"id": null,
		"tenantId": null,
		"impersonatorUserId": null,
		"impersonatorTenantId": null,
		"impersonatorUserName": null,
		"impersonatorTenantName": null,
		"userName": "admin",
		"name": null,
		"surName": null,
		"email": null,
		"emailVerified": false,
		"phoneNumber": null,
		"phoneNumberVerified": false,
		"roles": []
	},

Reproduction Steps

No response

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

8.0.0-rc.1~8.0.0

User Interface

Common (Default)

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

cocosip avatar Dec 22 '23 07:12 cocosip

Try print claim type

   var claims = _currentPrincipalAccessor.Principal.Claims.ToList();
   foreach (var claim in claims)
   {
       Logger.LogInformation("Type:{Type},Value:{Value}", claim.Type, claim.Value);
   }

7.2.2 Claims claimType老

8.0.0 Claims claimType新

cocosip avatar Dec 22 '23 09:12 cocosip

Facing the same issue in on 7.4.1

<TargetFramework>net7.0</TargetFramework>

BirajMainali avatar Dec 22 '23 10:12 BirajMainali

Facing the same issue in on 7.4.1


<TargetFramework>net7.0</TargetFramework>



I also encountered it. How to solve it?

XavierRong avatar Jan 06 '24 09:01 XavierRong

I also encountered it. How to solve it?

myall200 avatar Jan 17 '24 00:01 myall200

I have the same problem. ABP version 8.0.5, net8.0. I noticed that this depends on the Microsoft.AspNetCore.Authentication.JwtBearer package. If you use 7.0.17 everything works as before, if 8.0.3 then the CurrentUser is empty.

myn1ckname avatar Mar 25 '24 09:03 myn1ckname

See https://github.com/abpframework/abp/issues/18895#issuecomment-1993588224

maliming avatar Mar 25 '24 09:03 maliming

Hello @maliming this solution you mentioned here works fine If I am using EfCore For MSSQL but it still return

"currentUser": {
		"isAuthenticated": false,
		"id": null,
		"tenantId": null,
		"impersonatorUserId": null,
		"impersonatorTenantId": null,
		"impersonatorUserName": null,
		"impersonatorTenantName": null,
		"userName": "admin",
		"name": null,
		"surName": null,
		"email": null,
		"emailVerified": false,
		"phoneNumber": null,
		"phoneNumberVerified": false,
		"roles": []
	},

When I use EfCore For PostgreSQL Version of Abp 8.0.5

YoussefRashed avatar Apr 14 '24 16:04 YoussefRashed

hi @YoussefRashed

Can you share a simple project?

maliming avatar Apr 15 '24 00:04 maliming

@maliming Thanks For your Attention ❤️ But Sorry it Works ! I missed this Line on my PostgresHostModule

  options.MapInboundClaims = false;

YoussefRashed avatar Apr 15 '24 18:04 YoussefRashed