diff options
author | crupest <crupest@outlook.com> | 2021-04-24 22:01:27 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-24 22:01:27 +0800 |
commit | 7d965bedbb48aed900f838d0fe65931143e5619e (patch) | |
tree | d4ae5c7d0c81ccb2e1fae378797f673acf2ce14b /BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs | |
parent | 9adfa3c8311f4ace9388dc805f1a4df6fba97f0e (diff) | |
download | timeline-7d965bedbb48aed900f838d0fe65931143e5619e.tar.gz timeline-7d965bedbb48aed900f838d0fe65931143e5619e.tar.bz2 timeline-7d965bedbb48aed900f838d0fe65931143e5619e.zip |
refactor: Move token services.
Diffstat (limited to 'BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs')
-rw-r--r-- | BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs b/BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs deleted file mode 100644 index c528c3e3..00000000 --- a/BackEnd/Timeline/Services/JwtUserTokenBadFormatException.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System;
-using System.Globalization;
-using static Timeline.Resources.Services.Exception;
-
-namespace Timeline.Services
-{
- [Serializable]
- public class JwtUserTokenBadFormatException : UserTokenBadFormatException
- {
- public enum ErrorKind
- {
- NoIdClaim,
- IdClaimBadFormat,
- NoVersionClaim,
- VersionClaimBadFormat,
- Other
- }
-
- public JwtUserTokenBadFormatException() : this("", ErrorKind.Other) { }
- public JwtUserTokenBadFormatException(string message) : base(message) { }
- public JwtUserTokenBadFormatException(string message, Exception inner) : base(message, inner) { }
-
- public JwtUserTokenBadFormatException(string token, ErrorKind type) : base(token, GetErrorMessage(type)) { ErrorType = type; }
- public JwtUserTokenBadFormatException(string token, ErrorKind type, Exception inner) : base(token, GetErrorMessage(type), inner) { ErrorType = type; }
- public JwtUserTokenBadFormatException(string token, ErrorKind type, string message, Exception inner) : base(token, message, inner) { ErrorType = type; }
- protected JwtUserTokenBadFormatException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
-
- public ErrorKind ErrorType { get; set; }
-
- private static string GetErrorMessage(ErrorKind type)
- {
- var reason = type switch
- {
- ErrorKind.NoIdClaim => JwtUserTokenBadFormatExceptionIdMissing,
- ErrorKind.IdClaimBadFormat => JwtUserTokenBadFormatExceptionIdBadFormat,
- ErrorKind.NoVersionClaim => JwtUserTokenBadFormatExceptionVersionMissing,
- ErrorKind.VersionClaimBadFormat => JwtUserTokenBadFormatExceptionVersionBadFormat,
- ErrorKind.Other => JwtUserTokenBadFormatExceptionOthers,
- _ => JwtUserTokenBadFormatExceptionUnknown
- };
-
- return string.Format(CultureInfo.CurrentCulture,
- Resources.Services.Exception.JwtUserTokenBadFormatException, reason);
- }
- }
-}
|