Ocelot | dotnet 7.0 API Gateway | Microservice library

 by   ThreeMammals C# Version: 19.0.2 License: MIT

kandi X-RAY | Ocelot Summary

kandi X-RAY | Ocelot Summary

Ocelot is a C# library typically used in Architecture, Microservice applications. Ocelot has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

Ocelot is a .NET API Gateway. This project is aimed at people using .NET running a micro services / service oriented architecture that need a unified point of entry into their system. However it will work with anything that speaks HTTP and run on any platform that ASP.NET Core supports. In particular I want easy integration with IdentityServer reference and bearer tokens. We have been unable to find this in my current workplacewithout having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already existsto do this. Ocelot is a bunch of middlewares in a specific order.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Ocelot has a medium active ecosystem.
              It has 7656 star(s) with 1557 fork(s). There are 388 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 525 open issues and 560 have been closed. On average issues are closed in 200 days. There are 88 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Ocelot is 19.0.2

            kandi-Quality Quality

              Ocelot has 0 bugs and 0 code smells.

            kandi-Security Security

              Ocelot has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Ocelot code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Ocelot is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Ocelot releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.
              Ocelot saves you 85 person hours of effort in developing the same functionality from scratch.
              It has 219 lines of code, 0 functions and 638 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Ocelot
            Get all kandi verified functions for this library.

            Ocelot Key Features

            No Key Features are available at this moment for Ocelot.

            Ocelot Examples and Code Snippets

            No Code Snippets are available at this moment for Ocelot.

            Community Discussions

            QUESTION

            API Gateway using Ocelot on .NET 6 docker container - unable to make it work
            Asked 2022-Mar-20 at 08:48

            I'm fairly new to the microservices architecture and hand cranked my own api-gateway which works, but from research realised the value in using Ocelot as a replacment due to the features it brings. Today I created a new empty .NET 6 api-gateway project and using the Ocelot documentation brought in nuget packages needed to set it up. The end game is to use Eureka, but as I don't seem to be able to make it work I have stepped back to using a direct call the docker based microservice first.

            Looking at the documentation I think I've follow it to the letter, but when I launch the container it does nothing, I wonder if someone could point me in the right direction.

            My program.cs

            ...

            ANSWER

            Answered 2022-Mar-20 at 08:48

            Replacing localhost for the container name used by the docker compose yaml in this case web.api.gateway solves this problem.

            Source https://stackoverflow.com/questions/71539152

            QUESTION

            Generate api and models in TS with openapi-generator-cli from multiple definitions from ocelote
            Asked 2022-Feb-19 at 16:30

            I'm trying to setup a dotnet micro-service backend with a gateway using Ocelote. Doing this as described, Ocelote provides me with multiple swagger definitions (for each micro-service)


            Since the API now has multiple definition, each definition has its own defining json file.

            How can i generate the API services and Models using openapi-generator-cli in this case. Previously i only had one definition which i generated with the command below, passing it the published json file directly

            ...

            ANSWER

            Answered 2022-Feb-19 at 16:30

            Since there was no fitting tool for my problem or an answer for 6 months, i decided to write an open source tool myself. It is still a WIP but it may already be enough for you, just like it is for my current needs.

            Basically what it does is detecting the swagger definitions, generating each of those using the openapi-cli-generator and then merging all generated files together. At the end there are no duplicate files and a single Configuration.

            If you find any bugs or unhandled edge cases please contribute via Github!

            https://github.com/Deitsch/angler

            Source https://stackoverflow.com/questions/69270430

            QUESTION

            Accessing elements in Python dictionary
            Asked 2022-Feb-10 at 21:20

            bit of a strange question, but I was trying to come up with different ways to get around this.

            Let's say I have the following Dictionary:

            ...

            ANSWER

            Answered 2022-Feb-10 at 21:00

            QUESTION

            How do you use a random element from an array, remove that element from the array, and keep using random elements until the array is empty?
            Asked 2022-Jan-12 at 01:03

            This is my first stack overflow question, so if I am presenting something wrong, please let me know. I am pretty new to computer programming, so I just have a small webpage where I am just implementing things that I am learning.

            I made a little quiz with random trivia multiple choice questions you can take if you press a button. I am using window prompts to ask the questions and get the answers, and I have all of the questions and answers stored as objects with question/prompt and answer pairs. All of those objects are stored in an array in a variable called shortQuizPrompts. I already have the quiz working and everything, aka., It tells you after every question if you got the answer to that question right or wrong, and it gives you a grade afterwards... I also have it set up so that if you enter an answer that is not "a", "b", "c", or "d", it lets you know that it isnt a valid answer. Those sorts of things.

            As of right now, you can choose how many questions long you want the quiz to be out of the 24 total questions I have so far. It just asks the questions in the order that they are stored in the array. For example, you will never be asked the last question in the array if you do not choose for the quiz to be the full 24 questions long. However, I want to make the quiz ask the questions in a random order, while also removing those questions from the array as to not ask the same question multiple times.

            I have tried increasing the iterator while looping through the array to a random number from 0 to the length of however many questions they chose. Then checking to see if the iterator was larger than the length of the number of questions they chose, it would decrease the iterator until it found a question that is still in the array that it could ask...

            If anyone knows how to go about doing that, it would be great. Sorry for the long question btw. I am pretty new to coding, so this is probably a simple answer, but I digress. I'm pretty sure I did everything right. Thx.

            ...

            ANSWER

            Answered 2022-Jan-12 at 01:03

            You can shuffle the shortQuizPrompts array before starting the quiz. Array shuffle details can be found in this answer.

            Source https://stackoverflow.com/questions/70675105

            QUESTION

            SignalR not working with Ocelot API Gateway
            Asked 2021-Dec-28 at 08:53

            I am using ASP.Net boilerplate architecture for my project and using Ocelot API Gateway.

            Without using gateway, I can access signalr successfully from my angular App.

            But when I try to access signalr through API Gateway, All requests stay in pending state and get this error

            Following is my configuration.json changes for signalr

            And following change I made in the Startup.cs file of the gateway.

            ...

            ANSWER

            Answered 2021-Dec-28 at 08:53

            The following change works for me. Applied following changes in configuration.json

            Source https://stackoverflow.com/questions/70462901

            QUESTION

            Microservice : How can you deploy your Microservices project using an API gateway on windows server
            Asked 2021-Dec-27 at 15:16

            I have created two projects one the API Gateway that uses this JSON file:

            ...

            ANSWER

            Answered 2021-Dec-27 at 08:20

            To deploy it on a Windows Server you need to create two web sites on IIS, one for the API Gateway and one for the microservice. The API gateway site should listen on https port 443 and any IP address. The microservice can listen in any port of your choice, but there is no need to configure it for https because the communication between the gateway and the microservice is local to the server. The microservice should listen only on 127.0.0.1 and [::1] IP addresses because the microservice should only be accessed though the API gateway. So your ocelot.json can be:

            Source https://stackoverflow.com/questions/70489982

            QUESTION

            How to implement Windows Authentication in a .Net Core API Gateway using Ocelot so that all downstream services can access IWindowsPrincipal?
            Asked 2021-Nov-21 at 17:22
            Background

            I have two microservices that require access to IWindowsPrincipal of the calling user. I am writing an API Gateway using .Net Core 3.1 that will act as a reverse proxy for these services. I have configured Authentication and Authorization in the API Gateway as follows:

            ...

            ANSWER

            Answered 2021-Nov-21 at 17:22

            I thought the answer is No

            Is there a way to configure Ocelot in the gateway so that it will Challenge the caller if necessary receive Windows Authentication information and pass it on to the microservices?

            The problem is Windows Authentication is stateful, server and client are in the same Active Directory , you can find the note in .NET Core Windows Authentication

            Windows Authentication is a stateful scenario primarily used in an intranet, where a proxy or load balancer doesn't usually handle traffic between clients and servers.

            Microservices architecture requires a stateless instead stateful (means the server and client are in different AD/OS/Network). And Gateway is a stateless component in Microservices picture.

            The only way Ocelot can authenticate Windows User is using Active Directory Federated Services (ADFS) with OpenID Connect (OIDC) or constructing Identity Server in the IIS Server by yourself. You can read the scenario in ADFS or Azure AD for more details.

            Beside, there are my answers for two following questions:

            1. No, Ocelot just provides the add-in feature to detect which claims of JWT must be included before it allows the request to go through downstream. You can build the custom Authentication/Authorization middleware to allow/deny the correct upstream.
            2. No, YARP is the same meaning of Ocelot in your requirement.

            Source https://stackoverflow.com/questions/70045297

            QUESTION

            .Net 5: Unable to start Ocelot, unsupported authentication provider
            Asked 2021-Oct-26 at 13:14

            I wanna implement JWT authentication in the Ocelot API gateway, I followed ocelot documentation carefully and also implemented that. But I got an error that not any idea for solving that.

            I used this section of the documentation for enabling authentication.

            My received error:

            System.AggregateException: 'One or more errors occurred. (Unable to start Ocelot, errors are: Authentication Options AuthenticationProviderKey:BaseAuthenticationSchema,AllowedScopes:[] is unsupported authentication provider)'

            Used packages:

            Ocelot(17.0.0)

            Microsoft.AspNetCore.Authentication.JwtBearer(5.0.11)

            Also sections of my codes for more specification:

            Program.cs:

            ...

            ANSWER

            Answered 2021-Oct-26 at 13:14

            Finally, I solved my problem using this comment on the Ocelot GitHub page open issues.

            Just moved the authentication configuration from the startup.cs file to the program.cs file on the .ConfigureServices section.

            Like this:

            Source https://stackoverflow.com/questions/69629229

            QUESTION

            How can I get Kendo grid DataSourceRequest object through Ocelot?
            Asked 2021-Sep-24 at 09:44

            There is an Api Gateway that is configured by ocelot. I want to request to the Api with Kendo object and receive that as a Kendo DataSourceRequest. I just did it in Angular and dot net core Api project and It worked properly. However, in this current project I don't have any idea how can I do that via Ocelot. This is my Api method in this below.

            ...

            ANSWER

            Answered 2021-Sep-24 at 09:44

            I should have replaced "/api/auth/User_Read/{everything}" with "/api/auth/User_Read?{url}" or any name instead of "url" like "everything". The important thing was the "?" for mapping routes in Ocelot.

            Source https://stackoverflow.com/questions/69267582

            QUESTION

            How to return Unauthorized response while overriding AuthorizationMiddleware in Ocelot & .Net WebApi
            Asked 2021-Sep-12 at 04:37

            I'm tring to override Ocelot AuthorizationMiddleware using a OcelotPipelineConfiguration in .NET 5 WebApi. This is my code:

            UPDATED

            Configure

            ...

            ANSWER

            Answered 2021-Sep-12 at 04:37

            I found the correct answer by @Artur comment. I replaced

            Source https://stackoverflow.com/questions/68697948

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Ocelot

            Ocelot is designed to work with ASP.NET and it targets net6.0. Install Ocelot and it's dependencies using NuGet.

            Support

            Please click here for the Ocelot documentation. This includes lots of information and will be helpful if you want to understand the features Ocelot currently offers.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ThreeMammals/Ocelot.git

          • CLI

            gh repo clone ThreeMammals/Ocelot

          • sshUrl

            git@github.com:ThreeMammals/Ocelot.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link