Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Provides an IdentityServer event sink to add audit records into AdminUI.

- For IdentityServer4 support, use [Rsk.IdentityServer4.AuditEventSink](https://www.nuget.org/packages/RSK.IdentityServer4.AuditEventSink/)
- For Duende IdentityServer support, use [Rsk.DuendeIdentityServer.AuditEventSink](https://www.nuget.org/packages/RSK.DuendeIdentityServer.AuditEventSink/)
- For Duende IdentityServer support, use [Rsk.DuendeIdentityServer.AuditEventSink](https://www.nuget.org/packages/Rsk.DuendeIdentityServer.AuditEventSink/)
- For Open.IdentityServer support, use [Rsk.Open.IdentityServer.AuditEventSink](https://www.nuget.org/packages/Rsk.Open.IdentityServer.AuditEventSink/)

## How Does It Work?

Expand All @@ -23,7 +23,7 @@ services.AddIdentityServer(options =>
});
```

Now you can use the event sink structure within IdentityServer and funnel the events into the AdminUI audit process. We do this in the following way;
Now you can use the event sink structure in IdentityServer to funnel events into the AdminUI audit process. We do this in the following way;

```csharp
var dbContextOptionsBuilder = new DbContextOptionsBuilder<AuditDatabaseContext>();
Expand All @@ -35,13 +35,13 @@ var auditRecorder = auditFactory.CreateAuditSource("IdentityServer");
services.AddSingleton<IEventSink>(provider => new AuditSink(auditRecorder));
```

Lets review what the code actually does. The initial section of code sets up the AdminUI audit recorder, this acts as our funnel, and it directs the events into the audit tables used by AdminUI.
Let's review what the code actually does. The initial section of code sets up the AdminUI audit recorder, which serves as our funnel and directs events to the audit tables used by AdminUI.

The AuditSink acts as our conduit between the two, by accepting the events raised by IdentityServer and funnelling them over to the AdminUI audit process.

## Event Sink Aggregator

One of the small things missing in the event sink process within IdentityServer is the ability to use more than one sink. As we always like to go that little further we have also created an sink aggregator, which you can use in the following way;
One small thing missing in the event sink process within IdentityServer is the ability to use multiple sinks. As we always like to go that little further, we have also created a sink aggregator, which you can use in the following way;

```csharp
services.AddSingleton<IEventSink>(provider => new EventSinkAggregator(_loggerFactory.CreateLogger("EventSinkAggregator"))
Expand All @@ -54,11 +54,11 @@ services.AddSingleton<IEventSink>(provider => new EventSinkAggregator(_loggerFac
});
```

As you can see from this code our EventSinkAggreator allows you to have more than one event sink in play without one affecting the other. So, if for any reason, an event sink raises and exception we log that information and ensure all other event sinks in the aggregator still get notified of the IdentityServer events.
As you can see from this code, our EventSinkAggregator allows you to have more than one event sink in play without one affecting the other. So, if for any reason an event sink raises an exception, we log the exception and ensure that all other event sinks in the aggregator are still notified of IdentityServer events.

## AuditSink Events

When you review the documentation for the events raised by IdentityServer [see here](http://docs.identityserver.io/en/latest/topics/events.html) you will see that there are a number of useful events which are a great addition to the AdminUI Audit records, however there are a few which don’t fit in. Due to this, the AuditSink will only handle the following events;
When you review the documentation for the events raised by IdentityServer [see here](http://docs.identityserver.io/en/latest/topics/events.html), you will see that there are a number of useful events which are a great addition to the AdminUI Audit records; there are a few which don’t fit in. Due to this, the AuditSink will only handle the following events;

- TokenIssuedSuccessEvent and TokenIssuedFailureEvent
- UserLoginSuccessEvent and UserLoginFailureEvent
Expand Down
Loading