Ejemplo n.º 1
0
        public void Configuration(IAppBuilder app)
        {
            var inMemoryManager = new InMemoryManager();
            var factory         = new IdentityServerServiceFactory()
                                  .UseInMemoryUsers(inMemoryManager.GetUsers())
                                  .UseInMemoryScopes(inMemoryManager.GetScopes())
                                  .UseInMemoryClients(inMemoryManager.GetClients());
            var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]);
            var options     = new IdentityServerOptions()
            {
                SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]),
                RequireSsl         = false, //should be true in PROD
                Factory            = factory
            };

            app.UseIdentityServer(options);
        }
Ejemplo n.º 2
0
        public void Configuration(IAppBuilder app)
        {
            var entityFrameworkOptions = new EntityFrameworkServiceOptions
            {
                ConnectionString =
                    ConfigurationManager.ConnectionStrings["SocialNetwork.Idsvr"].ConnectionString
            };

            var inMemoryManager = new InMemoryManager();

            SetupClients(inMemoryManager.GetClients(), entityFrameworkOptions);
            SetupScopes(inMemoryManager.GetScopes(), entityFrameworkOptions);

            var userRepository = new UserRepository(
                () => new SqlConnection(ConfigurationManager.ConnectionStrings["SocialNetwork"].ConnectionString)
                );

            var viewServiceOptions = new DefaultViewServiceOptions();

            viewServiceOptions.Stylesheets.Add("/css/site.css");

            var factory = new IdentityServerServiceFactory();

            factory.RegisterConfigurationServices(entityFrameworkOptions);
            factory.RegisterOperationalServices(entityFrameworkOptions);
            factory.UserService = new Registration <IUserService>(
                typeof(SocialNetworkUserService));
            factory.Register(new Registration <IUserRepository>(userRepository));
            factory.ConfigureDefaultViewService(viewServiceOptions);

            new TokenCleanup(entityFrameworkOptions, 1).Start();

            var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]);

            var options = new IdentityServerOptions
            {
                SiteName           = "OAuth is fun!",
                SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]),
                RequireSsl         = false, // DO NOT DO THIS IN
                Factory            = factory,
            };

            app.UseIdentityServer(options);
        }
Ejemplo n.º 3
0
        public void Configuration(IAppBuilder app)
        {
            var certificate     = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]);
            var inMemoryManager = new InMemoryManager();
            var factory         = new IdentityServerServiceFactory()
                                  .UseInMemoryUsers(inMemoryManager.GetUsers())
                                  .UseInMemoryScopes(inMemoryManager.GetScopes())
                                  .UseInMemoryClients(inMemoryManager.GetClients());

            var options = new IdentityServerOptions()
            {
                SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]),
                RequireSsl         = false,
                Factory            = factory
            };

            app.UseIdentityServer(options);
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
        }