icapps / ios-cara Goto Github PK
View Code? Open in Web Editor NEWOur generic webservice layer
License: MIT License
Our generic webservice layer
License: MIT License
The example project should contain:
Currently Cara supports two types for the body parameter: Data
and any Foundation type that can be serialised using JSONSerialization
.
It would be nice if it would also support a third type: Codable
. That would allow us to use any type that implements the Codable
protocol as the body.
Currently we are working around this by manually encoding to Data
and then using that in the body, but that makes error handling cumbersome and is error prone to do every time.
This is useful when you want to send analytics to your own server, and you want this to happen in the most performant way.
Make sure that the completion handler can be triggered from the UIApplicationDelegate
.
func application(_ application: UIApplication,
handleEventsForBackgroundURLSession identifier: String,
completionHandler: @escaping () -> Void)
I am by no means an expert on authentication, this is just what I found by trial and error.
When making a request, sometimes an authentication challenge of type NSURLAuthenticationMethodClientCertificate
is received. This causes Cara to cancel the authentication challenge, and therefore failing the network request.
Would it be possible to change this behaviour? I tried it with completionHandler(.performDefaultHandling, nil)
, and that seems to work fine. I have no idea what the security implications of that are though.
This happens on NetworkService.swift:88:
guard
let serverTrust = challenge.protectionSpace.serverTrust,
challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust else {
completionHandler(.cancelAuthenticationChallenge, nil) // <---
return
}
I would use this framework. But make it possible to use it with our Service
instance.
When the token refresh fails we should be able to tell the client that a logout occurred.
Maybe it's a good idea to make it possible to handle a response in a different way then triggering the default completion handler. ex. HTTP status code 503 should trigger something. This way we could also handle the token refresh #14
The public keys are generated for the domain on every request. but I think we should cache the generated value so that the public key pinning process is optimised.
We could maybe use Starscream for this feature.
We need a mechanism where a refresh can be executed when some HTTP status code is thrown. The refresh will an another Request
.
Make sure that when we fire a lot of requests at the same time that the refresh Request
isn't triggered multiple times. So some blocking the thread and keeping track of the triggered requests should be handled.
Maybe it's also a good idea to have support for SSL Pinning.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.