Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Allow user to pass customized handlers (fixes #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarbettini committed Sep 14, 2016
1 parent 5a12652 commit d58da4d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/Stormpath.AspNet/StormpathAppBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ public static IAppBuilder UseStormpath(this IAppBuilder app, StormpathMiddleware
Configuration = options?.Configuration,
ConfigurationFileRoot = AppDomain.CurrentDomain.BaseDirectory,
Logger = options?.Logger,
CacheProvider = options?.CacheProvider
CacheProvider = options?.CacheProvider,
PostChangePasswordHandler = options?.PostChangePasswordHandler,
PostLoginHandler = options?.PostLoginHandler,
PostLogoutHandler = options?.PostLogoutHandler,
PostRegistrationHandler = options?.PostRegistrationHandler,
PostVerifyEmailHandler = options?.PostVerifyEmailHandler,
PreChangePasswordHandler = options?.PreChangePasswordHandler,
PreLoginHandler = options?.PreLoginHandler,
PreLogoutHandler = options?.PreLogoutHandler,
PreRegistrationHandler = options?.PreRegistrationHandler,
PreVerifyEmailHandler = options?.PreVerifyEmailHandler,
});

app.Use(stormpathMiddleware);
Expand Down
26 changes: 25 additions & 1 deletion src/Stormpath.AspNet/StormpathMiddlewareOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Stormpath.SDK.Cache;
using System;
using System.Threading;
using System.Threading.Tasks;
using Stormpath.Owin.Middleware;
using Stormpath.SDK.Cache;
using Stormpath.SDK.Logging;

namespace Stormpath.AspNet
Expand All @@ -10,5 +14,25 @@ public sealed class StormpathMiddlewareOptions
public ILogger Logger { get; set; }

public ICacheProviderBuilder CacheProvider { get; set; }

public Func<PreChangePasswordContext, CancellationToken, Task> PreChangePasswordHandler { get; set; }

public Func<PostChangePasswordContext, CancellationToken, Task> PostChangePasswordHandler { get; set; }

public Func<PreLoginContext, CancellationToken, Task> PreLoginHandler { get; set; }

public Func<PostLoginContext, CancellationToken, Task> PostLoginHandler { get; set; }

public Func<PreLogoutContext, CancellationToken, Task> PreLogoutHandler { get; set; }

public Func<PostLogoutContext, CancellationToken, Task> PostLogoutHandler { get; set; }

public Func<PreRegistrationContext, CancellationToken, Task> PreRegistrationHandler { get; set; }

public Func<PostRegistrationContext, CancellationToken, Task> PostRegistrationHandler { get; set; }

public Func<PreVerifyEmailContext, CancellationToken, Task> PreVerifyEmailHandler { get; set; }

public Func<PostVerifyEmailContext, CancellationToken, Task> PostVerifyEmailHandler { get; set; }
}
}

0 comments on commit d58da4d

Please sign in to comment.