Code Monkey home page Code Monkey logo

intercoop's Introduction

Intercoop

CI Status

Purpose

In the context of intercooperation among social economy entities, these libraries implement a protocol to enable a user of a given entity to use services provided by other entities having a bilateral agreement. This is done keeping the users in control of which are the enabled services and, most important, which entities will be transferred their personal data to.

Some intended goals:

  • Easely extend intercooperation to new entities by sharing a common protocol, so that:
    • You implement once how your users access services provided by many other entities
    • You implement once how to offer our services to users coming from many other entities
  • Be certain that the services request comes from a user of the source entity
  • Keep users in control of how and whom their personal data is transferred to
  • Still avoid the user from having to type personal data again and again

Glossary

  • Entity: one of the social economy peers that are intercooperating
  • User: one of the legal or physical person who have rights regarding a entity
  • Role: A set of rights a user might have within an entity (pe. member, worker, different kind of members...)
  • Source entity: The entity a member has rights on.
  • Target entity: The entity whose services are enabled for members of the source entity.
  • Portal: Website for validated users of the source entity
  • API: B2B web API offered by the target entity to the source entity.

Main protocol sequence

Case: a user of entity A (source) wants to enable service of intercooperation entity B (target):

Preconditions:

  • Each entity has its own RSA public/private pair of keys
  • Intercooperating entities share their public key among them and keep their private one secret
  • User has validated its identity on web portal of entity A

Main course scenario:

  • User indicates to source Portal the intent of activating a service on target entity
  • Source portal shows the user which data will be transferred to target entity (member number, national id, name, address, emal...) and asks for consent
  • User consents the transfer
  • Source portal builds a message cointaining trasferred data and signs it using Source's private key.
  • Source portal sends the message to https API on target entity
  • Target API validates the signature with source's public key, stores the transferred data and generates a token for later reference
  • Target API responds to Source Portal with an url on B having the token embedded inside.
  • Source Portal redirects user's browser to that url, where the process to get the service can continue.

Errors

  • Portal -> API

    • Not yaml message
    • Missing message fields
    • Not yaml payload
    • Missing payload fields
    • Source entity has no intercooperation agreement with target one
    • Bad signature
  • Service errors

    • Service unavailable (at all, for peer, for user, for role)
    • Missing payload fields (because the application needs)

Workflow

Source portal's view

  • Portal renders intercooperation options

    • Access to every provider info an services.
      • Provider: Id, name, description, url, logo, services...
      • Services: id, description, image, activation api
  • User click on one option

    • Browser sends provider and service id
  • Portal asks the user permision to send several data

    • Gather the required data for the service
    • Gather the privacy policy from the service
    • Obtain personal data from the portal ERP user
  • User accepts the transfer and the privacy police

  • Portal sends the info to the provider Api

    • Gather required data for the service
    • Build a signed package with it
    • Send it to the service url
    • Wait response
    • Handle any error if it happens
    • Else redirect user's browser to the url with the token

Target api's view

  • The API receives signed data from a Portal

    • Check and unpack data from package

      • Check package utf8 yaml (raise if not valid yaml)
      • Check fields in package (intercoopversion, payload, signature) (raise if any if missing)
      • Check for matching intercoopversion (raise if different)
      • Base64 decode payload (raise if not bas64 utf8)
      • Parse yaml in decoded payload (raise if not valid yaml)
      • Check originpeer field (raise if there is not)
      • Gather public key for origin peer (raise if there is not such pear)
      • Check signature (raise if untrusted)
    • Check service requirements

      • Check all required fields are in data (raise if not)
      • Check peer-role-service is ok (raise if not)
      • Check info depending of service, for instance:
        • Service geographically availability
        • Limits by user or peer
    • Store data

      • Generate a token
      • Save data related to the token
    • Compose response

      • Embed token into url
      • If have raised an error response is composed
  • The target web/api receives the request url with the token from the user's browser

    • Expires old stored data
    • Gathers the data by token (raises error if so)
    • Creates a session
    • Renders page to follow service procedure

intercoop's People

Contributors

bernatixer avatar cesarlr avatar martic20 avatar martic20mad avatar vokimon avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

intercoop's Issues

Production KeyRing

Example implementation of the KeyRing interface skips any concern on how to obtain the Keys. We should consider providing a production ready implementation.

Options:

  • Directory based: Like example PeerInfo, a directory containing keys with filenames related to the issuing peer.
  • Files + configuration based: You provide a configuration with the paths for every key
  • PeerInfo based: We store the public keys in the peerinfo and rely on PeerInfo interface to access them. (PeerInfo implementation will tell whether they are in a DB o any other location)
  • Database based: We use the underlying platform to get them. (Of course this cannot be that generic)

PHP implementation/wrapper

Some of the partners business platforms use php as programming language instead of python.

Let's reimplement an equivalent php library or wrap the python librarry so that it is available on php.

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.