diff --git a/docs/model.ndm2 b/docs/model.ndm2 index e3cced3..e7a2b71 100644 --- a/docs/model.ndm2 +++ b/docs/model.ndm2 @@ -9353,281 +9353,6 @@ "dataCompressions": [] } }, - { - "objectType": "Table_MSSQL", - "name": "OtpToken", - "comment": "توکن Otp", - "owner": "", - "isChangeTracking": false, - "isTrackColumnsUpdated": false, - "oldName": "", - "isSystemTable": false, - "createTime": "", - "modifyTime": "", - "objectID": 0, - "numberOfRows": 0, - "identityCurrent": 0, - "dataLength": 0, - "indexLength": 0, - "fields": [ - { - "objectType": "TableField_MSSQL", - "name": "Id", - "type": "bigint", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "شناسه", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Id", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": true, - "isExistingField": false, - "identitySeed": -2147483648, - "identityIncrement": -2147483648, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "Mobile", - "type": "nvarchar", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "موبایل مقصد", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Mobile", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "Purpose", - "type": "nvarchar", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "مقصود", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Purpose", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "CodeHash", - "type": "nvarchar", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "کد هش شده", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "CodeHash", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "ExpiresAt", - "type": "datetime", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "زمان انقضا", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "ExpiresAt", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "Attempts", - "type": "int", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "شمارش تلاش‌ها", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Attempts", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "IsUsed", - "type": "bit", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "موفق بود؟", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "IsUsed", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - } - ], - "indexes": [], - "primaryKey": { - "objectType": "PrimaryKey_MSSQL", - "name": "_copy_1_copy_1_copy_2_copy_2", - "fields": [ - "Id" - ], - "fillFactor": 0, - "oldName": "", - "isClustered": true, - "isPadded": false, - "noRecomputeStatistics": false, - "ignoreDuplicatedKeyValues": false, - "allowRowLocks": true, - "allowPageLocks": true, - "storage": { - "objectType": "Storage_MSSQL", - "name": "", - "oldName": "", - "storageType": "Default", - "filegroup": "", - "textImageFilegroup": "", - "filestreamFilegroup": "", - "partitionScheme": "", - "partitionColumn": "", - "filestreamPartitionScheme": "", - "dataCompressions": [] - } - }, - "foreignKeys": [], - "uniques": [], - "checks": [], - "triggers": [], - "storage": { - "objectType": "Storage_MSSQL", - "name": "", - "oldName": "", - "storageType": "Default", - "filegroup": "", - "textImageFilegroup": "", - "filestreamFilegroup": "", - "partitionScheme": "", - "partitionColumn": "", - "filestreamPartitionScheme": "", - "dataCompressions": [] - } - }, { "objectType": "Table_MSSQL", "name": "GetAllOtpTokenByFilterRequest", @@ -10444,103 +10169,6 @@ "dataCompressions": [] } }, - { - "objectType": "Table_MSSQL", - "name": "CreateNewOtpTokenRequest", - "comment": "ورودی ایجاد توکن Otp جدید", - "owner": "", - "isChangeTracking": false, - "isTrackColumnsUpdated": false, - "oldName": "CreateNewOtpTokenRequest", - "isSystemTable": false, - "createTime": "", - "modifyTime": "", - "objectID": 1890, - "numberOfRows": 0, - "identityCurrent": 0, - "dataLength": 0, - "indexLength": 0, - "fields": [ - { - "objectType": "TableField_MSSQL", - "name": "Mobile", - "type": "nvarchar", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "موبایل مقصد", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Mobile", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - }, - { - "objectType": "TableField_MSSQL", - "name": "Purpose", - "type": "nvarchar", - "size": -2147483648, - "isNullable": "No", - "scale": -2147483648, - "comment": "مقصود", - "computedExpression": "", - "defaultValue": "", - "defaultValueType": "Others", - "schema": "", - "userDefinedType": "", - "collate": "", - "isWithValues": false, - "isFilestream": false, - "isColumnSet": false, - "isPersisted": false, - "isSparse": false, - "isRowGUIDColumn": false, - "oldName": "Purpose", - "computedBaseType": "", - "isDefaultConstraint": false, - "defaultConstraint": "", - "isIdentity": false, - "isExistingField": false, - "identitySeed": 0, - "identityIncrement": 0, - "identityIsNotForReplication": false - } - ], - "indexes": [], - "foreignKeys": [], - "uniques": [], - "checks": [], - "triggers": [], - "storage": { - "objectType": "Storage_MSSQL", - "name": "", - "oldName": "", - "storageType": "Default", - "filegroup": "", - "textImageFilegroup": "", - "filestreamFilegroup": "", - "partitionScheme": "", - "partitionColumn": "", - "filestreamPartitionScheme": "", - "dataCompressions": [] - } - }, { "objectType": "Table_MSSQL", "name": "OtpTokenService", @@ -39610,6 +39238,464 @@ "filestreamPartitionScheme": "", "dataCompressions": [] } + }, + { + "objectType": "Table_MSSQL", + "name": "OtpToken", + "comment": "توکن Otp", + "owner": "", + "isChangeTracking": false, + "isTrackColumnsUpdated": false, + "oldName": "", + "isSystemTable": false, + "createTime": "", + "modifyTime": "", + "objectID": 0, + "numberOfRows": 0, + "identityCurrent": 0, + "dataLength": 0, + "indexLength": 0, + "fields": [ + { + "objectType": "TableField_MSSQL", + "name": "Id", + "type": "bigint", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "شناسه", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Id", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": true, + "isExistingField": false, + "identitySeed": -2147483648, + "identityIncrement": -2147483648, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Mobile", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "موبایل مقصد", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Mobile", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Purpose", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "مقصود", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Purpose", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "CodeHash", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "کد هش شده", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "CodeHash", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ExpiresAt", + "type": "datetime", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "زمان انقضا", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ExpiresAt", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Attempts", + "type": "int", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "شمارش تلاش‌ها", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Attempts", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "IsUsed", + "type": "bit", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "موفق بود؟", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "IsUsed", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ExtraInfo", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "Yes", + "scale": -2147483648, + "comment": "اطلاعات بیشتر", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ExtraInfo", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MSSQL", + "name": "_copy_1_copy_1_copy_2_copy_2", + "fields": [ + "Id" + ], + "fillFactor": 0, + "oldName": "", + "isClustered": true, + "isPadded": false, + "noRecomputeStatistics": false, + "ignoreDuplicatedKeyValues": false, + "allowRowLocks": true, + "allowPageLocks": true, + "storage": { + "objectType": "Storage_MSSQL", + "name": "", + "oldName": "", + "storageType": "Default", + "filegroup": "", + "textImageFilegroup": "", + "filestreamFilegroup": "", + "partitionScheme": "", + "partitionColumn": "", + "filestreamPartitionScheme": "", + "dataCompressions": [] + } + }, + "foreignKeys": [], + "uniques": [], + "checks": [], + "triggers": [], + "storage": { + "objectType": "Storage_MSSQL", + "name": "", + "oldName": "", + "storageType": "Default", + "filegroup": "", + "textImageFilegroup": "", + "filestreamFilegroup": "", + "partitionScheme": "", + "partitionColumn": "", + "filestreamPartitionScheme": "", + "dataCompressions": [] + } + }, + { + "objectType": "Table_MSSQL", + "name": "CreateNewOtpTokenRequest", + "comment": "ورودی ایجاد توکن Otp جدید", + "owner": "", + "isChangeTracking": false, + "isTrackColumnsUpdated": false, + "oldName": "CreateNewOtpTokenRequest", + "isSystemTable": false, + "createTime": "", + "modifyTime": "", + "objectID": 1890, + "numberOfRows": 0, + "identityCurrent": 0, + "dataLength": 0, + "indexLength": 0, + "fields": [ + { + "objectType": "TableField_MSSQL", + "name": "Mobile", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "موبایل مقصد", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Mobile", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "Purpose", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "No", + "scale": -2147483648, + "comment": "مقصود", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "Purpose", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + }, + { + "objectType": "TableField_MSSQL", + "name": "ExtraInfo", + "type": "nvarchar", + "size": -2147483648, + "isNullable": "Yes", + "scale": -2147483648, + "comment": "اطلاعات بیشتر", + "computedExpression": "", + "defaultValue": "", + "defaultValueType": "None", + "schema": "", + "userDefinedType": "", + "collate": "", + "isWithValues": false, + "isFilestream": false, + "isColumnSet": false, + "isPersisted": false, + "isSparse": false, + "isRowGUIDColumn": false, + "oldName": "ExtraInfo", + "computedBaseType": "", + "isDefaultConstraint": false, + "defaultConstraint": "", + "isIdentity": false, + "isExistingField": false, + "identitySeed": 0, + "identityIncrement": 0, + "identityIsNotForReplication": false + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MSSQL", + "name": "", + "fields": [], + "fillFactor": 0, + "oldName": "", + "isClustered": true, + "isPadded": false, + "noRecomputeStatistics": false, + "ignoreDuplicatedKeyValues": false, + "allowRowLocks": true, + "allowPageLocks": true, + "storage": { + "objectType": "Storage_MSSQL", + "name": "", + "oldName": "", + "storageType": "Default", + "filegroup": "", + "textImageFilegroup": "", + "filestreamFilegroup": "", + "partitionScheme": "", + "partitionColumn": "", + "filestreamPartitionScheme": "", + "dataCompressions": [] + } + }, + "foreignKeys": [], + "uniques": [], + "checks": [], + "triggers": [], + "storage": { + "objectType": "Storage_MSSQL", + "name": "", + "oldName": "", + "storageType": "Default", + "filegroup": "", + "textImageFilegroup": "", + "filestreamFilegroup": "", + "partitionScheme": "", + "partitionColumn": "", + "filestreamPartitionScheme": "", + "dataCompressions": [] + } } ], "views": [] @@ -40791,7 +40877,7 @@ "x": 18540, "y": 6910, "width": 310, - "height": 230, + "height": 258, "isBold": false, "titleColor": { "r": 55, @@ -40820,10 +40906,10 @@ "type": "table", "schemaName": "CMS", "tableName": "CreateNewOtpTokenRequest", - "x": 10160, - "y": 2840, + "x": 10175, + "y": 2821, "width": 400, - "height": 110, + "height": 154, "isBold": false, "titleColor": { "r": 255, @@ -45094,7 +45180,15 @@ }, { "x": 10360, - "y": 2825 + "y": 2680 + }, + { + "x": 10375, + "y": 2680 + }, + { + "x": 10375, + "y": 2806 } ], "label": { diff --git a/src/CMSMicroservice.Infrastructure/Services/GenerateJwtTokenService.cs b/src/CMSMicroservice.Infrastructure/Services/GenerateJwtTokenService.cs index ae8bc27..c333843 100644 --- a/src/CMSMicroservice.Infrastructure/Services/GenerateJwtTokenService.cs +++ b/src/CMSMicroservice.Infrastructure/Services/GenerateJwtTokenService.cs @@ -8,6 +8,7 @@ using System.Security.Claims; using System.Text; namespace CMSMicroservice.Infrastructure.Services; + public class GenerateJwtTokenService : IGenerateJwtToken { private readonly IConfiguration _configuration; @@ -17,30 +18,33 @@ public class GenerateJwtTokenService : IGenerateJwtToken _configuration = configuration; } - public async Task GenerateJwtToken(User user,int? expiryDays=null) + public async Task GenerateJwtToken(User user, int? expiryDays = null) { var lastModified = user.LastModified ?? user.Created; var claims = new List { - new(ClaimTypes.NameIdentifier, user.Id.ToString()), - new(ClaimTypes.MobilePhone, user.Mobile), - new("ReferralCode", user.ReferralCode), - new(ClaimTypes.Name, $"{user.FirstName} {user.LastName}") + new(ClaimTypes.NameIdentifier, user.Id.ToString()), + new(ClaimTypes.MobilePhone, user.Mobile), + new("ReferralCode", user.ReferralCode), + new(ClaimTypes.Name, $"{user.FirstName} {user.LastName}") }; + claims.Add(new Claim("MobileNumber", user.Mobile)); if (!string.IsNullOrWhiteSpace(user.FirstName)) claims.Add(new Claim("FirstName", user.FirstName)); + if (!string.IsNullOrWhiteSpace(user.LastName)) claims.Add(new Claim("LastName", user.LastName)); - + if (user.UserRoles != null && user.UserRoles.Any()) { foreach (var userRole in user.UserRoles) { claims.Add(new Claim(ClaimTypes.Role, userRole.Role.Name)); } + if (user.UserRoles.Max(x => x.Created) > lastModified) lastModified = user.UserRoles.Max(x => x.Created); if (user.UserRoles.Where(x => x.LastModified != null).Max(x => x.LastModified) > lastModified) @@ -51,10 +55,9 @@ public class GenerateJwtTokenService : IGenerateJwtToken var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["JwtSecurityKey"])); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - var expiry =expiryDays!=null? - DateTime.Now.AddDays(Convert.ToInt32(expiryDays)) - : - DateTime.Now.AddDays(Convert.ToInt32(_configuration["JwtExpiryInDays"])); + var expiry = expiryDays != null + ? DateTime.Now.AddDays(Convert.ToInt32(expiryDays)) + : DateTime.Now.AddDays(Convert.ToInt32(_configuration["JwtExpiryInDays"])); var token = new JwtSecurityToken( _configuration["JwtIssuer"], @@ -66,5 +69,4 @@ public class GenerateJwtTokenService : IGenerateJwtToken var _token = new JwtSecurityTokenHandler().WriteToken(token); return _token; } - -} +} \ No newline at end of file