public virtual LoginFormViewModel Authenticate(LoginFormViewModel input, HttpContextBase context) { input.LoginError = false; if (Config.Get <SecurityConfig>().AuthenticationMode == SecConfig.AuthenticationMode.Claims) { var owinContext = context.Request.GetOwinContext(); var challengeProperties = ChallengeProperties.ForLocalUser(input.UserName, input.Password, this.MembershipProvider, input.RememberMe, context.Request.Url.ToString()); challengeProperties.RedirectUri = this.GetReturnURL(context); owinContext.Authentication.Challenge(challengeProperties, ClaimsManager.CurrentAuthenticationModule.STSAuthenticationType); } else { User user; UserLoggingReason result = SecurityManager.AuthenticateUser( this.MembershipProvider, input.UserName, input.Password, input.RememberMe, out user); if (result != UserLoggingReason.Success) { input.LoginError = true; } else { input.RedirectUrlAfterLogin = this.GetReturnURL(context); } } return(input); }
public virtual LoginFormViewModel Authenticate(LoginFormViewModel input, HttpContextBase context) { input.LoginError = false; if (Config.Get <SecurityConfig>().AuthenticationMode == SecConfig.AuthenticationMode.Claims) { var owinContext = context.Request.GetOwinContext(); string errorRedirectUrl; if (context.Request.UrlReferrer?.AbsoluteUri != null) { errorRedirectUrl = context.Request.UrlReferrer.AbsoluteUri; var param = context.Request.Params[MvcControllerProxy.ControllerKey]; if (param != null) { var uriBuilder = new UriBuilder(errorRedirectUrl); var query = HttpUtility.ParseQueryString(uriBuilder.Query); query[LoginControllerKey] = param; uriBuilder.Query = query.ToString(); errorRedirectUrl = uriBuilder.ToString(); } } else { errorRedirectUrl = context.Request.Url.ToString(); } var challengeProperties = ChallengeProperties.ForLocalUser(input.UserName, input.Password, this.MembershipProvider, input.RememberMe, errorRedirectUrl); challengeProperties.RedirectUri = this.GetReturnURL(context); owinContext.Authentication.Challenge(challengeProperties, ClaimsManager.CurrentAuthenticationModule.STSAuthenticationType); } else { User user; UserLoggingReason result = SecurityManager.AuthenticateUser( this.MembershipProvider, input.UserName, input.Password, input.RememberMe, out user); if (result != UserLoggingReason.Success) { input.LoginError = true; } else { input.RedirectUrlAfterLogin = this.GetReturnURL(context); } } return(input); }
public virtual LoginFormViewModel Authenticate(LoginFormViewModel input, HttpContextBase context) { input.LoginError = false; string errorRedirectUrl = GetErrorRedirectUrl(context); if (Config.Get <SecurityConfig>().AuthenticationMode == SecConfig.AuthenticationMode.Claims && ClaimsManager.CurrentAuthenticationModule.AuthenticationProtocol != "Default") { var owinContext = context.Request.GetOwinContext(); var challengeProperties = ChallengeProperties.ForLocalUser(input.UserName, input.Password, this.MembershipProvider, input.RememberMe, errorRedirectUrl); challengeProperties.RedirectUri = this.GetReturnURL(context); owinContext.Authentication.Challenge(challengeProperties, ClaimsManager.CurrentAuthenticationModule.STSAuthenticationType); } else { var redirectUrl = this.GetReturnURL(context); User user; UserLoggingReason result = SecurityManager.AuthenticateUser( this.MembershipProvider, input.UserName, input.Password, input.RememberMe, out user); if (result != UserLoggingReason.Success) { if (ClaimsManager.CurrentAuthenticationModule.AuthenticationProtocol == "Default") { errorRedirectUrl = AddErrorParameterToQuery(errorRedirectUrl); SFClaimsAuthenticationManager.ProcessRejectedUserForDefaultClaimsLogin(context, result, user, input.RememberMe, redirectUrl, errorRedirectUrl); } input.LoginError = true; } else { if (ClaimsManager.CurrentAuthenticationModule.AuthenticationProtocol == "Default") { redirectUrl = RemoveErrorParameterFromQuery(redirectUrl); } input.RedirectUrlAfterLogin = redirectUrl; SystemManager.CurrentHttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties { RedirectUri = redirectUrl }); } } return(input); }
private ThumbnailProfileConfigElement DefaultAlbumThumbnailProfile(string thumbnailName) { if (!string.IsNullOrWhiteSpace(thumbnailName)) { var profiles = Config.Get <LibrariesConfig>().Images.Thumbnails.Profiles; if (profiles.ContainsKey(thumbnailName)) { var thumbnailProfile = profiles[thumbnailName]; return(thumbnailProfile); } } return(null); }
/// <summary> /// Gets the selected size URL. /// </summary> /// <param name="image">The image.</param> /// <returns></returns> protected virtual string GetSelectedSizeUrl(SfImage image, ImageSizeModel sizeModel) { if (image.Id == Guid.Empty) { return(string.Empty); } string imageUrl; var urlAsAbsolute = Config.Get <SystemConfig>().SiteUrlSettings.GenerateAbsoluteUrls; if (sizeModel.DisplayMode == ImageDisplayMode.Thumbnail && !string.IsNullOrWhiteSpace(sizeModel.Thumbnail.Name)) { imageUrl = image.ResolveThumbnailUrl(sizeModel.Thumbnail.Name, urlAsAbsolute); } else { var originalImageUrl = image.ResolveMediaUrl(urlAsAbsolute); imageUrl = originalImageUrl; } return(imageUrl); }