aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Authentication
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Authentication')
-rw-r--r--MediaBrowser.Controller/Authentication/AuthenticationException.cs35
-rw-r--r--MediaBrowser.Controller/Authentication/AuthenticationResult.cs8
-rw-r--r--MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs13
-rw-r--r--MediaBrowser.Controller/Authentication/IPasswordResetProvider.cs29
4 files changed, 82 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/Authentication/AuthenticationException.cs b/MediaBrowser.Controller/Authentication/AuthenticationException.cs
new file mode 100644
index 000000000..081f877f7
--- /dev/null
+++ b/MediaBrowser.Controller/Authentication/AuthenticationException.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace MediaBrowser.Controller.Authentication
+{
+ /// <summary>
+ /// The exception that is thrown when an attempt to authenticate fails.
+ /// </summary>
+ public class AuthenticationException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AuthenticationException"/> class.
+ /// </summary>
+ public AuthenticationException() : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AuthenticationException"/> class.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ public AuthenticationException(string message) : base(message)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AuthenticationException"/> class.
+ /// </summary>
+ /// <param name="message">The message that describes the error.</param>
+ /// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param>
+ public AuthenticationException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
index 3c65156e3..635e4eb3d 100644
--- a/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
+++ b/MediaBrowser.Controller/Authentication/AuthenticationResult.cs
@@ -1,14 +1,20 @@
+#nullable disable
+
+#pragma warning disable CS1591
+
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Dto;
-
namespace MediaBrowser.Controller.Authentication
{
public class AuthenticationResult
{
public UserDto User { get; set; }
+
public SessionInfo SessionInfo { get; set; }
+
public string AccessToken { get; set; }
+
public string ServerId { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
index b9f282bd2..a56d3c822 100644
--- a/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
+++ b/MediaBrowser.Controller/Authentication/IAuthenticationProvider.cs
@@ -1,5 +1,9 @@
+#nullable disable
+
+#pragma warning disable CS1591
+
using System.Threading.Tasks;
-using MediaBrowser.Controller.Entities;
+using Jellyfin.Data.Entities;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Authentication
@@ -7,9 +11,13 @@ namespace MediaBrowser.Controller.Authentication
public interface IAuthenticationProvider
{
string Name { get; }
+
bool IsEnabled { get; }
+
Task<ProviderAuthenticationResult> Authenticate(string username, string password);
- Task<bool> HasPassword(User user);
+
+ bool HasPassword(User user);
+
Task ChangePassword(User user, string newPassword);
}
@@ -26,6 +34,7 @@ namespace MediaBrowser.Controller.Authentication
public class ProviderAuthenticationResult
{
public string Username { get; set; }
+
public string DisplayName { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Authentication/IPasswordResetProvider.cs b/MediaBrowser.Controller/Authentication/IPasswordResetProvider.cs
new file mode 100644
index 000000000..8c9d1baf8
--- /dev/null
+++ b/MediaBrowser.Controller/Authentication/IPasswordResetProvider.cs
@@ -0,0 +1,29 @@
+#nullable disable
+
+#pragma warning disable CS1591
+
+using System;
+using System.Threading.Tasks;
+using Jellyfin.Data.Entities;
+using MediaBrowser.Model.Users;
+
+namespace MediaBrowser.Controller.Authentication
+{
+ public interface IPasswordResetProvider
+ {
+ string Name { get; }
+
+ bool IsEnabled { get; }
+
+ Task<ForgotPasswordResult> StartForgotPasswordProcess(User user, bool isInNetwork);
+
+ Task<PinRedeemResult> RedeemPasswordResetPin(string pin);
+ }
+
+ public class PasswordPinCreationResult
+ {
+ public string PinFile { get; set; }
+
+ public DateTime ExpirationDate { get; set; }
+ }
+}