If it was WCF Project,I usually see all avalible service methods by typing url
....some.svc/help
But in WEB API 2 how I get all such possible methods.
Related
I'm trying to expose my SOAP service as REST using azure API management SOAP to REST feature.
The WS imports, exposes my services and works fine, but all generated REST services are exposed with POST verb. When i try to change to verb GET the method GetUsers, for example, the content does not load (I receive an OK, but without content). When i try keeping the method with the POST verb, the content loads.
Is this possible? Can i change a HTTP verb from a originally SOAP service that was exposed as REST using Azure Management API?
Thanks.
You should be able to resolve that by adding set-method policy, so that when APIM receives GET request it changes method to POST before forwarding it to backend.
Add this to your API Management policy
<set-method>POST</set-method>
I have a WebApi 2 API whose URL I want to keep private/internal. I also have an ASP.NET MVC 5 project which will use this API using JavaScript. What I would like to do is create a single controller action for every API request made by AJAX. The AJAX request should be made to this controller action, the action should decide which API endpoint it should call, make the request and return the result. I want to accomplish this with a single action since I don't want to have duplicates of the endpoints in the API in the MVC project. Very similar to what System.ServiceModel.Routing.RoutingService does for WCF. How can I accomplish this?
I am building an online application using AngularJS on the front-end, hosted in an MVC 5/Web API application (basically a single-page application). However I have a hard constraint: the application's data will be held in a private network. I have to build a second Web API application inside the private network that exposes the web application's functionality. Further, the user authentication needs to happen inside the private network API (so the private network API will act as the authentication provider), as this is where the user tables exist.
The app in the DMZ is basically going to act as a proxy to the web API in the private network. So every request received in an ApiController in the UI API will be calling the private network API, ideally passing the token on received in the initial request.
From an authentication perspective, this is what I need:
User navigates to the site, can see only certain pages (I want to use MVC filters in the view controllers to control access).
They will log in once with a username and password.
After login the user can navigate to application pages and as a result the pages will call into the DMZ API for data.
This DMZ's API controllers will be calling into the private network API.
Both APIs whould be able to identify and apply authorization on their controller methods, based on the user's credentials.
If I didn't have a need for the second tier of API I would just use the MVC Single User Authentication implementation, which provides support for both cookie (UI) and token (API) authentication.
Any help providing insight into how I can do a similar thing with the above scenario would be much appreciated. (I guess my requirement is a bit like Windows impersonation for the UI web app).
See below for a high level view of the static architecture:
You may want to look at Azure service bus relays, which are designed to bridged the corporate firewall and call on-premise APIs.
Your WebAPI service would authenticate against the service bus to be allowed to call your service through it. You can pass user credentials using a bearer token in the request.
I'm not sure, but you may need to change your backend service implementation to use WCF though. You can find an explanation of the use of relays in Microsoft Dynamics in this link.
What do you need to do to a JsonServiceClient in order to call a remote service that is secured by oAuth providers (i.e. Facebook, GooleOpenId etc) + AuthenticateAttribute?
My client has already authenticated against facebook?
How do you configure the JsonServiceClient object here and with what?
Any examples of this? It seems to be a very common scenario of a Xamarin phone app calling a secure and remote web service, that's all we are trying to do here.
My ASP.NET MVC application is using Forms authentication with [System.Web.Mvc.Authorize] . I would like to use [System.Web.Http.Authorize] attribute to protect my Web API controller and because i'm calling it with HttpClient from my MVC controller I've have implemented a custom delegating handler like the one in the following post:
ASP.NET MVC 4 Web API Authentication with Membership Provider
When debugging i can see that the principal is set and the user has right roles but still I'm being redirected to the login page?
So basically when i log in and visit the WebAPI action with browser everything works (as would if i use AJAX from my views), but when i use HttpClient inside my controller (which i know is a new request with different context) with Basic authentication and set the principal i always get redirected.
I've tried so many solutions/workarounds and i'm always redirected to login page.
Anyone has an idea.
Here's an explanation:
System-web-http-authorize x System-web-mvc-authorize
Another interesting point is you use your custom authorization. I did it and it worked. Following example:
Customized authorization Mvc 4
Good Luck