This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Auth | |
{ | |
public static AuthenticationProviderConfiguration Configuration; | |
public static void Enable(IPipelines pipelines, AuthenticationProviderConfiguration configuration) | |
{ | |
pipelines.AfterRequest.AddItemToEndOfPipeline(ctx=> | |
{ | |
if (ctx.Response.StatusCode==HttpStatusCode.Unauthorized) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OAuth2AuthenticationClient | |
{ | |
public static void Enable(IPipelines pipelines, OAuth2AuthenticationClientConfiguration clientConfiguration) | |
{ | |
if (!clientConfiguration.IsValid) | |
throw new OAuth2AuthenticationClientConfiguration.InvalidConfigurationException(); | |
pipelines.BeforeRequest.AddItemToStartOfPipeline(GetLoadAuthenticationHook(clientConfiguration)); | |
pipelines.AfterRequest.AddItemToEndOfPipeline(GetRedirectToProviderHook(clientConfiguration)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Repository | |
{ | |
private static readonly IList<Place> Places = new List<Place> | |
{ | |
new Place(0, "Pastini Pastaria", "Lunch", "Dinner", "Pasta", "Beer", "Wine"), | |
new Place(1, "Deschutes Brewery", "Lunch", "Dinner", "Pasta", "Beer", "Wine"), | |
new Place(2, "Stumptown Coffee", "Breakfast", "Coffee"), | |
new Place(3, "Voodoo Doughnuts", "Breakfast", "Coffee"), | |
new Place(4, "J Cafe", "Breakfast", "Lunch", "Coffee"), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* larger font size */ | |
body.platform-mac.platform-mac-snowleopard .monospace, | |
body.platform-mac.platform-mac-snowleopard .source-code, | |
body.platform-windows .monospace, body.platform-windows .source-code , | |
body.platform-linux .monospace, body.platform-linux .source-code { | |
font-size: 20px !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using Nancy.ViewEngines; | |
namespace Nancy | |
{ | |
public static class CustomFormatterExtensions | |
{ | |
public static Response AsNegotiated<TModel>(this IResponseFormatter formatter, TModel model, HttpStatusCode statusCode = HttpStatusCode.OK, Tuple<Func<Response>, string> defaultResponse = null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContentNegotiationPipelineItem : PipelineItem<Action<NancyContext>> | |
{ | |
public ContentNegotiationPipelineItem() | |
: base("Content Negotiation", action) | |
{ | |
} | |
static readonly Action<NancyContext> action = ctx => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void AddAlternateResponses<T>(this NancyContext context, T resource, | |
HttpStatusCode statusCode = HttpStatusCode.OK, string location = null) | |
{ | |
var xmlResponse = new XmlResponse<T>(resource, "application/xml", new DefaultXmlSerializer()) | |
{ | |
StatusCode = statusCode | |
}; | |
var jsonResponse = new JsonResponse(new { resource }, new DefaultJsonSerializer()) | |
{ | |
StatusCode = statusCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using FluentNHibernate.Mapping; | |
using HibernatingRhinos.Profiler.Appender.NHibernate; | |
using NHibernate; | |
using NHibernate.Cfg; | |
using NHibernate.Tool.hbm2ddl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using FluentNHibernate.Mapping; | |
using HibernatingRhinos.Profiler.Appender.NHibernate; | |
using NHibernate; | |
using NHibernate.Cfg; | |
using NHibernate.Tool.hbm2ddl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using FluentNHibernate.Cfg; | |
using FluentNHibernate.Cfg.Db; | |
using FluentNHibernate.Mapping; | |
using NHibernate; | |
using NHibernate.Tool.hbm2ddl; | |
namespace SO6727128 |