1 out of 2 rated this helpful - Rate this topic

SignInRequestMessage Class

.NET Framework 4.5

Represents a WS-Federation Sign-In Request message.

Namespace:  System.IdentityModel.Services
Assembly:  System.IdentityModel.Services (in System.IdentityModel.Services.dll)
public class SignInRequestMessage : WSFederationMessage

The SignInRequestMessage type exposes the following members.

  NameDescription
Public methodSignInRequestMessage(Uri, String)Initializes a new instance of the SignInRequestMessage class with the specified base URL and wtrealm parameter.
Public methodSignInRequestMessage(Uri, String, String)Initializes a new instance of the SignInRequestMessage class using the specified base URI, wtrealm parameter, and wreply parameter. Supports non-standard message creation for backward compatibility.
Top
  NameDescription
Public propertyActionGets or sets the wa parameter of the message. (Inherited from WSFederationMessage.)
Public propertyAuthenticationTypeGets or sets the wauth parameter of the message.
Public propertyBaseUriGets or sets the base URL to which the message applies. (Inherited from FederationMessage.)
Public propertyContextGets or sets the wctx parameter of the message. (Inherited from WSFederationMessage.)
Public propertyCurrentTimeGets or sets the wct parameter of the message.
Public propertyEncodingGets or sets the wencoding parameter of the message. (Inherited from WSFederationMessage.)
Public propertyFederationGets or sets the wfed parameter of the message.
Public propertyFreshnessGets or sets the wfresh parameter of the message.
Public propertyHomeRealmGets or sets the whr parameter of the message.
Public propertyParametersGets the message parameters as a dictionary. (Inherited from FederationMessage.)
Public propertyPolicyGets or sets the wp parameter of the message.
Public propertyRealmGets or sets the wtrealm parameter of the message.
Public propertyReplyGets or sets the wreply parameter of the message.
Public propertyRequestGets or sets the wreq parameter of the message.
Public propertyRequestPtrGets or sets the wreqptr parameter of the message.
Public propertyRequestUrlGets a string representation of the URL that corresponds to this message.
Public propertyResourceGets or sets the wres parameter of the message.
Top
  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetParameterReturns the specified parameter value from the parameters dictionary. (Inherited from FederationMessage.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodRemoveParameterRemoves a parameter from the parameters dictionary. (Inherited from FederationMessage.)
Public methodSetParameterSets the value of a parameter in the parameters dictionary. (Inherited from FederationMessage.)
Public methodSetUriParameterSets the value of a parameter in the parameters dictionary. The value must be an absolute URI. (Inherited from FederationMessage.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodValidateValidates the current instance. (Overrides FederationMessage.Validate().)
Public methodWriteWrites this message in query string form to the specified text writer. (Overrides FederationMessage.Write(TextWriter).)
Public methodWriteFormPostSerializes the message as a form post and returns the resulting Form together with its Javascript as a string. (Inherited from FederationMessage.)
Public methodWriteQueryStringReturns a string representation of the message in query-string format. (Inherited from FederationMessage.)
Top

A WS-Federation sign-in message is sent by a relying party (RP) to a security token service (STS) to request a security token. The wa parameter must be set to “wsignout1.0” and the wtrealm parameter should be set to the security realm of the requested resource (this is often the URL of the requested resource). Other optional parameters may also be specified in the request.

A SignOutRequestMessage message is created by the static methods of the SignOutRequestMessage class, for example the CreateFromUri method, when the wa parameter is set to “wsignin1.0”, there is no wresult or wresultptr parameter present, and either a wtrealm parameter or a wreply parameter is present.

Important noteImportant

For backward compatibility with Active Directory Federation Services (AD FS) version 1.0, Windows Identity Foundation (WIF) allows either the wtrealm parameter or the wreply parameter to be set (or both) for a sign-in message to be valid; however, the WS-Federation protocol requires that the wtrealm parameter be present in a sign-in request. In most scenarios, you should ensure that the wtrealm parameter is specified.

The SignInRequestMessage class exposes several properties that can be used to set or access individual message parameters. These parameters can also be set or accessed through the Parameters dictionary. For example, you can read the wtrealm parameter in the message either through the Realm property or by specifying “wtrealm” as the key to the Parameters dictionary.

For more information about the message that this class represents, see section 13 of the following specification: Web Services Federation Language (WS-Federation) Version 1.2 (http://go.microsoft.com/fwlink/?LinkID=210152).

string identityProviderUri = Request.QueryString["whr"];
string action = Request.QueryString["wa"];

SignInRequestMessage signInRequest = FederatedAuthentication.WSFederationAuthenticationModule.CreateSignInRequest(Guid.NewGuid().ToString(), 
                                                                                                                  "http://MyAppreturnUrl", 
                                                                                                                  false);
signInRequest.Realm = "htp://MyApp.com";
signInRequest.HomeRealm = identityProviderUri;


Response.Redirect(signInRequest.RequestUrl);

.NET Framework

Supported in: 4.5.1, 4.5

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.