mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Added username claim to API claims available in token
This commit is contained in:
parent
ec6240279b
commit
389023c3eb
@ -90,7 +90,7 @@ namespace Teknik.IdentityServer.Configuration
|
||||
Name = config.UserConfig.IdentityServerConfig.APIName,
|
||||
DisplayName = "Teknik API",
|
||||
Description = "Teknik API Access for end users",
|
||||
UserClaims = new List<string> {"role"},
|
||||
UserClaims = new List<string> {"role", "username"},
|
||||
ApiSecrets = new List<Secret> {new Secret(config.UserConfig.IdentityServerConfig.APISecret.Sha256()) },
|
||||
Scopes = new List<Scope> {
|
||||
new Scope("teknik-api.read", "Teknik API Read Access"),
|
||||
|
@ -41,15 +41,12 @@ namespace Teknik.Areas.API.V1.Controllers
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizeBasic;
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
IdentityUserInfo userInfo = await IdentityHelper.GetIdentityUserInfo(_config, User.Identity.Name);
|
||||
if (userInfo.AccountType == AccountType.Premium)
|
||||
{
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (model.file.Length <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
|
@ -66,15 +66,12 @@ namespace Teknik.Areas.Upload.Controllers
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizeBasic;
|
||||
if (User.Identity.IsAuthenticated)
|
||||
{
|
||||
IdentityUserInfo userInfo = await IdentityHelper.GetIdentityUserInfo(_config, User.Identity.Name);
|
||||
if (userInfo.AccountType == AccountType.Premium)
|
||||
{
|
||||
maxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (uploadFile.file.Length <= maxUploadSize)
|
||||
{
|
||||
// convert file to bytes
|
||||
|
Loading…
Reference in New Issue
Block a user