Skip to content

Commit fe97d41

Browse files
committed
Remove data conenction cache
1 parent 1928feb commit fe97d41

File tree

4 files changed

+1
-118
lines changed

4 files changed

+1
-118
lines changed

src/IdentityServer/src/Abstractions/Stores/IUserDataConnectorDataRepository.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/IdentityServer/src/IdentityServer.Core/DataConnector/UserDataConnectorService.cs

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public class UserDataConnectorService : IUserDataConnectorService
2020
{
2121
private readonly ILogger<UserDataConnectorService> _logger;
2222
private readonly IEnumerable<IUserDataConnector> _connectors;
23-
private readonly IUserDataConnectorDataRepository _repository;
2423
private readonly IEventService _eventService;
2524

2625
private static readonly Dictionary<string, ConnectorProfileType> ProfileTypeMap
@@ -34,12 +33,10 @@ private static readonly Dictionary<string, ConnectorProfileType> ProfileTypeMap
3433
public UserDataConnectorService(
3534
ILogger<UserDataConnectorService> logger,
3635
IEnumerable<IUserDataConnector> connectors,
37-
IUserDataConnectorDataRepository repository,
3836
IEventService eventService)
3937
{
4038
_logger = logger;
4139
_connectors = connectors;
42-
_repository = repository;
4340
_eventService = eventService;
4441
}
4542

@@ -108,7 +105,7 @@ private async Task<IEnumerable<Claim>> LoadDataAsync(
108105
IUserDataConnector? connector = _connectors
109106
.Single(x => x.Name == options.Name);
110107

111-
var timeOutToken = new CancellationTokenSource(Debugger.IsAttached ? 300000 : 5000);
108+
var timeOutToken = new CancellationTokenSource(300000);
112109

113110
CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(
114111
cancellationToken,
@@ -121,58 +118,9 @@ private async Task<IEnumerable<Claim>> LoadDataAsync(
121118

122119
activity?.EnrichDataConnectorResult(result);
123120

124-
if (result.Success && result.Executed && result.CacheKey != null)
125-
{
126-
try
127-
{
128-
await SaveDataAsync(options, result, context.Subject, cancellationToken);
129-
}
130-
catch (Exception ex)
131-
{
132-
_logger.DataConnectorSaveDataFailed(connector.Name);
133-
activity?.RecordException(ex);
134-
}
135-
}
136-
else if (!result.Success && result.CacheKey != null)
137-
{
138-
UserDataConnectorData? storedData = await _repository.GetAsync(
139-
result.CacheKey,
140-
connector.Name,
141-
cancellationToken);
142-
143-
if (storedData != null)
144-
{
145-
claims = storedData.Claims.Select(x => new Claim(x.Type, x.Value));
146-
}
147-
else
148-
{
149-
throw result.Error;
150-
}
151-
}
152-
153121
return claims;
154122
}
155123

156-
private async Task SaveDataAsync(
157-
DataConnectorOptions options,
158-
UserDataConnectorResult result,
159-
string subject,
160-
CancellationToken cancellationToken)
161-
{
162-
await _repository.SaveAsync(new UserDataConnectorData
163-
{
164-
Claims = result.Claims.Select(x => new ClaimData
165-
{
166-
Type = x.Type,
167-
Value = x.Value
168-
}),
169-
Key = result.CacheKey!,
170-
SubjectId = subject,
171-
Connector = options.Name,
172-
LastModifiedAt = DateTime.UtcNow
173-
}, cancellationToken);
174-
}
175-
176124
private bool ShouldExecute(DataConnectorOptions options, string caller)
177125
{
178126
return options.Enabled &&

src/IdentityServer/src/Store.Mongo/MongoStoreServiceCollectionExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ public static IServiceCollection AddMongoStores(
5151
services.AddSingleton<IIdentityResourceRepository, IdentityResourceRepository>();
5252
services.AddSingleton<IPersonalAccessTokenRepository, PersonalAccessTokenRepository>();
5353
services.AddSingleton<IUserClaimRuleRepository, UserClaimRuleRepository>();
54-
services.AddSingleton<
55-
IUserDataConnectorDataRepository,
56-
UserDataConnectorDataRepository>();
5754

5855
return services;
5956
}

src/IdentityServer/src/Store.Mongo/UserDataConnectorDataRepository.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)