|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
using System.Security.Claims;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
@ -9,6 +10,7 @@ using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
|
using Ombi.Api;
|
|
|
|
|
using Ombi.Core.Authentication;
|
|
|
|
|
using Ombi.Helpers;
|
|
|
|
|
using Ombi.Models;
|
|
|
|
@ -62,6 +64,8 @@ namespace Ombi.Controllers
|
|
|
|
|
user.EmailLogin = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!model.UsePlexOAuth)
|
|
|
|
|
{
|
|
|
|
|
// Verify Password
|
|
|
|
|
if (await _userManager.CheckPasswordAsync(user, model.Password))
|
|
|
|
|
{
|
|
|
|
@ -107,6 +111,19 @@ namespace Ombi.Controllers
|
|
|
|
|
expiration = token.ValidTo
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Plex OAuth
|
|
|
|
|
// Redirect them to Plex
|
|
|
|
|
|
|
|
|
|
var request = new Request("auth", "https://app.plex.tv", HttpMethod.Get);
|
|
|
|
|
request.AddQueryString("clientID", "OMBIv3");
|
|
|
|
|
request.AddQueryString("forwardUrl", "http://localhost:5000");
|
|
|
|
|
request.AddQueryString("context-device-product", "http://localhost:5000");
|
|
|
|
|
return new RedirectResult("https://app.plex.tv/auth#?forwardUrl=http://localhost:5000/api/v1/plexoauth&clientID=OMBIv3&context%5Bdevice%5D%5Bproduct%5D=Ombi%20SSO");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new UnauthorizedResult();
|
|
|
|
|
}
|
|
|
|
|