コード例 #1
0
        public void Configuration(IAppBuilder app)
        {
            // tracing
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Trace()
                .CreateLogger();

            // in-memory datenhaltung für users, scopes, clients und CORS policys
            var users = new InMemoryUserService(Users.Get());
            var scopes = new InMemoryScopeStore(Scopes.Get());
            var clients = new InMemoryClientStore(Clients.Get());
            var cors = new InMemoryCorsPolicyService(Clients.Get());

            // konfigurieren der factory
            var factory = new IdentityServerServiceFactory();

            factory.UserService = new Registration<IUserService>(users);
            factory.ScopeStore = new Registration<IScopeStore>(scopes);
            factory.ClientStore = new Registration<IClientStore>(clients);
            factory.CorsPolicyService = new Registration<ICorsPolicyService>(cors);

            // identityserver3 middleware einbinden
            app.UseIdentityServer(new IdentityServerOptions
                {
                    Factory = factory,
                    SiteName = "DotNetPro IdentityServer",

                    SigningCertificate = Certificate.Get()
                });
        }
コード例 #2
0
        public KnownUserService(string adminUsername, string adminPassword)
        {
            if (string.IsNullOrWhiteSpace(adminUsername))
            {
                throw new ArgumentNullException("adminUsername");
            }

            if (string.IsNullOrWhiteSpace(adminPassword))
            {
                throw new ArgumentNullException("adminPassword");
            }

            this.inMemoryUserService = 
                new InMemoryUserService(this.GetUsers(adminUsername, adminPassword).ToList());            
        }
コード例 #3
0
        public IdentityServerHost()
        {
            var clientStore = new InMemoryClientStore(Clients);
            var scopeStore = new InMemoryScopeStore(Scopes);
            var userService = new InMemoryUserService(Users);

            var factory = new IdentityServerServiceFactory
            {
                ScopeStore = new Registration<IScopeStore>(scopeStore),
                ClientStore = new Registration<IClientStore>(clientStore),
                UserService = new Registration<IUserService>(userService),
            };

            Options = new IdentityServerOptions
            {
                Factory = factory,
                DataProtector = new NoDataProtector(),
                SiteName = "IdentityServer3 Host",
                SigningCertificate = SigningCertificate
            };
        }