Skip to content

Latest commit

 

History

History
126 lines (96 loc) · 3.08 KB

File metadata and controls

126 lines (96 loc) · 3.08 KB

GPLv3 license

Authenticator Identity Service Sinatra Example

Prerequisites

In order to build Salt Edge Authenticator Identity Service Example, it is necessary to install the following tools:

  • Ruby 2.4 or greater

  • sqlite3

     dpkg -s sqlite3
    

    or

     apt-get install sqlite3 libsqlite3-dev
    
  • Bundler

     gem install bundler
    
  • Web server (e.g. nginx) or tunnel (e.g. ngrok)

  • Docker (optional)

Note: Authenticator Mobile clients supports only SSL connections.

Get source code

Fork this repository

Run Sinatra example

  1. Change directory:

    cd saltedge-sca-service-sinatra
    
  2. Run Bundler to pull the required dependencies:

    bundle install
    
  3. Init database configuration

    • Create config/database.yml (cp config/database.example.yml config/database.yml)
    • Change configuiration if you don't need default one.
    • Run Rake task to initiate database bundle exec rake db:migrate
  4. Authenticator Identity Service can send push notifications to mobile clients.

    • Create config/application.yml (cp config/application.example.yml config/application.yml)
    • For activating fill required fields (optional)
  5. Create database (for the first time)

    bundle exec rake db:migrate
    

    or drop before

    bundle exec rake db:drop
    
  6. Run application

    rackup config.ru
    

Run Sinatra example in Docker container

  1. Change directory:

    cd saltedge-sca-service-sinatra
    
  2. Init database configuration

    • Create config/database.yml (cp config/database.example.yml config/database.yml)
    • Change configuiration if you don't need default one.
    • Run Rake task to initiate database bundle exec rake db:migrate
  3. Authenticator Identity Service can send push notifications to mobile clients.

    • Create config/application.yml (cp config/application.example.yml config/application.yml)
    • For activating fill required fields (optional)
  4. Build Docker image:

    docker build -t authenticator/sinatra .
    
  5. Run Docker container and application:

    docker run --rm -p 4567:4567 -v "$(pwd)":/sinatra-example/ --name service authenticator/sinatra
    
  6. Create database and run migrations (for the first time) in new terminal window

    docker exec -ti service bash
    

    and run mugrations in docker container

    bundle exec rake db:migrate
    

    or drop before

    bundle exec rake db:drop
    

How to use Sinatra example

  1. Create new user (if needed)

    curl -w "\n" -d "name=Test&password=test" -X POST http://your_host:4567/admin/users
    
  2. Connect mobile client

  3. Create test authorization

    curl -w "\n" -d "user_id=1&title=Create%20a%20payment&description=550$%20for%20Air%20America&authorization_code=123456789" -X POST http://your_host:4567/admin/authorizations
    

Described above functions are available on Admin page http://your_host:4567/admin


Copyright © 2019 Salt Edge. https://www.saltedge.com