diff options
Diffstat (limited to 'BackEnd/Timeline/Services/Token')
5 files changed, 15 insertions, 3 deletions
diff --git a/BackEnd/Timeline/Services/Token/IUserTokenManager.cs b/BackEnd/Timeline/Services/Token/IUserTokenManager.cs index bdc1add3..39009d69 100644 --- a/BackEnd/Timeline/Services/Token/IUserTokenManager.cs +++ b/BackEnd/Timeline/Services/Token/IUserTokenManager.cs @@ -16,7 +16,7 @@ namespace Timeline.Services.Token /// <returns>The created token and the user info.</returns>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="username"/> or <paramref name="password"/> is null.</exception>
/// <exception cref="ArgumentException">Thrown when <paramref name="username"/> is of bad format.</exception>
- /// <exception cref="UserNotExistException">Thrown when the user with <paramref name="username"/> does not exist.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the user with <paramref name="username"/> does not exist.</exception>
/// <exception cref="BadPasswordException">Thrown when <paramref name="password"/> is wrong.</exception>
public Task<UserTokenCreateResult> CreateTokenAsync(string username, string password, DateTime? expireAt = null);
diff --git a/BackEnd/Timeline/Services/Token/Resource.Designer.cs b/BackEnd/Timeline/Services/Token/Resource.Designer.cs index 07b0057f..ac6f3707 100644 --- a/BackEnd/Timeline/Services/Token/Resource.Designer.cs +++ b/BackEnd/Timeline/Services/Token/Resource.Designer.cs @@ -61,6 +61,15 @@ namespace Timeline.Services.Token { }
/// <summary>
+ /// Looks up a localized string similar to Jwt key is not found. Maybe you forget to do the migration..
+ /// </summary>
+ internal static string ExceptionJwtKeyNotExist {
+ get {
+ return ResourceManager.GetString("ExceptionJwtKeyNotExist", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The token didn't pass verification because {0}..
/// </summary>
internal static string ExceptionJwtUserTokenBadFormat {
diff --git a/BackEnd/Timeline/Services/Token/Resource.resx b/BackEnd/Timeline/Services/Token/Resource.resx index 7abf2e75..06bf03f6 100644 --- a/BackEnd/Timeline/Services/Token/Resource.resx +++ b/BackEnd/Timeline/Services/Token/Resource.resx @@ -117,6 +117,9 @@ <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <data name="ExceptionJwtKeyNotExist" xml:space="preserve">
+ <value>Jwt key is not found. Maybe you forget to do the migration.</value>
+ </data>
<data name="ExceptionJwtUserTokenBadFormat" xml:space="preserve">
<value>The token didn't pass verification because {0}.</value>
</data>
diff --git a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs index 7b57a06c..c1633f4a 100644 --- a/BackEnd/Timeline/Services/Token/UserTokenHandler.cs +++ b/BackEnd/Timeline/Services/Token/UserTokenHandler.cs @@ -29,7 +29,7 @@ namespace Timeline.Services.Token if (key == null)
{
- throw new InvalidOperationException(Resources.Services.UserTokenService.JwtKeyNotExist);
+ throw new InvalidOperationException(Resource.ExceptionJwtKeyNotExist);
}
_tokenSecurityKey = new SymmetricSecurityKey(key);
diff --git a/BackEnd/Timeline/Services/Token/UserTokenManager.cs b/BackEnd/Timeline/Services/Token/UserTokenManager.cs index 5aa85a5e..7ccdfe0a 100644 --- a/BackEnd/Timeline/Services/Token/UserTokenManager.cs +++ b/BackEnd/Timeline/Services/Token/UserTokenManager.cs @@ -91,7 +91,7 @@ namespace Timeline.Services.Token return user;
}
- catch (UserNotExistException e)
+ catch (EntityNotExistException e)
{
var exception = new UserTokenUserNotExistException(token, e);
_logger.LogInformation(exception, Resource.LogTokenVerifiedFail);
|