Beispiel #1
0
        /// <summary>
        /// Gets the pre request hook for loading the authenticated user's details
        /// from apikey given in request.
        /// </summary>
        /// <param name="configuration">Stateless authentication configuration to use</param>
        /// <returns>Pre request hook delegate</returns>
        private static Func <NancyContext, Response> GetLoadAuthenticationHook(StatelessAuthenticationConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            return(context =>
            {
                context.CurrentUser = configuration.GetUserIdentity(context);

                return null;
            });
        }
        /// <summary>
        /// Gets the pre request hook for loading the authenticated user's details
        /// from apikey given in request.
        /// </summary>
        /// <param name="configuration">Stateless authentication configuration to use</param>
        /// <returns>Pre request hook delegate</returns>
        private static Func<NancyContext, Response> GetLoadAuthenticationHook(StatelessAuthenticationConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            return context =>
            {
                context.CurrentUser = configuration.GetUserIdentity(context);

                return null;
            };
        }