Code Monkey home page Code Monkey logo

ios-cara's People

Contributors

apps2create avatar dgyesbreghs avatar fousa avatar herre avatar icappscedric avatar ikbendewilliam avatar ronaldhollanderica avatar vanlooverenkoen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ios-cara's Issues

Add an example project

The example project should contain:

  • Different request
  • Different serializers
  • Reachability
  • Different loggers

Support Codable types in request body

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.

Make it possible to use a background `URLSessionConfiguration`

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)

URLAuthenticationChallenge always canceled when authentication method is not "server trust"

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
}

Handle logout

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

Cache the public keys once generated

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.

Handle token refresh

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.