How to send direct message to ipfs peer with http api - ipfs

I want to use ipfs + http api for chat-like communication. Simple scenario:
1) Client subscribes to pubsub topic with /api/v0/pubsub/sub
2) Client gets peers for topic with /api/v0/pubsub/peers
3) Client send direct message to peer
But I didn't find api for 3 punkt. How to send direct message to peer in pubsub topic with http api?

You can't send direct messages to peers with the ipfs http api. You can however publish a message to the pubsub topic both peers are subscribed to using the pubsub/pub api call https://docs.ipfs.io/reference/api/http/#api-v0-pubsub-pub

Related

Automatize Google Drive API connection with Mule 4

I'm using Mule 4 and I want to do automatic application which gets data from google drive server when an HTTP request arrives.
I'm having trouble when I'm trying to connect to Google Drive API automatically when a requests arrives, is there some way to authenticate just 1 time to access to Google Drive API, and then, got a persistent OAuth 2.0 code which allows you to connect for life with it? Otherwise, any URL to get a code with no interaction once HTTP request arrives?
You can use the Mule Google Drive Connector to automate the operations.

Protect Admin REST API of SyncGateway

I have an application will request Sync gateway through Admin REST API. So it’s possible to configure the sync gateway to use the client credentials grant flow to request Admin API?
My application and sync gateway are in different network.
The implementation look like this:
. Resource Owner : My application
. Resource Server : Sync Gateway
. Client Application : My application
. Authorization Server : my IDP server
thanks
Sync gateway admin rest API does not need any credentials to access as long as your client know the host or ipaddress of the sync gateway, client should be able to request admin API and client application network should be able to reach the network which sync gateway is hosted

API Management to forward client certificate

I am trying to achieve the following the scenario but ending up as 403 response.
Client -> sends Cert A -> API Management -> Forwards Cert A -> Backend API (Azure Api App) -> Authenticates the certificate.
Is there is a way to configure API management to forward the incoming certificate to the backend API?
I tried various transformation policies on the incoming request but none of the options worked.
Please suggest.
This is technically not possible since client certificate's private key is never transmitted over wire. So there is no way APIM could use it to authenticate to backend. Even more so since there is no affinity between client connection and backend connection in APIM. Your best option is to send client certificate information in a custom header. You can use ser-header policy to set it at APIM level along with policy expressions to extract client certificate information from request.
With the new authentication-certificate policy (learn.microsoft.com) you may return the certificate as a byte[] coming from a separate send-request response-variable and use it as follows:
<authentication-certificate body="#(context.Variables.GetValueOrDefault<byte[]>("byteCertificate"))" password="optional-certificate-password" />
You could store the password as a secret named value or even get it from the KeyVault by using this snippet:
github.com/Azure/api-management-policy-snippets

Spring boot oauth2 auth server sessions

I'm attempting to understand how spring boot uses http sessions to manage the oauth authorization code flow.
I understand that after the user submits their credentials via the /login form spring will persist the authentication object so it can be retrieved when the browser is redirected to retrieve the authorization code.
What I dont understand is if the browser needs to sends jsession cookie to the server or http basic authentication header when invoking this flow.
For example if I wanted to initiate the flow manually via curl do I need to specify any special headers ?
It doesn't use HTTP sessions to persist it, the client ID and authorisation code (the code that's passed back to the client app after the user authenticates) is used to identify the authentication object. The authorisation code is then used to obtain the access token.
So:
The client app redirects to the auth server, passing in their client ID.
The user authenticates with their username and password on the auth server , which stores the authentication against the code and client ID and passed the authorisation code back to the calling app as a request param on the redirect URL.
The client app calls back to the auth server, authenticating with it's client ID and secret and passing in the authorisation code. This is then swapped for the access (and possible refresh) token.
If the app needs the user details, the client app calls the user details endpoint authenticating with the access token it now has.

APE (Ajax Push Engine) Does APE-Server processes the push requests synchronously or asynchronously

I am using APE (Ajax Push Engine) at my application. The connection between the application and the ape-server is inline push. And I am using APE only to broadcast messages to the clients. I.e. the clients do not send messages to the application or to each other.
My question is: Does APE-Server processes the push requests synchronously or asynchronously.
I.e. if I send a message to push over APE-Server,
does APE-Server responses immediately to the application, and after that it pushes the messages to the clients? (asynchronously) OR
does APE-Server responses to the application after it has pushed the messages to the clients (synchronously)
I am asking this, because sometimes responses from APE-Server to the application last to long (sometimes over 1 minute).
Thanks in advance.
The connection type is asychronous as you embed the server logic in webserver and ape communicates using http with the webserver (client <-> APE <-> web server)