diff options
| author | transtrike <transtrike@gmail.com> | 2021-01-20 18:07:58 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-01-20 18:07:58 +0200 |
| commit | 8179af787a7bf375753a178b89111a91d84a8bb8 (patch) | |
| tree | eb2dbeb52e0875ddc06d5e6ca1bd97ef8d941d4e /src/DevHive.Services/Services/PostService.cs | |
| parent | aa4f7bdd9a2df09fc47e82c2b85fb7647203ba8d (diff) | |
| download | DevHive-8179af787a7bf375753a178b89111a91d84a8bb8.tar DevHive-8179af787a7bf375753a178b89111a91d84a8bb8.tar.gz DevHive-8179af787a7bf375753a178b89111a91d84a8bb8.zip | |
Changed List to HashSet for "no duplicates" scenario
Diffstat (limited to 'src/DevHive.Services/Services/PostService.cs')
| -rw-r--r-- | src/DevHive.Services/Services/PostService.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/DevHive.Services/Services/PostService.cs b/src/DevHive.Services/Services/PostService.cs index f2f60d1..9503b8a 100644 --- a/src/DevHive.Services/Services/PostService.cs +++ b/src/DevHive.Services/Services/PostService.cs @@ -9,6 +9,7 @@ using System.IdentityModel.Tokens.Jwt; using System.Security.Claims; using DevHive.Services.Interfaces; using DevHive.Data.Interfaces.Repositories; +using System.Linq; namespace DevHive.Services.Services { @@ -131,8 +132,8 @@ namespace DevHive.Services.Services { var jwt = new JwtSecurityTokenHandler().ReadJwtToken(rawTokenData.Remove(0, 7)); - string jwtUserName = this.GetClaimTypeValues("unique_name", jwt.Claims)[0]; - //List<string> jwtRoleNames = this.GetClaimTypeValues("role", jwt.Claims); + string jwtUserName = this.GetClaimTypeValues("unique_name", jwt.Claims).First(); + //HashSet<string> jwtRoleNames = this.GetClaimTypeValues("role", jwt.Claims); User user = await this._userRepository.GetByUsernameAsync(jwtUserName) ?? throw new ArgumentException("User does not exist!"); |
