Beispiel #1
0
        public void Configuration(IAppBuilder app)
        {
            app.Map("/identity", idsrv =>
            {
                //Sökväg till certifikat och privat nyckel
                var certfile = AppDomain.CurrentDomain.BaseDirectory + @"\Certificates\OAuthSign.pfx";

                //Factory som konfigurerar typen av användare, clients och scopes
                var factory = new IdentityServerServiceFactory()
                              .UseInMemoryUsers(InMemory.GetUsers())
                              .UseInMemoryScopes(InMemory.GetScopes())
                              .UseInMemoryClients(InMemory.GetClients());

                //Optionsobjekt som används för att konfigurera identityserver middleware
                var options                = new IdentityServerOptions();
                options.Factory            = factory;
                options.SigningCertificate = new X509Certificate2(certfile, "password");
                options.IssuerUri          = Constants.IssuerURI;
                options.PublicOrigin       = Constants.UserProfileSTSOrigin;
                options.SiteName           = "Programme site";

                //kopplar in middlewaren i OWIN pipen
                idsrv.UseIdentityServer(options);
                Debug.Write(WebConfigurationManager.GetSection("system.webServer").ToString());
                Debug.Write("Andreas");
            });
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddIdentityServer()
            .AddTestUsers(InMemory.GetUsers())
            .AddInMemoryClients(InMemory.GetClients())
            .AddInMemoryIdentityResources(InMemory.GetIdentityResources())
            .AddInMemoryApiResources(InMemory.GetApiResources())
            .AddDeveloperSigningCredential();

            services.AddMvc();
        }
Beispiel #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <MvcOptions>(options =>
            {
                options.Filters.Add(new RequireHttpsAttribute());
            });
            var idSrvConfig = Configuration.GetSection("IdSrv");

            services.AddIdentityServer()
            .AddTestUsers(InMemory.GetUsers(idSrvConfig))
            .AddInMemoryClients(InMemory.GetClients(idSrvConfig))
            .AddInMemoryIdentityResources(InMemory.GetIdentityResources())
            .AddInMemoryApiResources(InMemory.GetApiResources(idSrvConfig))
            .AddDeveloperSigningCredential();
            services.AddCors();
            services.AddMvc();
        }