Revize ba13a48a
Přidáno uživatelem Jakub Schenk před asi 2 roky(ů)
Backend/BackendTesting/Utils.cs | ||
---|---|---|
13 | 13 |
using Core.MapperProfiles; |
14 | 14 |
using Microsoft.Extensions.Configuration; |
15 | 15 |
using Core.Contexts; |
16 |
using Microsoft.Extensions.Options; |
|
17 |
using Core.Authentication; |
|
16 | 18 |
|
17 | 19 |
namespace Core.Services |
18 | 20 |
{ |
... | ... | |
52 | 54 |
return new UserServiceEF(new DatabaseContext(configuration), TestingLogger.GetLogger(), TestingMapper.GetMapper()); |
53 | 55 |
} |
54 | 56 |
} |
57 |
|
|
58 |
public static class TestingJwtUtils |
|
59 |
{ |
|
60 |
public static IOptions<JwtConfig> jwtConfig = Options.Create<JwtConfig>(new JwtConfig() { Issuer = "asd", Secret = "WTaDxVUWTaDxVU3AXX9YqM2ukx98mKFWTaDxVU3AXX9YqM2ukx98mKFWTaDxVU3AXX9YqM2ukx98mKF3AXX9YqM2ukx98mKF" }); |
|
61 |
public static IJwtUtils GetJwtUtils() |
|
62 |
{ |
|
63 |
ConfigurationManager m = new ConfigurationManager(); |
|
64 |
m["JwtConfig:Secret"] = "WTaDxVUWTaDxVU3AXX9YqM2ukx98mKFWTaDxVU3AXX9YqM2ukx98mKFWTaDxVU3AXX9YqM2ukx98mKF3AXX9YqM2ukx98mKF"; |
|
65 |
m["JwtConfig:Issuer"] = "asd"; |
|
66 |
var tokenValidationParams = JwtUtils.GetTokenValidationParameters(m); |
|
67 |
return new JwtUtils(jwtConfig, tokenValidationParams); |
|
68 |
} |
|
69 |
} |
|
55 | 70 |
} |
Také k dispozici: Unified diff
backend login
login on backend tested (JwtUtils in Utils inicialization)