feat: add RegionCode by UserIdentity.
This commit is contained in:
parent
0f930b4c46
commit
0fbe0e6f0c
|
|
@ -17,4 +17,5 @@ public interface IUserIdentity
|
||||||
string? EmployeeId { get; }
|
string? EmployeeId { get; }
|
||||||
string Type { get; }
|
string Type { get; }
|
||||||
string Role { get; }
|
string Role { get; }
|
||||||
|
string? RegionCode { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,7 @@ public class UserIdentity : IUserIdentity
|
||||||
|
|
||||||
[JsonPropertyName("role")]
|
[JsonPropertyName("role")]
|
||||||
public string? Role => _claims?.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;
|
public string? Role => _claims?.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;
|
||||||
|
|
||||||
|
[JsonPropertyName("regionCode")]
|
||||||
|
public string? RegionCode => _claims?.FirstOrDefault(x => x.Type == "regionCode")?.Value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,8 @@ public class UserService : IUserService
|
||||||
ExternalId = user.ExternalId,
|
ExternalId = user.ExternalId,
|
||||||
Password = user.Password,
|
Password = user.Password,
|
||||||
Type = user.Type,
|
Type = user.Type,
|
||||||
Role = user.Role
|
Role = user.Role,
|
||||||
|
RegionCode = user.RegionCode
|
||||||
};
|
};
|
||||||
await CreateUser(record);
|
await CreateUser(record);
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +318,8 @@ public class UserService : IUserService
|
||||||
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
||||||
new Claim("phone", user.Phone ?? string.Empty),
|
new Claim("phone", user.Phone ?? string.Empty),
|
||||||
new Claim("affiliateId", user.AffiliateId ?? string.Empty),
|
new Claim("affiliateId", user.AffiliateId ?? string.Empty),
|
||||||
new Claim("employeeId", user.EmployeeId ?? string.Empty)
|
new Claim("employeeId", user.EmployeeId ?? string.Empty),
|
||||||
|
new Claim("regionCode", user.RegionCode ?? "CN")
|
||||||
};
|
};
|
||||||
|
|
||||||
var validators = _services.GetServices<IAuthenticationHook>();
|
var validators = _services.GetServices<IAuthenticationHook>();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue