|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Net;
using System.Web;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Web.Security;
using Signum.Utilities;
using System.Web.Routing;
using Signum.Engine.Exceptions;
namespace Signum.Web
{
/// <summary>
/// Checks the User's authentication using FormsAuthentication
/// and redirects to the Login Url for the application on fail
/// </summary>
public class AuthenticationRequiredAttribute : AuthorizeAttribute
{
public AuthenticationRequiredAttribute()
{
Required = true;
}
public AuthenticationRequiredAttribute(bool required)
{
this.Required = required;
}
public bool Required { get; set; }
public static Action<AuthorizationContext> Authenticate;
public override void OnAuthorization(AuthorizationContext filterContext)
{
if (Required && Authenticate != null)
{
Authenticate(filterContext);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.
www.signumframework.com
I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...