How to upgrade taskDidReceiveChallengeWithCompletion present in alamofire 4.9.1 to 5.0.2.
Certificate pinning in Alamofire 5 is done using the ServerTrustManager. At its simplest, you could implement it like this:
let manager = ServerTrustManager(evaluators: ["my.domain.com": PinnedCertificatesTrustEvaluator()])
let session = Session(serverTrustManager: manager)
You can read more in our ServerTrustManager docs.
Related
I'm trying to add Amplify Authentication to my iOS project but I'm strugling to find hot to setup a custom http header for my signin request.
I was looking for some way to do something similar to: request.addValue("hello", forHTTPHeaderField: "x-myheader") .
The current API does not seem to support this option through the simple Amplify.Auth.signIn(...) method.
Is there a way to configure this somehow?
I've spent a few hours looking for a reliable httpClient for my Symfony3.4 (php 7.2) project. I need to get data from an external API endpoint. I tried:
symfony/http-client (didn't work since it's created for symfony 4.3 and higher)
guzzle/http-client (didn't work, because I received an error that GuzzleHttp\Client service doesn't exist)
php-http/httplug-bundle (didn't work as well due to "Unexpected exception when instantiating class.")
Maybe someone could suggest a reliable and working library for making api requests?
In our Symfony 3.4 project, we use the kriswallsmith/buzz bundle to perform HTTP requests.
I'm using what I consider some fairly "standard" code in .NET Core to implement a web socket server:
if (ctx.Request.Path == "/api/v1/sometest")
{
if (ctx.WebSockets.IsWebSocketRequest)
{
WebSocket wsSock = await ctx.WebSockets.AcceptWebSocketAsync();
But I can never establish a session because IsWebSocketRequest is always null.
I can see the Connection: Upgrade and Upgrade: websocket headers...
I know I must be missing something but unsure what... Scanned through github dotnet source code to see if I could figure it out that way but no luck finding a solution yet.
I'm using Windows 10
Kestrel
VS Code
.NET Core 3.1
I had AddWebSockets in Startup.ConfigureServices BUT I forgot to also include the middleware in Startup.Configure. Call app.UseWebSockets here to register the middleware in your chain.
According to this link app.UseWebSockets() should be placed right before app.UseEndpoints() in startup.cs .
I Have to implement a push notification service using ASP .Net Core. as obvious choice is to use SignalR Core.
Our platform setup is using Azure App gateway and it is configured to not allow unauthenticated requests.
We have setup WebSockets communication with SignalR.
Under the hood , SignalR Core follows these steps:
POS ../negociate -> OK with hub_token and supported transport
GET (sends Upgrade header and WebSockets token)../Hub?id={hub_token} -? fail
when investigating why the step 2 does not upgrade the connection to a WebSocket connection , I have noticed that the GET request is missing Authorization header. Obviously AG block this request and doesn't even get to the API.
I have tried manually to make a "handshake" with postman.
the above steps :
OK
included Authorization JWT header -> result 101 ,and Fiddler confirm the connection is opened.
I have researched the documentation and found that Authorization headers are not supported.
did anyone tried any workaround ? hen is the next release of the #aspnet/signalr client?
Did you specified the accessTokenFactory?
let connection = new signalR.HubConnectionBuilder()
.withUrl("/myhub", {
accessTokenFactory: () => {
// Get and return the access token.
// This function can return a JavaScript Promise if asynchronous
// logic is required to retrieve the access token.
}
})
.build();
More info here.
so the final resolution is:
that in browsers is a limitation for sending JWT header along with HTTP 101 UPGRADE
I am developing a stateless RESTFul API based on JavaEE 6 and it is important not to store anything in the session.
I am using socialauth java based social auth provider.
I would like to know if there is a way to rebuid SocialAuthManager after a successful authentication without having to retrieve it from the session as documentation explains:
session.setAttribute("authManager", manager);
And then:
SocialAuthManager manager = (SocialAuthManager)session.getAttribute("authManager");
I want to avoid this.
I would like to do something like this:
SocialAuthManager manager = new SocialAuthManager(PARAMS TO REBUILD PREVIOUS AUTH WORKFLOW);
Thanks in advance.
I'm developing social auth with 4.10 version of this lib.
After user get redirection url and is authorized, then I do connection to social service by this way:
AccessGrant accessGrant = manager.createAccessGrant(network.getId(), params);
Optional<Profile> profile = Optional.ofNullable(manager.connect(accessGrant).getUserProfile());
manager.disconnectProvider(network.getId());
Where params - params from request of success callback API. After getting user profile I disconnect manager for reusing it. Also be aware of concurrency when using this method.