aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/UserService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/UserService.cs')
-rw-r--r--MediaBrowser.Api/UserService.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.cs
index 401514349..ebcacd2a3 100644
--- a/MediaBrowser.Api/UserService.cs
+++ b/MediaBrowser.Api/UserService.cs
@@ -117,6 +117,17 @@ namespace MediaBrowser.Api
public string Pw { get; set; }
}
+ [Route("/Users/AuthenticateWithQuickConnect", "POST", Summary = "Authenticates a user")]
+ public class AuthenticateUserQuickConnect : IReturn<AuthenticationResult>
+ {
+ /// <summary>
+ /// Gets or sets the token.
+ /// </summary>
+ /// <value>The token</value>
+ [ApiMember(Name = "Token", IsRequired = true, DataType = "string", ParameterType = "body", Verb = "POST")]
+ public string Token { get; set; }
+ }
+
/// <summary>
/// Class UpdateUserPassword
/// </summary>
@@ -430,6 +441,29 @@ namespace MediaBrowser.Api
}
}
+ public async Task<object> Post(AuthenticateUserQuickConnect request)
+ {
+ var auth = _authContext.GetAuthorizationInfo(Request);
+
+ try
+ {
+ var result = await _sessionMananger.AuthenticateQuickConnect(new AuthenticationRequest
+ {
+ App = auth.Client,
+ AppVersion = auth.Version,
+ DeviceId = auth.DeviceId,
+ DeviceName = auth.Device
+ }, request.Token).ConfigureAwait(false);
+
+ return ToOptimizedResult(result);
+ }
+ catch (SecurityException e)
+ {
+ // rethrow adding IP address to message
+ throw new SecurityException($"[{Request.RemoteIp}] {e.Message}");
+ }
+ }
+
/// <summary>
/// Posts the specified request.
/// </summary>