Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

Commit

Permalink
preserving the existing appbuilder properties and conventions inside …
Browse files Browse the repository at this point in the history
…the middleware
  • Loading branch information
tugberkugurlu committed Nov 25, 2015
1 parent d983c78 commit 8358d0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static IAppBuilder UseIdentityServerBearerTokenAuthentication(this IAppBu
middlewareOptions.TokenProvider = options.TokenProvider;
}

app.Use<IdentityServerBearerTokenValidationMiddleware>(middlewareOptions, loggerFactory);
app.Use<IdentityServerBearerTokenValidationMiddleware>(app, middlewareOptions, loggerFactory);

if (options.RequiredScopes.Any())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,26 @@ public class IdentityServerBearerTokenValidationMiddleware
/// Initializes a new instance of the <see cref="IdentityServerBearerTokenValidationMiddleware" /> class.
/// </summary>
/// <param name="next">The next middleware.</param>
/// <param name="app">The app builder.</param>
/// <param name="options">The options.</param>
/// <param name="loggerFactory">The logger factory.</param>
public IdentityServerBearerTokenValidationMiddleware(AppFunc next, IdentityServerOAuthBearerAuthenticationOptions options, ILoggerFactory loggerFactory)
public IdentityServerBearerTokenValidationMiddleware(AppFunc next, IAppBuilder app, IdentityServerOAuthBearerAuthenticationOptions options, ILoggerFactory loggerFactory)
{
_next = next;
_options = options;
_logger = loggerFactory.Create(this.GetType().FullName);

if (options.LocalValidationOptions != null)
{
var localBuilder = new AppBuilder();
var localBuilder = app.New();
localBuilder.UseOAuthBearerAuthentication(options.LocalValidationOptions);
localBuilder.Run(ctx => next(ctx.Environment));
_localValidationFunc = localBuilder.Build();
}

if (options.EndpointValidationOptions != null)
{
var endpointBuilder = new AppBuilder();
var endpointBuilder = app.New();
endpointBuilder.Properties["host.AppName"] = "foobar";

endpointBuilder.UseOAuthBearerAuthentication(options.EndpointValidationOptions);
Expand Down

0 comments on commit 8358d0e

Please sign in to comment.