Exemplo n.º 1
0
        private InMemoryServer CreateServer(TokenValidationParameters tokenValidationParameters = null)
        {
            var server = new InMemoryServer();

            tokenValidationParameters = tokenValidationParameters ?? new TokenValidationParameters()
            {
                AllowedAudiences = this.allowedAudiences,
                SigningToken     = new X509SecurityToken(this.certificate),
                ValidIssuer      = "self"
            };

            this.jwtValidationHandler = new TestJwtValidationHandler(tokenValidationParameters);

            server.Configuration.MessageHandlers.Add(this.jwtValidationHandler);
            server.Configuration.MapHttpAttributeRoutes();

            return(server);
        }
        private InMemoryServer CreateServer(TokenValidationParameters tokenValidationParameters = null)
        {
            var server = new InMemoryServer();

            tokenValidationParameters = tokenValidationParameters ?? new TokenValidationParameters()
            {
                AllowedAudiences = this.allowedAudiences,
                SigningToken = new X509SecurityToken(this.certificate),
                ValidIssuer = "self"
            };

            this.jwtValidationHandler = new TestJwtValidationHandler(tokenValidationParameters);

            server.Configuration.MessageHandlers.Add(this.jwtValidationHandler);
            server.Configuration.MapHttpAttributeRoutes();

            return server;
        }