SPFormsUserNameSecurityTokenHandler.CreateSecurityToken Method (String, String, String, String)
Creates a security token that is based on the specified membership provider, role provider, user name, and password.
Namespace: Microsoft.SharePoint.IdentityModel
Assembly: Microsoft.SharePoint.IdentityModel (in Microsoft.SharePoint.IdentityModel.dll)
Syntax
'Declaration
Public Shared Function CreateSecurityToken ( _
membershipProviderName As String, _
roleProviderName As String, _
username As String, _
password As String _
) As UserNameSecurityToken
'Usage
Dim membershipProviderName As String
Dim roleProviderName As String
Dim username As String
Dim password As String
Dim returnValue As UserNameSecurityToken
returnValue = SPFormsUserNameSecurityTokenHandler.CreateSecurityToken(membershipProviderName, _
roleProviderName, username, password)
public static UserNameSecurityToken CreateSecurityToken(
string membershipProviderName,
string roleProviderName,
string username,
string password
)
Parameters
membershipProviderName
Type: System.StringThe name of the membership provider that provides password validation logic.
roleProviderName
Type: System.StringThe name of the role provider to use for authorization.
username
Type: System.StringThe name of the user for whom the security token is created.
password
Type: System.StringThe password for the user.
Return Value
Type: System.IdentityModel.Tokens.UserNameSecurityToken
The security token.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | membershipProviderName is null . |
ArgumentException | membershipProviderName is an empty string. |
Remarks
This method formats the values of the membershipProviderName and roleProviderName parameters to create the new security token.
See Also
Reference
SPFormsUserNameSecurityTokenHandler Class