omniauth_elibri 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/lib/omniauth_elibri.rb +36 -0
- data/lib/omniauth_elibri/version.rb +3 -0
- data/omniauth_elibri.gemspec +22 -0
- metadata +83 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "omniauth_elibri/version"
|
2
|
+
|
3
|
+
require 'omniauth-oauth2'
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Elibri < OmniAuth::Strategies::OAuth2
|
7
|
+
# Give your strategy a name.
|
8
|
+
option :name, "elibri"
|
9
|
+
|
10
|
+
# This is where you pass the options you would pass when
|
11
|
+
# initializing your consumer from the OAuth gem.
|
12
|
+
# ważne, że tutaj MUSI być ssl
|
13
|
+
option :client_options, { :site => "https://elibri.com.pl/oauth" }
|
14
|
+
|
15
|
+
# These are called after authentication has succeeded. If
|
16
|
+
# possible, you should try to set the UID without making
|
17
|
+
# additional calls (if the user id is returned with the token
|
18
|
+
# or as a URI parameter). This may not be possible with all
|
19
|
+
# providers.
|
20
|
+
uid{ raw_info['id'] }
|
21
|
+
#TODO: tutaj można dopisać parametry, które zbieramy
|
22
|
+
info do
|
23
|
+
{
|
24
|
+
:full_name => raw_info['full_name'],
|
25
|
+
:email => raw_info['email'],
|
26
|
+
:super_admin => raw_info['super_admin'],
|
27
|
+
:publisher_id => raw_info['publisher_id']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def raw_info
|
32
|
+
@raw_info ||= JSON.parse(access_token.get('/oauth/me').body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth_elibri/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth_elibri"
|
7
|
+
s.version = OmniauthElibri::VERSION
|
8
|
+
s.authors = ["Piotr Szmielew"]
|
9
|
+
s.email = ["p.szmielew@ava.waw.pl"]
|
10
|
+
s.homepage = "http://elibri.com.pl"
|
11
|
+
s.summary = %q{Omniauth strategy, log into your website using eLibri.com.pl account.}
|
12
|
+
s.description = %q{Omniauth strategy, log into your website using eLibri.com.pl account. OAuth2 based strategy - requires you to provide id and secret that you can obtain from eLibri.com.pl site.}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
# specify any dependencies here; for example:
|
20
|
+
# s.add_development_dependency "rspec"
|
21
|
+
s.add_runtime_dependency "omniauth-oauth2"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth_elibri
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Piotr Szmielew
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2012-03-27 00:00:00 Z
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: omniauth-oauth2
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: Omniauth strategy, log into your website using eLibri.com.pl account. OAuth2 based strategy - requires you to provide id and secret that you can obtain from eLibri.com.pl site.
|
34
|
+
email:
|
35
|
+
- p.szmielew@ava.waw.pl
|
36
|
+
executables: []
|
37
|
+
|
38
|
+
extensions: []
|
39
|
+
|
40
|
+
extra_rdoc_files: []
|
41
|
+
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Rakefile
|
46
|
+
- lib/omniauth_elibri.rb
|
47
|
+
- lib/omniauth_elibri/version.rb
|
48
|
+
- omniauth_elibri.gemspec
|
49
|
+
homepage: http://elibri.com.pl
|
50
|
+
licenses: []
|
51
|
+
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.8.17
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Omniauth strategy, log into your website using eLibri.com.pl account.
|
82
|
+
test_files: []
|
83
|
+
|