November Happy Hour will be moved to Thursday December 5th.

Class SynchronizingUserService

NOTE: This is a pre-release API that is UNSTABLE and might not satisfy the compatibility requirements as denoted by its associated normal version. Service that can be used to synchronize users and roles for later retrieval.

Inheritance
System.Object
SynchronizingUserService
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.Security
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[ServiceConfiguration(typeof(SynchronizingUserService))]
[ServiceConfiguration(typeof(ISynchronizingUserService))]
[ServiceConfiguration(typeof(IQueryablePreference))]
public class SynchronizingUserService : IQueryableNotificationUsers, IQueryablePreference, ISynchronizingUserService

Constructors

SynchronizingUserService()

Initializes a new instance of the SynchronizingUserService class.

Declaration
public SynchronizingUserService()

Properties

SynchronizedClaims

The claims that will be synchronized in DB.

Declaration
public static IList<string> SynchronizedClaims { get; }
Property Value
Type Description
System.Collections.Generic.IList<System.String>

Methods

ClearRoles(String)

Clears all previously synched roles for a user.

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

FindRoles(String)

Finds all roles that has a matching name. if null is passed in all roles are returned.

Declaration
public virtual IEnumerable<string> FindRoles(string partOfName)
Parameters
Type Name Description
System.String partOfName

The name to match, '%' is wildcard symbol.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

A list of matching roles.

FindUsers(String)

Finds all users that has a matching name or email. if null is passed in all users are returned.

Declaration
public virtual IEnumerable<string> FindUsers(string partOfName)
Parameters
Type Name Description
System.String partOfName

The name or email to match, '%' is wildcard symbol.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

A list of matching user names.

GetRolesForUser(String)

Retrieves all synched roles for given user.

Declaration
public virtual IEnumerable<string> GetRolesForUser(string userName)
Parameters
Type Name Description
System.String userName

The name of the synched user.

Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

A list of all synched roles for the user.

HideRole(String)

A synched role can be hidden, meaning it will not be returned from FindRoles.

Declaration
public virtual void HideRole(string role)
Parameters
Type Name Description
System.String role

The role to hide

ListRoleStatus()

List all synched roles together with their current status.

Declaration
public virtual IEnumerable<SynchronizedRoleStatus> ListRoleStatus()
Returns
Type Description
System.Collections.Generic.IEnumerable<SynchronizedRoleStatus>

A list of synched role and their status.

ShowRole(String)

Call to show a previously hidden role in FindRoles.

Declaration
public virtual void ShowRole(string role)
Parameters
Type Name Description
System.String role

The role that should shown.

Synchronize(ClaimsIdentity)

Synchronizes a claims identity to the database

Declaration
public virtual void Synchronize(ClaimsIdentity identity)
Parameters
Type Name Description
System.Security.Claims.ClaimsIdentity identity

The claims identity

Synchronize(ClaimsIdentity, IEnumerable<String>)

Synchronizes a claims identity to the database

Declaration
public virtual void Synchronize(ClaimsIdentity identity, IEnumerable<string> additionalClaimsToSync)
Parameters
Type Name Description
System.Security.Claims.ClaimsIdentity identity

The claims identity

System.Collections.Generic.IEnumerable<System.String> additionalClaimsToSync
Remarks

By default is claims such as role claims and System.Security.Claims.ClaimTypes.Email synched. additionalClaimsToSync can be specified to synchronize additional claims. This can be used for example to sync a phone number which then can be used by notification system.

SynchronizeAsync(ClaimsIdentity)

Synchronizes a claims identity to the database

Declaration
public virtual Task SynchronizeAsync(ClaimsIdentity identity)
Parameters
Type Name Description
System.Security.Claims.ClaimsIdentity identity

The claims identity

Returns
Type Description
System.Threading.Tasks.Task

SynchronizeAsync(ClaimsIdentity, IEnumerable<String>)

Synchronizes a claims identity to the database

Declaration
public virtual Task SynchronizeAsync(ClaimsIdentity identity, IEnumerable<string> additionalClaimsToSync)
Parameters
Type Name Description
System.Security.Claims.ClaimsIdentity identity

The claims identity

System.Collections.Generic.IEnumerable<System.String> additionalClaimsToSync
Returns
Type Description
System.Threading.Tasks.Task
Remarks

By default is claims such as role claims and System.Security.Claims.ClaimTypes.Email synched. additionalClaimsToSync can be specified to synchronize additional claims. This can be used for example to sync a phone number which then can be used by notification system.

SynchronizeUserAndRoles(String, IEnumerable<String>)

Synchronizes a user and his/her roles.

Declaration
public virtual void SynchronizeUserAndRoles(string userName, IEnumerable<string> roles)
Parameters
Type Name Description
System.String userName

The username

System.Collections.Generic.IEnumerable<System.String> roles

The roles for the user

Explicit Interface Implementations

IQueryableNotificationUsers.FindAsync(String, Int32, Int32)

Asynchronously finds users by criterion.

Declaration
Task<PagedNotificationUserResult> IQueryableNotificationUsers.FindAsync(string partOfUser, int pageIndex, int pageSize)
Parameters
Type Name Description
System.String partOfUser

Part of username, Email or displayname.

System.Int32 pageIndex

The index of the page of results to return. pageIndex is zero-based.

System.Int32 pageSize

The size of the page of results to return.

Returns
Type Description
System.Threading.Tasks.Task<PagedNotificationUserResult>

A PagedNotificationUserResult collection that contains a page of pageSize INotificationUser objects beginning at the page specified by pageIndex and total objects.

Implements

Extension Methods