|
1 | 1 | using VirtoCommerce.Platform.Core.Common;
|
2 |
| -using VirtoCommerce.Platform.Security.Model; |
3 | 2 | using static OpenIddict.Abstractions.OpenIddictConstants;
|
4 | 3 |
|
5 |
| -namespace VirtoCommerce.Platform.Security |
| 4 | +namespace VirtoCommerce.Platform.Security.OpenIddict |
6 | 5 | {
|
7 | 6 | public static class SecurityErrorDescriber
|
8 | 7 | {
|
9 |
| - public static TokenLoginResponse LoginFailed() => new() |
| 8 | + public static TokenResponse LoginFailed() => new() |
10 | 9 | {
|
11 | 10 | Error = Errors.InvalidGrant,
|
12 | 11 | Code = nameof(LoginFailed).ToSnakeCase(),
|
13 | 12 | ErrorDescription = "Login attempt failed. Please check your credentials."
|
14 | 13 | };
|
15 | 14 |
|
16 |
| - public static TokenLoginResponse UserIsLockedOut() => new() |
| 15 | + public static TokenResponse UserIsLockedOut() => new() |
17 | 16 | {
|
18 | 17 | Error = Errors.InvalidGrant,
|
19 | 18 | Code = nameof(UserIsLockedOut).ToSnakeCase(),
|
20 | 19 | ErrorDescription = "Your account has been locked. Please contact support for assistance."
|
21 | 20 | };
|
22 | 21 |
|
23 |
| - public static TokenLoginResponse UserIsTemporaryLockedOut() => new() |
| 22 | + public static TokenResponse UserIsTemporaryLockedOut() => new() |
24 | 23 | {
|
25 | 24 | Error = Errors.InvalidGrant,
|
26 | 25 | Code = nameof(UserIsLockedOut).ToSnakeCase(),
|
27 | 26 | ErrorDescription = "Your account has been temporarily locked. Please try again after some time."
|
28 | 27 | };
|
29 | 28 |
|
30 |
| - public static TokenLoginResponse PasswordExpired() => new() |
| 29 | + public static TokenResponse PasswordExpired() => new() |
31 | 30 | {
|
32 | 31 | Error = Errors.InvalidGrant,
|
33 | 32 | Code = nameof(PasswordExpired).ToSnakeCase(),
|
34 | 33 | ErrorDescription = "Your password has been expired and must be changed.",
|
35 | 34 | };
|
36 | 35 |
|
37 |
| - public static TokenLoginResponse PasswordLoginDisabled() => new() |
| 36 | + public static TokenResponse PasswordLoginDisabled() => new() |
38 | 37 | {
|
39 | 38 | Error = Errors.InvalidGrant,
|
40 | 39 | Code = nameof(PasswordLoginDisabled).ToSnakeCase(),
|
41 | 40 | ErrorDescription = "The username/password login is disabled."
|
42 | 41 | };
|
43 | 42 |
|
44 |
| - public static TokenLoginResponse TokenInvalid() => new() |
| 43 | + public static TokenResponse TokenInvalid() => new() |
45 | 44 | {
|
46 | 45 | Error = Errors.InvalidGrant,
|
47 | 46 | Code = nameof(TokenInvalid).ToSnakeCase(),
|
48 | 47 | ErrorDescription = "The token is no longer valid."
|
49 | 48 | };
|
50 | 49 |
|
51 |
| - public static TokenLoginResponse SignInNotAllowed() => new() |
| 50 | + public static TokenResponse SignInNotAllowed() => new() |
52 | 51 | {
|
53 | 52 | Error = Errors.InvalidGrant,
|
54 | 53 | Code = nameof(SignInNotAllowed).ToSnakeCase(),
|
55 | 54 | ErrorDescription = "The user is no longer allowed to sign in."
|
56 | 55 | };
|
57 | 56 |
|
58 |
| - public static TokenLoginResponse InvalidClient() => new() |
| 57 | + public static TokenResponse InvalidClient() => new() |
59 | 58 | {
|
60 | 59 | Error = Errors.InvalidClient,
|
61 | 60 | Code = nameof(InvalidClient).ToSnakeCase(),
|
62 | 61 | ErrorDescription = "The client application was not found in the database."
|
63 | 62 | };
|
64 | 63 |
|
65 |
| - public static TokenLoginResponse UnsupportedGrantType() => new() |
| 64 | + public static TokenResponse UnsupportedGrantType() => new() |
66 | 65 | {
|
67 | 66 | Error = Errors.UnsupportedGrantType,
|
68 | 67 | Code = nameof(UnsupportedGrantType).ToSnakeCase(),
|
|
0 commit comments