Share via


SecurityTokenService.ValidateRequest Method

[Starting with the .NET Framework 4.5, Windows Identity Foundation (WIF) has been fully integrated into the .NET Framework. The version of WIF addressed by this topic, WIF 3.5, is deprecated and should only be used when developing against the .NET Framework 3.5 SP1 or the .NET Framework 4. For more information about WIF in the .NET Framework 4.5, also known as WIF 4.5, see the Windows Identity Foundation documentation in the .NET Framework 4.5 Development Guide.]

Validates the security token request (RST) encapsulated by this instance.

Namespace: Microsoft.IdentityModel.SecurityTokenService
Assembly: Microsoft.IdentityModel (in Microsoft.IdentityModel.dll)

Usage

'Usage
Dim request As RequestSecurityToken

Me.ValidateRequest(request)

Syntax

'Declaration
Protected Overridable Sub ValidateRequest ( _
    request As RequestSecurityToken _
)
protected virtual void ValidateRequest (
    RequestSecurityToken request
)
protected:
virtual void ValidateRequest (
    RequestSecurityToken^ request
)
protected void ValidateRequest (
    RequestSecurityToken request
)
protected function ValidateRequest (
    request : RequestSecurityToken
)

Parameters

Exceptions

Exception type Condition
InvalidRequestException

request is null.

-or-

The RequestType property of the request is not set to RequestTypes.Issue.

-or-

The KeyType property of the request is not null or one of the constants defined in the Microsoft.IdentityModel.SecurityTokenService.KeyTypes class.

-or-

The KeyType of the request is Bearer and the KeySize element is present, but its value is not equal to zero.

UnsupportedTokenTypeBadRequestException

The STS does not support the request token type (based on the value of the TokenType property of the request).

Remarks

The ValidateRequest method is called from the token issuance pipeline (the Issue method) to validate the incoming RST. The RST is validated against the requirements (policy) of the STS and an appropriate exception is thrown if it is not valid.

The default implementation of the SecurityTokenService class supports only the RST-RSTR pattern and only the Issue binding of the WS-Trust specification (the RequestType property of the request must be set to RequestTypes.Issue). The default implementation of this method enforces these requirements (and others noted in the exceptions section). You can override this method if you must enforce different validation requirements for your custom STS.

For more information about the token issuance pipeline, see the Claims Issuance Pipeline topic.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Target Platforms

Windows 7, Windows Server 2008 R2, Windows Vista SP2, Windows Server 2008 SP2, Windows Server 2003 SP2 (32-bit or 64-bit)

See Also

Reference

SecurityTokenService Class
SecurityTokenService Members
Microsoft.IdentityModel.SecurityTokenService Namespace
SecurityTokenService.Issue Method

Other Resources

Claims Issuance Pipeline

Copyright © 2008 by Microsoft Corporation. All rights reserved.