How is RoleManager.FindByNameAsync translated to identityserver db call?

Viewed 31

I am supporting a site that uses identityserver for authentication and I am trying to understand how it works. Periodically the site becomes bit slow and from appinsights I can see the endpoint which calls RoleManager.FindByNameAsync(name) randomly becomes slow.

Appinsights shows that FindByNameAsync will call our sql db:

SELECT [t].[Id], [t].[Email], [t].[FirstName], [t].[LastName], [t].[UserName], [t].[CreatedAtUtc] AS [CreatedAt], [t].[EmailConfirmed], [t].[LastLoginUtc] AS [LastLogin], [t].[LockoutEnabled], [t].[LockoutEnd] AS [LockoutEndDateUtc], [claim].[ClaimType] AS [Type], [claim].[ClaimValue] AS [Value], [claim].[Id] AS [Id0]
FROM [UserClaims] AS [claim]
INNER JOIN (
    SELECT [user].*
    FROM [Users] AS [user]
    WHERE [user].[Id] IN (
        SELECT [claim0].[UserId]
        FROM [UserClaims] AS [claim0]
        WHERE ([claim0].[ClaimType] = @__type_0) AND ([claim0].[ClaimValue] = @__value_1)
    )
) AS [t] ON [claim].[UserId] = [t].[Id]

The db call itself is not slow (100ms at max), so I am guessing the c# code is doing something.

How RoleManager.FindByNameAsync is integrated with identityserver? RoleManager is a Microsoft extension and I didn't really find a setting in our config which links identityserver to this (admit that I am quite new with identityserver).

0 Answers
Related