SaaS CMS has officially launched! Learn more now.

Class IdentityRegistrar<TUser>

This class will allow you to use asp.net identity for self registerd users

Inheritance
System.Object
IdentityRegistrar<TUser>
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Security
Assembly: EPiServer.Commerce.Security.dll
Version: 11.8.3
Syntax
public class IdentityRegistrar<TUser> : IRegistrar where TUser : class, IUser<string>
Type Parameters
Name Description
TUser

The type of the user.

Constructors

IdentityRegistrar(UserManager<TUser>)

Initializes a new instance of the IdentityRegistrar<TUser> class.

Declaration
public IdentityRegistrar(UserManager<TUser> userManager)
Parameters
Type Name Description
Microsoft.AspNet.Identity.UserManager<TUser> userManager

The user manager.

Properties

AuthenticationType

Gets the type of the authentication. This should be the Authentication type that is used when registering with the IOwinContext

Declaration
public string AuthenticationType { get; }
Property Value
Type Description
System.String

The type of the authentication.

Methods

ChangePassword(String, String, String)

Changes the password.

Declaration
public bool ChangePassword(string userName, string oldPassword, string newPassword)
Parameters
Type Name Description
System.String userName

Name of the user.

System.String oldPassword

The old password.

System.String newPassword

The new password.

Returns
Type Description
System.Boolean

True if the password was succesfully changed.

CreateIdentity(String)

Creates the identity.

Declaration
public ClaimsIdentity CreateIdentity(string userName)
Parameters
Type Name Description
System.String userName

Name of the user.

Returns
Type Description
System.Security.Claims.ClaimsIdentity

An System.Security.Claims.ClaimsIdentity for the username

CreateUser(String, String, String)

Creates the user.

Declaration
public ClaimsPrincipal CreateUser(string userName, string password, string email)
Parameters
Type Name Description
System.String userName

Name of the user.

System.String password

The password.

System.String email

The email of the user.

Returns
Type Description
System.Security.Claims.ClaimsPrincipal

An System.Security.Principal.IPrincipal for the newly created user

DeleteUser(String)

Deletes the user.

Declaration
public void DeleteUser(string userName)
Parameters
Type Name Description
System.String userName

Name of the user.

SignIn(AuthenticationProperties, ClaimsIdentity[])

Signs the user into the system.

Declaration
public void SignIn(AuthenticationProperties properties, params ClaimsIdentity[] identities)
Parameters
Type Name Description
Microsoft.Owin.Security.AuthenticationProperties properties

Contains additional properties the middleware are expected to persist along with the claims. These values will be returned as the AuthenticateResult.properties collection when AuthenticateAsync is called on subsequent requests.

System.Security.Claims.ClaimsIdentity[] identities

Contains additional properties the middleware are expected to persist along with the claims. These values will be returned as the AuthenticateResult.properties collection when AuthenticateAsync is called on subsequent requests..

ValidateUser(String, String)

Validates the identity.

Declaration
public bool ValidateUser(string userName, string password)
Parameters
Type Name Description
System.String userName

The username.

System.String password

The password.

Returns
Type Description
System.Boolean

True if the user was validated

Implements