Fixes: U4-4819 Publicize AuthenticationExtensions
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Umbraco.Core.Security
|
||||
/// <summary>
|
||||
/// Extensions to create and renew and remove authentication tickets for the Umbraco back office
|
||||
/// </summary>
|
||||
internal static class AuthenticationExtensions
|
||||
public static class AuthenticationExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// This will check the ticket to see if it is valid, if it is it will set the current thread's user and culture
|
||||
@@ -130,10 +130,10 @@ namespace Umbraco.Core.Security
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This clears the forms authentication cookie
|
||||
/// This clears the forms authentication cookie for webapi since cookies are handled differently
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
public static void UmbracoLogout(this HttpResponseMessage response)
|
||||
public static void UmbracoLogoutWebApi(this HttpResponseMessage response)
|
||||
{
|
||||
if (response == null) throw new ArgumentNullException("response");
|
||||
//remove the cookie
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Umbraco.Core.Security
|
||||
/// </summary>
|
||||
[DataContract(Name = "userData", Namespace = "")]
|
||||
[Serializable]
|
||||
internal class UserData
|
||||
public class UserData
|
||||
{
|
||||
public UserData()
|
||||
{
|
||||
|
||||
@@ -105,9 +105,9 @@ namespace Umbraco.Web.Security
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns>returns the number of seconds until their session times out</returns>
|
||||
internal FormsAuthenticationTicket PerformLogin(IUser user)
|
||||
public FormsAuthenticationTicket PerformLogin(IUser user)
|
||||
{
|
||||
var ticket = _httpContext.CreateUmbracoAuthTicket(new UserData(Guid.NewGuid().ToString("N"))
|
||||
var ticket = _httpContext.CreateUmbracoAuthTicket(new UserData()
|
||||
{
|
||||
Id = user.Id,
|
||||
AllowedApplications = user.AllowedSections.ToArray(),
|
||||
@@ -147,7 +147,7 @@ namespace Umbraco.Web.Security
|
||||
/// <param name="username"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
internal bool ValidateBackOfficeCredentials(string username, string password)
|
||||
public bool ValidateBackOfficeCredentials(string username, string password)
|
||||
{
|
||||
var membershipProvider = Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider();
|
||||
return membershipProvider != null && membershipProvider.ValidateUser(username, password);
|
||||
@@ -159,7 +159,7 @@ namespace Umbraco.Web.Security
|
||||
/// <param name="username"></param>
|
||||
/// <param name="setOnline"></param>
|
||||
/// <returns></returns>
|
||||
internal MembershipUser GetBackOfficeMembershipUser(string username, bool setOnline)
|
||||
public MembershipUser GetBackOfficeMembershipUser(string username, bool setOnline)
|
||||
{
|
||||
var membershipProvider = Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider();
|
||||
return membershipProvider != null ? membershipProvider.GetUser(username, setOnline) : null;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Web.WebApi.Filters
|
||||
{
|
||||
if (context.Response == null) return;
|
||||
if (context.Response.IsSuccessStatusCode == false) return;
|
||||
context.Response.UmbracoLogout();
|
||||
context.Response.UmbracoLogoutWebApi();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user