-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from aguacongas/master
Redis store and concurrency check
- Loading branch information
Showing
33 changed files
with
873 additions
and
894 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,4 +332,6 @@ ASALocalRun/ | |
.mfractor/ | ||
/ReportGenerator | ||
/coverage/docs | ||
coverage.* | ||
coverage.* | ||
|
||
*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
sample/Aguacongas.AspNetCore.Authentication.Sample/SchemeChangeSubscriberSample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Aguacongas.AspNetCore.Authentication.Sample | ||
{ | ||
/// <summary> | ||
/// Subsribe to scheme change notifications | ||
/// </summary> | ||
public class SchemeChangeSubscriber | ||
{ | ||
private readonly NoPersistentDynamicManager<SchemeDefinition> _manager; | ||
private readonly IDynamicProviderStore<SchemeDefinition> _store; | ||
|
||
public SchemeChangeSubscriber(NoPersistentDynamicManager<SchemeDefinition> manager, IDynamicProviderStore<SchemeDefinition> store) | ||
{ | ||
_manager = manager; | ||
_store = store; | ||
} | ||
|
||
/// <summary> | ||
/// Called when scheme change. | ||
/// </summary> | ||
/// <param name="change">The change.</param> | ||
/// <returns></returns> | ||
public async Task OnSchemeChange(SchemeChange change) | ||
{ | ||
var definition = await _store.FindBySchemeAsync(change.Scheme); | ||
switch(change.Kind) | ||
{ | ||
case SchemeChangeKind.Added: | ||
await _manager.AddAsync(definition); | ||
break; | ||
case SchemeChangeKind.Updated: | ||
await _manager.UpdateAsync(definition); | ||
break; | ||
case SchemeChangeKind.Deleted: | ||
await _manager.RemoveAsync(change.Scheme); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public enum SchemeChangeKind | ||
{ | ||
Added, | ||
Updated, | ||
Deleted | ||
} | ||
|
||
public class SchemeChange | ||
{ | ||
public string Scheme { get; set; } | ||
public SchemeChangeKind Kind { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.