Created
July 19, 2012 22:37
-
-
Save sandrinodimattia/3147346 to your computer and use it in GitHub Desktop.
Custom RequestValidator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web; | |
using System.Web.Util; | |
using Microsoft.IdentityModel.Protocols.WSFederation; | |
namespace Sandrino.SomeAzureApplication | |
{ | |
public class AccessControlRequestValidator : RequestValidator | |
{ | |
protected override bool IsValidRequestString(HttpContext context, string value, RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex) | |
{ | |
validationFailureIndex = 0; | |
if (requestValidationSource == RequestValidationSource.Form && collectionKey.Equals(WSFederationConstants.Parameters.Result, StringComparison.Ordinal)) | |
{ | |
var message = WSFederationMessage.CreateFromFormPost(context.Request) as SignInResponseMessage; | |
if (message != null) | |
return true; | |
} | |
return base.IsValidRequestString(context, value, requestValidationSource, collectionKey, out validationFailureIndex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment