public static FormsAuthenticationProvider CreateWithRouteRedirectOnFailedAuthentication(IFormsAuthenticationHelper helper, IUrlResolver urlResolver, Guid routeId, string returnUrlQueryStringField = "ReturnURL")
        {
            helper.ThrowIfNull("helper");
            urlResolver.ThrowIfNull("urlResolver");
            if (returnUrlQueryStringField == "")
            {
                throw new ArgumentException("Return URL query string field cannot be an empty string.", "returnUrlQueryStringField");
            }

            return new FormsAuthenticationProvider(helper, () => urlResolver.Route(routeId), returnUrlQueryStringField);
        }
Exemplo n.º 2
0
 public AutoRouteCollection FormsAuthenticationWithRouteRedirectWhenAttributePresent(IFormsAuthenticationHelper helper, IUrlResolver urlResolver, Guid routeId, string returnUrlQueryStringField = "ReturnURL")
 {
     return(Authenticate(FormsAuthenticationProvider.CreateWithRouteRedirectOnFailedAuthentication(helper, urlResolver, routeId, returnUrlQueryStringField), new AuthenticateAttributeStrategy()));
 }
Exemplo n.º 3
0
 public AutoRouteCollection FormsAuthenticationWithNoRedirectWhenAttributePresent(IFormsAuthenticationHelper helper)
 {
     return(Authenticate(FormsAuthenticationProvider.CreateWithNoRedirectOnFailedAuthentication(helper), new AuthenticateAttributeStrategy()));
 }
        public static FormsAuthenticationProvider CreateWithNoRedirectOnFailedAuthentication(IFormsAuthenticationHelper helper)
        {
            helper.ThrowIfNull("helper");

            return new FormsAuthenticationProvider(helper);
        }
 private FormsAuthenticationProvider(IFormsAuthenticationHelper helper, Func<string> failedAuthenticationRedirectAbsoluteUrlDelegate = null, string returnUrlQueryStringField = null)
 {
     _helper = helper;
     _failedAuthenticationRedirectAbsoluteUrlDelegate = failedAuthenticationRedirectAbsoluteUrlDelegate;
     _returnUrlQueryStringField = returnUrlQueryStringField;
 }