omniauth-classlink 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd19e536467b6d9f6d1f6849b3e13b797908acb8
4
- data.tar.gz: 7a13fbd776b77450f8a5716e700622f6a4559394
3
+ metadata.gz: 39a933cfdc9037bea236532c640b54b56a0f2bc7
4
+ data.tar.gz: 75b187f8b5497a9e672f59ebeefefed1eef163b4
5
5
  SHA512:
6
- metadata.gz: 7ee56bba9433274d9cfc34b622ffce6a25890d41bb45ee4df0994745d1ee1f20137b8cdcdff4b1157496ea5290d97f6ffd45cef6224e458a09c07f78ab2110cd
7
- data.tar.gz: 9118728ccad62d52791cd8866abcbbd58fc148fbf0739b6511854b455c45b311802902886421d1fe24b5297e904195066bc4a64daa6ba39a74630904d6a19ee8
6
+ metadata.gz: e9935f73e199f001c676bbe64fa1e9c1181a203521c42d679ad4d410d8df07726da4ccb015de6600b5c351b1f621d47c253add7553a5f5d0443c6d272f6c74f9
7
+ data.tar.gz: f0cf877c8a622c04bff8fab528ade6179a8dc763fd3a9bf7ec699ce30912b129f86084301f055ada1f8e70ba72ef0c917f59d7dc691c605c6dd881fe4ab38f46
data/.gitignore CHANGED
@@ -9,6 +9,7 @@
9
9
  /test/tmp/
10
10
  /test/version_tmp/
11
11
  /tmp/
12
+ Gemfile.lock
12
13
 
13
14
  # Used by dotenv library to load environment variables.
14
15
  # .env
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.1.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
- :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, :email
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
- end
41
- end
42
- end
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
@@ -1 +1 @@
1
- require 'omniauth/classlink'
1
+ require 'omniauth/classlink'
@@ -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/classlink/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.1.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.1.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: 2017-11-09 00:00:00.000000000 Z
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.1.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.1.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/classlink.rb
42
- - lib/omniauth/classlink/version.rb
43
- - lib/omniauth/strategies/classlink.rb
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.5
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: