Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
remove all but the last 4 chars in introspection events
Browse files Browse the repository at this point in the history
  • Loading branch information
leastprivilege committed Aug 21, 2016
1 parent 4664e9c commit 526e688
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/Core/Extensions/IEventServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,20 @@ public static async Task RaiseFailureEndpointEventAsync(this IEventService event

public static async Task RaiseSuccessfulIntrospectionEndpointEventAsync(this IEventService events, string token, string tokenStatus, string scopeName)
{
string last4chars = "****";
if (token.IsPresent() && token.Length > 4)
{
last4chars = token.Substring(token.Length - 4);
}

var evt = new Event<IntrospectionEndpointDetail>(
EventConstants.Categories.Endpoints,
"Introspection endpoint success",
EventTypes.Success,
EventConstants.Ids.IntrospectionEndpointSuccess,
new IntrospectionEndpointDetail
{
Token = token,
Token = "***" + last4chars,
TokenStatus = tokenStatus,
ScopeName = scopeName
});
Expand All @@ -495,14 +501,20 @@ public static async Task RaiseSuccessfulIntrospectionEndpointEventAsync(this IEv

public static async Task RaiseFailureIntrospectionEndpointEventAsync(this IEventService events, string error, string token, string scopeName)
{
string last4chars = "****";
if (token.IsPresent() && token.Length > 4)
{
last4chars = token.Substring(token.Length - 4);
}

var evt = new Event<IntrospectionEndpointDetail>(
EventConstants.Categories.Endpoints,
"Introspection endpoint failure",
EventTypes.Failure,
EventConstants.Ids.IntrospectionEndpointFailure,
new IntrospectionEndpointDetail
{
Token = token,
Token = "***" + last4chars,
ScopeName = scopeName
},
error);
Expand Down

0 comments on commit 526e688

Please sign in to comment.