private static WebTokenWebServiceHostConfiguration SetupServiceHostConfiguration()
 {
     var configuration = new WebTokenWebServiceHostConfiguration
     {
         RequireSsl = true,
         EnableRequestAuthorization = false,
         AllowAnonymousAccess = true
     };
     return configuration;
 }
        public WebTokenWebServiceHost(Type serviceType, WebSecurityTokenHandlerCollectionManager tokenManager, WebTokenWebServiceHostConfiguration configuration, params Uri[] baseAddresses)
            : base(serviceType, baseAddresses)
        {
            _configuration = configuration;
            _manager = tokenManager;

            Authorization.ServiceAuthorizationManager = new WebTokenServiceAuthorizationManager(tokenManager, configuration);
            Authorization.PrincipalPermissionMode = PrincipalPermissionMode.Custom;
            
            Description.Behaviors.Add(new OperationAccessServiceBehavior());
            Description.Behaviors.Add(new AdvertiseWcfInHttpPipelineBehavior());
        }
        private void RegisterRoutes(RouteCollection routes)
        {
            var configuration = new WebTokenWebServiceHostConfiguration
            {
                RequireSsl = true,
                EnableRequestAuthorization = false,
                AllowAnonymousAccess = true
            };
            
            // web tokens
            routes.Add(new ServiceRoute(
                "rest",
                new WebTokenWebServiceHostFactory(SetupSecurityTokenHandler(), configuration),
                typeof(RestService)));

            routes.Add(new ServiceRoute(
                "restwin",
                new IntegratedWebServiceHostFactory(),
                typeof(RestService)));
        }
 public WebTokenServiceAuthorizationManager(WebSecurityTokenHandlerCollectionManager manager, WebTokenWebServiceHostConfiguration configuration)
 {
     _manager = manager;
     _configuration = configuration;
 }
 public WebTokenWebServiceHostFactory(WebSecurityTokenHandlerCollectionManager manager, WebTokenWebServiceHostConfiguration configuration)
 {
     _configuration = configuration;
     _manager = manager;    
 }