GithubHelp home page GithubHelp logo

gorshenev / omniauth-esia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from elsant/omniauth-esia

0.0 1.0 0.0 16 KB

Unofficial ESIA OAuth2 Strategy for OmniAuth.

License: MIT License

Ruby 100.00%

omniauth-esia's Introduction

OmniAuth Esia (OAuth2)

This is the unofficial OmniAuth strategy for authenticating via OAuth2 to ESIA (GosUslugi). Read more here

Built using omniauth-oauth2.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-esia'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-esia

Usage

OmniAuth::Strategies::Esia is simply a Rack middleware.

In Your Rails application:

# Gemfile
gem 'omniauth-esia'
# config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :esia, ENV['ESIA_ID'],
    scope:    'fullname email',
    key_path: "#{Rails.root}/config/keys/private.key",
    crt_path: "#{Rails.root}/config/keys/certificate.crt"
end

or in Your Rails application with Devise. See full instruction here

# config/initializers/devise.rb
Devise.setup do |config|
  config.omniauth :esia, ENV['ESIA_ID'],
    scope:    'fullname email',
    key_path: "#{Rails.root}/config/keys/private.key",
    crt_path: "#{Rails.root}/config/keys/certificate.crt"
end

Configuring

Read the ESIA docs for more details You can configure several options, which you pass in to the provider method via a Hash:

  • client_id: ESIA identifier
  • scope: a space-separated list of access permissions you want to request from the user. Example 'fullname gender email'
  • key_path: path to private key. Default to config/keys/private.key
  • crt_path: path to certificate. Default to config/keys/certificate.crt
  • client_options: path to certificate. Default to https://esia.gosuslugi.ru. For ESIA's test environment set to https://esia-portal1.test.gosuslugi.ru
client_options: {
        site:          'https://esia-portal1.test.gosuslugi.ru',
        authorize_url: '/aas/oauth2/ac',
        token_url:     '/aas/oauth2/te'
      }

Changes

v 0.2.1 - corrects email fetching v 0.2.0 - corrects namespacing v 0.1.0 - first release

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/elsant/omniauth-esia.

License

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

omniauth-esia's People

Contributors

elsant avatar zinovyev avatar dmeremyanin avatar danila avatar

Watchers

James Cloos avatar

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.