What im trying is to send simple JSON data to specific Amazon endpoint. Implementation of web service that i want to request is not available in predefined form (in SDK) like AWS.EC2, AWS.SQS or AWS.S3 are.
I could also make HTTP REST request but why bother with signing and auth if there is sdk publicly available.
So again, how do i request specific endpoint with AWS SDK for .NET?
I resolved the issue by writing REST HTTP class.
Its not what i wanted to do in the first place. AWS .Net SDK does not seem to help with making such request, nor with signing.
Related
I have an ASP.NET Core application hosted on a server which doesn't access the internet directly for security reasons. So if I used any SDK (ex: FCM SDK) it can't initialize a connection from the application.
The SDK is internally calling an API like fcm.googleapis.com; I need to create something which intercept the SDK request and forwards the request to this route (ex: 192.168.1.45:51514) and I configure the proxy to navigate to the desired URL.
I'm thinking for multiple solutions as follows:
Create a middleware that intercept the SDK requests and changes its base URL to the desired URL (I don't know if it'll work or not).
Create an intermediator project which I can call and just call it then the SDK integration inside the intermediator project (it works but searching for a better solution).
Get the SDK source code as it's an open source and change the URL to be configurable not hardcoded as it is.
Please advise for what is the best practice solution for this issue.
I have an azure function app (v1, with no possibility for upgrading, unfortunately) with an endpoint receiving JSON via POST requests, doing some computation and returning JSON in the response. This endpoint needs to be made SOAP-compatible, meaning that it should receive SOAP requests and return SOAP responses and also be able to provide a WSDL file.
Using the SOAP mapper in API Management is not an option, due to its limitations.
The methods I have tried are:
Create a WCF service and try to delegate the HTTP request to it from the Azure function endpoint. This didn't seem to work because the corresponding handler in WCF can only receive a request via its own HTTP endpoint (which does not seem to be exposable via the azure function endpoint), but cannot be called from within the code.
Use an ASP.net web application with SoapCore as a starting point and try to migrate it to an azure function. This doesn't seem possible because of a completely different structure. SoapCore is attached to the ASP.net app instance as a middleware, whereas azure function does not provide the means to use middleware.
Parse the SOAP request manually, convert it to JSON, do the computation, convert the result back to a SOAP message and return it. The seems very hacky and also the WSDL must be created and served manually. Despite these drawbacks, I'm leaning towards this solution because of the unfeasibility of the first two.
Is there any other possible solution that I have might missed?
If you are using Azure API Management , then below option works;
You can write transformation policies at the service or endpoint level - JSON to SOAP refer: https://learn.microsoft.com/en-us/azure/api-management/api-management-transformation-policies#convert-json-to-soap-using-a-liquid-template
Also refer this link Expose REST API as SOAP via Azure API Management would help.
Let's say I have an installed app, a console app for example, not a web app, that I want to interact with the QBO API - I want to perform calls to QBO from my console app (but not from a web application). So I must authenticate from the console app, make a call and output in the console.
All QBO SDKs seem to ask for a callback URL or a redirect URL, i.e. a page on my server, that will perform the required leg of the OAuth 2.0 authentication. As my installed app is not a webserver, I don't have a place to host this logic. Yes, I can host a webserver to handle this logic, but I don't want to do it, this is a waste of resources for my use case (why leave an auth server on standby?). I just want to authenticate without a webserver with QBO API. Is this possible? Have I messed up my understanding of the API or of OAuth? I am at a total loss. In none of the sample code I can find a suitable example despite this being the use case that I have. (I am working with .NET / C#)
It appears that at the moment the QuickBooks Developer platform will not accommodate this (non web End-Point).
As per Intuit:
These URIs handle responses from the OAuth 2.0 server and are called
after the user authorizes the connection. URIs in this list are the
only ones to which the authorization response can be sent from the
OAuth 2.0 server. You must define at least one URI specifically for
your application's auth endpoint before you can use OAuth 2.0.
Additionally they add in a note:
Mobile- or desktop-based apps that implement OAuth 2.0 must provide a
separate SaaS layer for the Redirect URI to handle responses from the
OAuth 2.0 server.
I realize this is not what you had hoped for. Please understand, however, understand that the end-point must be a URL so as to securely return the authentication token.
I am coding against the OneDrive C# SDKand I have a few questions.
Question 1.
Does the OneDrive C# SDK use the Microsoft Graph API under the hood?
... If so, how can I use the SDK to pass in my client_Id and client_secret and authenticate as a service or daemon app instead of a traditional OAuth for a user?
I have proofed out the authentication for a service with REST calls but I am trying to proof out if it is still possible to use a C# SDK instead.
Question 2.
I found this article Azure Active Directory Graph Service Tutorial. After following the example I am able to create an HTTP POST call and return an access_token. My question is there a way to use this token in conjunction with the Microsoft Graph CSharp SDK or OneDrive CSharp SDK to serve as the authentication process?
Update:
Okay, I was able to proof out some more and having a working code, but I am now getting an error around {Code: InvalidAuthenticationTokenMessage: Access token validation failure.
I did the exact same call with Postman and was able to get data back with REST calls, is REST the only way to achieve this?
I created a gist for my attempt: Code
Solved
On line 62 in the gist, I was hitting the wrong resource. The correct resource is https://graph.microsoft.com
I am working on combination of Web API application and desktop client program (WPF). I am using Microsoft.AspNet.WebApi.Client for a client-server HTTP communication and now I want to use authorization / authentication system of the server application to authorize user of the client program.
Point is, I want to use (=start with) the same HttpClient class, I would like to use ASP.NET Identity library on server side - call controller with credentials in HTTP header, receive actual token from server, keep it and than use it for authentication in other controllers where it is required.
I know the theory, some basic steps, but I have not found any useful and actual resource with a simple examples or tutorial how to do it well. Does anyone know about good resource to learn, how to do that?
Thanks a lot.