omniauth-classlink 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +3 -3
- data/README.md +35 -1
- data/lib/omniauth/{classlink → class_link}/version.rb +5 -5
- data/lib/omniauth/{classlink.rb → class_link.rb} +2 -2
- data/lib/omniauth/strategies/{classlink.rb → class_link.rb} +49 -42
- data/lib/omniauth-classlink.rb +1 -1
- data/omniauth-classlink.gemspec +25 -25
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39a933cfdc9037bea236532c640b54b56a0f2bc7
|
4
|
+
data.tar.gz: 75b187f8b5497a9e672f59ebeefefed1eef163b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9935f73e199f001c676bbe64fa1e9c1181a203521c42d679ad4d410d8df07726da4ccb015de6600b5c351b1f621d47c253add7553a5f5d0443c6d272f6c74f9
|
7
|
+
data.tar.gz: f0cf877c8a622c04bff8fab528ade6179a8dc763fd3a9bf7ec699ce30912b129f86084301f055ada1f8e70ba72ef0c917f59d7dc691c605c6dd881fe4ab38f46
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in omniauth-clever.gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in omniauth-clever.gemspec
|
4
4
|
gemspec
|
data/README.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-classlink.svg)](https://badge.fury.io/rb/omniauth-classlink)
|
2
|
+
|
1
3
|
# OmniAuth ClassLink
|
2
|
-
Unofficial OmniAuth strategy for [ClassLink](classlink.com) integration.
|
4
|
+
Unofficial OmniAuth strategy for [ClassLink](https://classlink.com) integration.
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
|
8
|
+
Add the gem to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'omniauth-classlink'
|
12
|
+
```
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
# Usage
|
20
|
+
|
21
|
+
First, you need to have your OAuth2 application registered in ClassLink. After creating one, you'll be provided with access key and secret that should be used for configuring the gem.
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
25
|
+
provider :class_link, 'your-classlink-access-key', 'your-classlink-secret', strategy_class: 'OmniAuth::Strategies::ClassLink'
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
Or, alternatively, if you use [Devise](https://github.com/plataformatec/devise), you can put this in the `Devise.setup` section:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
config.omniauth :class_link,
|
33
|
+
'your-classlink-access-key',
|
34
|
+
'your-classlink-secret',
|
35
|
+
strategy_class: 'OmniAuth::Strategies::ClassLink'
|
36
|
+
```
|
3
37
|
|
4
38
|
# Contributing
|
5
39
|
1. Fork it
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Omniauth
|
2
|
-
module ClassLink
|
3
|
-
VERSION = "0.
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Omniauth
|
2
|
+
module ClassLink
|
3
|
+
VERSION = "0.2.0"
|
4
|
+
end
|
5
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
require 'omniauth/classlink/version'
|
2
|
-
require 'omniauth/strategies/classlink'
|
1
|
+
require 'omniauth/classlink/version'
|
2
|
+
require 'omniauth/strategies/classlink'
|
@@ -1,42 +1,49 @@
|
|
1
|
-
require 'omniauth-oauth2'
|
2
|
-
require 'base64'
|
3
|
-
|
4
|
-
module OmniAuth
|
5
|
-
module Strategies
|
6
|
-
class ClassLink < OmniAuth::Strategies::OAuth2
|
7
|
-
option :name, :classlink
|
8
|
-
option :client_options, {
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
}
|
13
|
-
option :fields, [:email, :profile]
|
14
|
-
option :uid_field,
|
15
|
-
|
16
|
-
def authorize_params
|
17
|
-
super.tap do |params|
|
18
|
-
params[:scope] = [:email, :profile]
|
19
|
-
params[:response_type] = :code
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
info do
|
24
|
-
{
|
25
|
-
first_name: raw_info['FirstName'],
|
26
|
-
district_id: raw_info['TenantId'],
|
27
|
-
classlink_id: raw_info['UserId'],
|
28
|
-
external_id: raw_info['SourcedId'],
|
29
|
-
role: raw_info['Role']
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
extra do
|
34
|
-
{ 'raw_info' => raw_info }
|
35
|
-
end
|
36
|
-
|
37
|
-
def raw_info
|
38
|
-
@raw_info ||= access_token.get('https://nodeapi.classlink.com/v2/my/info').parsed
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class ClassLink < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, :classlink
|
8
|
+
option :client_options, {
|
9
|
+
site: 'https://launchpad.classlink.com',
|
10
|
+
authorize_url: '/oauth2/v2/auth',
|
11
|
+
token_url: '/oauth2/v2/token'
|
12
|
+
}
|
13
|
+
option :fields, [:email, :profile]
|
14
|
+
option :uid_field, 'UserId'
|
15
|
+
|
16
|
+
def authorize_params
|
17
|
+
super.tap do |params|
|
18
|
+
params[:scope] = [:email, :profile]
|
19
|
+
params[:response_type] = :code
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
info do
|
24
|
+
{
|
25
|
+
first_name: raw_info['FirstName'],
|
26
|
+
district_id: raw_info['TenantId'],
|
27
|
+
classlink_id: raw_info['UserId'],
|
28
|
+
external_id: raw_info['SourcedId'],
|
29
|
+
role: raw_info['Role']
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
extra do
|
34
|
+
{ 'raw_info' => raw_info }
|
35
|
+
end
|
36
|
+
|
37
|
+
def raw_info
|
38
|
+
@raw_info ||= access_token.get('https://nodeapi.classlink.com/v2/my/info').parsed
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def callback_url
|
44
|
+
# You can overwrite it for development purposes
|
45
|
+
options[:redirect_uri] || super
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/omniauth-classlink.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'omniauth/classlink'
|
1
|
+
require 'omniauth/classlink'
|
data/omniauth-classlink.gemspec
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'omniauth/
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "omniauth-classlink"
|
8
|
-
gem.version = Omniauth::ClassLink::VERSION
|
9
|
-
gem.authors = ["Kamil Bednarz"]
|
10
|
-
gem.email = ["kamil.bednarz@u2i.com"]
|
11
|
-
gem.description = %q{Unofficial OmniAuth strategy for ClassLink SSO OAuth2 integration}
|
12
|
-
gem.summary = %q{The unofficial strategy for authenticating users using launchpad.classlink.com using OAuth2 provider}
|
13
|
-
gem.homepage = "https://github.com/u2i/omniauth-classlink"
|
14
|
-
gem.license = 'Apache2'
|
15
|
-
|
16
|
-
gem.signing_key = ENV['GEM_PRIVATE_KEY']
|
17
|
-
gem.cert_chain = ['gem-public_cert.pem']
|
18
|
-
|
19
|
-
gem.files = `git ls-files`.split($/)
|
20
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
-
gem.require_paths = ["lib"]
|
23
|
-
|
24
|
-
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.
|
25
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/class_link/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "omniauth-classlink"
|
8
|
+
gem.version = Omniauth::ClassLink::VERSION
|
9
|
+
gem.authors = ["Kamil Bednarz"]
|
10
|
+
gem.email = ["kamil.bednarz@u2i.com"]
|
11
|
+
gem.description = %q{Unofficial OmniAuth strategy for ClassLink SSO OAuth2 integration}
|
12
|
+
gem.summary = %q{The unofficial strategy for authenticating users using launchpad.classlink.com using OAuth2 provider}
|
13
|
+
gem.homepage = "https://github.com/u2i/omniauth-classlink"
|
14
|
+
gem.license = 'Apache2'
|
15
|
+
|
16
|
+
gem.signing_key = ENV['GEM_PRIVATE_KEY']
|
17
|
+
gem.cert_chain = ['gem-public_cert.pem']
|
18
|
+
|
19
|
+
gem.files = `git ls-files`.split($/)
|
20
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
|
24
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.4'
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-classlink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Bednarz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- gem-public_cert.pem
|
12
|
-
date:
|
12
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: '1.4'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 1.
|
27
|
+
version: '1.4'
|
28
28
|
description: Unofficial OmniAuth strategy for ClassLink SSO OAuth2 integration
|
29
29
|
email:
|
30
30
|
- kamil.bednarz@u2i.com
|
@@ -38,9 +38,9 @@ files:
|
|
38
38
|
- README.md
|
39
39
|
- Rakefile
|
40
40
|
- lib/omniauth-classlink.rb
|
41
|
-
- lib/omniauth/
|
42
|
-
- lib/omniauth/
|
43
|
-
- lib/omniauth/strategies/
|
41
|
+
- lib/omniauth/class_link.rb
|
42
|
+
- lib/omniauth/class_link/version.rb
|
43
|
+
- lib/omniauth/strategies/class_link.rb
|
44
44
|
- omniauth-classlink.gemspec
|
45
45
|
homepage: https://github.com/u2i/omniauth-classlink
|
46
46
|
licenses:
|
@@ -62,10 +62,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.2.
|
65
|
+
rubygems_version: 2.5.2.3
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: The unofficial strategy for authenticating users using launchpad.classlink.com
|
69
69
|
using OAuth2 provider
|
70
70
|
test_files: []
|
71
|
-
has_rdoc:
|