本文整理汇总了C#中AppFunc类的典型用法代码示例。如果您正苦于以下问题:C# AppFunc类的具体用法?C# AppFunc怎么用?C# AppFunc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppFunc类属于命名空间,在下文中一共展示了AppFunc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Http2OwinMessageHandler
/// <summary>
/// Initializes a new instance of the <see cref="Http2OwinMessageHandler"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="end"></param>
/// <param name="transportInfo">The transport information.</param>
/// <param name="next">The next layer delegate.</param>
/// <param name="cancel">The cancellation token.</param>
public Http2OwinMessageHandler(DuplexStream stream, ConnectionEnd end, TransportInformation transportInfo,
AppFunc next, CancellationToken cancel)
: base(stream, end, stream.IsSecure, transportInfo, cancel)
{
_next = next;
stream.OnClose += delegate { Dispose(); };
}
示例2: Error404Module
public Error404Module(AppFunc next)
{
if (next == null)
throw new ArgumentNullException("next");
this.next = next;
}
示例3: Http2OwinMessageHandler
/// <summary>
/// Initializes a new instance of the <see cref="Http2OwinMessageHandler"/> class.
/// </summary>
/// <param name="stream">The stream.</param>
/// <param name="end"></param>
/// <param name="isSecure"></param>
/// <param name="next">The next layer delegate.</param>
/// <param name="cancel">The cancellation token.</param>
public Http2OwinMessageHandler(Stream stream, ConnectionEnd end, bool isSecure,
AppFunc next, CancellationToken cancel)
: base(stream, end, isSecure, cancel)
{
_next = next;
_session.OnSessionDisposed += delegate { Dispose(); };
}
示例4: CarcarahOAuth
public CarcarahOAuth(AppFunc next, OAuthOptions options)
{
this.next = next;
this.options = options;
AuthCodeStorage = new AuthorizationCodeStorage();
RefreshTokenStorage = new RefreshTokenStorage();
}
示例5: Html5Middleware
public Html5Middleware(AppFunc next, HTML5ServerOptions options)
{
_next = next;
_options = options;
_innerMiddleware = new StaticFileMiddleware(next, options.FileServerOptions.StaticFileOptions);
}
示例6: Enable
public static AppFunc Enable(AppFunc next, Func<IDictionary<string, object>, bool> requiresAuth, string realm, Func<string, UserPassword?> authenticator)
{
return env =>
{
if (!requiresAuth(env))
{
return next(env);
}
var requestHeaders = (IDictionary<string, string[]>)env[OwinConstants.RequestHeaders];
var header = OwinHelpers.GetHeader(requestHeaders, "Authorization");
var parsedHeader = ParseDigestHeader(header);
if (parsedHeader == null)
{
return Unauthorized(env, realm);
}
string user = parsedHeader["username"];
var pwd = authenticator(user);
// TODO: check for increment of "nc" header value
if (!pwd.HasValue || !IsValidResponse(pwd.Value.GetHA1(user, realm), (string)env[OwinConstants.RequestMethod], parsedHeader))
{
return Unauthorized(env, realm);
}
env["gate.RemoteUser"] = user;
return next(env);
};
}
示例7: RazorApplication
// Consumers should use IoC or the Default UseRazor extension method to initialize this.
public RazorApplication(
AppFunc nextApp,
IFileSystem fileSystem,
string virtualRoot,
IRouter router,
ICompilationManager compiler,
IPageActivator activator,
IPageExecutor executor,
ITraceFactory tracer)
: this(nextApp)
{
Requires.NotNull(fileSystem, "fileSystem");
Requires.NotNullOrEmpty(virtualRoot, "virtualRoot");
Requires.NotNull(router, "router");
Requires.NotNull(compiler, "compiler");
Requires.NotNull(activator, "activator");
Requires.NotNull(executor, "executor");
Requires.NotNull(tracer, "tracer");
FileSystem = fileSystem;
VirtualRoot = virtualRoot;
Router = router;
CompilationManager = compiler;
Executor = executor;
Activator = activator;
Tracer = tracer;
ITrace global = Tracer.ForApplication();
global.WriteLine("Started at '{0}'", VirtualRoot);
}
示例8: OwinFriendlyExceptionsMiddleware
public OwinFriendlyExceptionsMiddleware(AppFunc next, ITransformsCollection transformsCollection,
OwinFriendlyExceptionsParameters parameters)
{
_next = next;
_transformsCollection = transformsCollection;
_parameters = parameters;
}
示例9: Create
public static IDisposable Create(AppFunc app, IDictionary<string, object> properties)
{
if (app == null)
{
throw new ArgumentNullException("app");
}
if (properties == null)
{
throw new ArgumentNullException("properties");
}
// Retrieve the instances created in Initialize
OwinHttpListener wrapper = properties.Get<OwinHttpListener>(typeof(OwinHttpListener).FullName)
?? new OwinHttpListener();
System.Net.HttpListener listener = properties.Get<System.Net.HttpListener>(typeof(System.Net.HttpListener).FullName)
?? new System.Net.HttpListener();
AddressList addresses = properties.Get<AddressList>(Constants.HostAddressesKey)
?? new List<IDictionary<string, object>>();
CapabilitiesDictionary capabilities =
properties.Get<CapabilitiesDictionary>(Constants.ServerCapabilitiesKey)
?? new Dictionary<string, object>();
var loggerFactory = properties.Get<LoggerFactoryFunc>(Constants.ServerLoggerFactoryKey);
wrapper.Start(listener, app, addresses, capabilities, loggerFactory);
return wrapper;
}
示例10: ResttpComponent
public ResttpComponent(AppFunc next, ResttpConfiguration config)
{
_next = next;
Config = config;
//TestRoutes(new HttpRouteResolver(Config.HttpRoutes));
}
示例11: CanonicalRequestPatterns
public CanonicalRequestPatterns(AppFunc next)
{
_next = next;
_paths = new Dictionary<string, Tuple<AppFunc, string>>();
_paths["/"] = new Tuple<AppFunc, string>(Index, null);
var items = GetType().GetMethods()
.Select(methodInfo => new
{
MethodInfo = methodInfo,
Attribute = methodInfo.GetCustomAttributes(true).OfType<CanonicalRequestAttribute>().SingleOrDefault()
})
.Where(item => item.Attribute != null)
.Select(item => new
{
App = (AppFunc)Delegate.CreateDelegate(typeof(AppFunc), this, item.MethodInfo),
item.Attribute.Description,
item.Attribute.Path,
});
foreach (var item in items)
{
_paths.Add(item.Path, Tuple.Create(item.App, item.Description));
}
}
示例12: MapPathMiddleware
public MapPathMiddleware(AppFunc next, AppFunc branch, string pathMatch)
{
if (next == null)
{
throw new ArgumentNullException("next");
}
if (branch == null)
{
throw new ArgumentNullException("branch");
}
if (pathMatch == null)
{
throw new ArgumentNullException("pathMatch");
}
// Must at least start with a "/foo" to be considered a branch. Otherwise it's a catch-all.
if (!pathMatch.StartsWith("/", StringComparison.Ordinal) || pathMatch.Length == 1)
{
throw new ArgumentException("Path must start with a \"/\" followed by one or more characters.", "pathMatch");
}
// Only match on "/" boundaries, but permit the trailing "/" to be absent.
if (pathMatch.EndsWith("/", StringComparison.Ordinal))
{
pathMatch = pathMatch.Substring(0, pathMatch.Length - 1);
}
_next = next;
_branch = branch;
_pathMatch = pathMatch;
}
示例13: XXssMiddleware
public XXssMiddleware(AppFunc next, XXssProtectionOptions options)
: base(next)
{
_config = options;
var headerGenerator = new HeaderGenerator();
_headerResult = headerGenerator.CreateXXssProtectionResult(_config);
}
示例14: ActionInvokerComponent
public ActionInvokerComponent(AppFunc next, MediaTypeFormatterCollection formatters, IContentNegotiator contentNegotiator, IActionParameterBinder parameterBinder)
{
_next = next;
_formatters = formatters;
_contentNegotiator = contentNegotiator;
_actionParameterBinder = parameterBinder;
}
示例15: RouteBody
public RouteBody(AppFunc next, string[] httpMethods, string paramKey, Func<Stream, object> converter)
{
this.next = next;
this.routeParamName = paramKey;
this.methods = httpMethods;
this.converter = converter;
}