public async Task <IdentityServerStoreAppliedInfo> DeleteClientIdsByUserIdAsync(string userId, IEnumerable <string> clientIds) { var result = await TryWithAwaitInCatch.ExecuteAndHandleErrorAsync( async() => { await ResilientSessionContainer.EstablishSessionAsync(); var query = from item in clientIds let c = new IdentityServerUserClientId() { ClientId = item, UserId = userId } select c; IdentityServerStoreAppliedInfo appliedInfo = null; foreach (var insertRecord in query) { appliedInfo = await ResilientSessionContainer.ResilientSession.DeleteClientIdFromUserAsync(insertRecord); if (appliedInfo.Applied == false || appliedInfo.Exception != null) { break; } } return(appliedInfo); }, async (ex) => ResilientSessionContainer.HandleCassandraException <IdentityServerStoreAppliedInfo>(ex)); return(result); }
public async Task <IdentityServerStoreAppliedInfo> AddScopesToIdentityServerUserAsync( string userId, IEnumerable <string> scopes) { var result = await TryWithAwaitInCatch.ExecuteAndHandleErrorAsync( async() => { await ResilientSessionContainer.EstablishSessionAsync(); var query = from item in scopes let c = new IdentityServerUserAllowedScope { ScopeName = item, UserId = userId } select c; IdentityServerStoreAppliedInfo appliedInfo = null; foreach (var insertRecord in query) { appliedInfo = await ResilientSessionContainer.ResilientSession.UpsertAllowedScopeIntoUsersAsync(insertRecord); if (appliedInfo.Applied == false || appliedInfo.Exception != null) { break; } } return(appliedInfo); }, async (ex) => ResilientSessionContainer.HandleCassandraException <IdentityServerStoreAppliedInfo>(ex)); return(result); }