Giter Site home page Giter Site logo

omnidesk_auth's Introduction

Gem Version Build Status Code Climate Test Coverage

OmnideskAuth

Installation

Add this line to your application's Gemfile:

gem 'omnidesk_auth'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omnidesk_auth

Usage

Rails

Configure

# config/initializers/omnidesk_auth.rb
OmnideskAuth.configure do |auth|
  auth.endpoint = 'http://mycompany.omnidesk.ru'
  auth.secret = '<secret token>'
end

Note: The OmnideskAuth module takes the configuration defaults from environment variables:

  • OMNIDESK_AUTH_SECRET
  • OMNIDESK_AUTH_ENDPOINT
  • OMNIDESK_AUTH_EXPIRE

See: OmnideskAuth::Default

Controller

# app/controllers/support_controller.rb
class SupportController < ApplicationController
  def omnidesk_sign_in
    redirect_to OmnideskAuth.sso_auth_url(email: current_user.email)
  end
end

According to the documentation omnidesk service accepts as binding the following fields:

  • iat (required) - Issued At (the time when the token was generated))
  • email (required) - user email

Parameter "iat" is installed automatically during the generation of the token, but is also available for self-installation via the options hash. Parameter email is the only field that you need to be sure to pass.

Example of filling in all possible fields:

def omnidesk_sign_in
  redirect_to OmnideskAuth.sso_auth_url(
    iat: Time.current.to_i,
    name: current_user.name,
    email: current_user.email,
    external_id: current_user.id,
    company_name: current_user.company.name,
    company_position: current_user.position,
    remote_photo_url: current_user.avatar_url,
    exp: 1.day)
end

See more: Omnidesk documention

License

The gem is available as open source under the terms of the MIT License.

omnidesk_auth's People

Contributors

v-kolesnikov avatar

Watchers

James Cloos avatar  avatar

omnidesk_auth's Issues

TODO

Write documentation for multi clients

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.