omniauth-fiware 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ *.gem
2
+ .bundle
3
+ .config
4
+ .yardoc
5
+ Gemfile.lock
6
+ coverage
7
+ doc/
8
+ /pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-social_stream.gemspec
4
+ gemspec
@@ -0,0 +1,27 @@
1
+ # OmniAuth FI-WARE
2
+
3
+ This is the OmniAuth strategy for authenticating to a FI-WARE Identity Management
4
+ Generic Enabler (IdM GE) placed at https://idm.lab.fi-ware.eu/
5
+
6
+ ## Usage
7
+
8
+ Add this gem to your Gemfile and bundle:
9
+
10
+ gem 'omniauth-fiware'
11
+
12
+ You need to sign up for an OAuth2 Application ID and Secret
13
+ on the [FI-WARE IdM GE](https://idm.lab.fi-ware.eu). Afterwards, configure it
14
+ in your application. If you are using Devise, you can add the followint to
15
+ <pre>config/initializers/devise.rb</pre>
16
+
17
+ provider :fiware, <CLIENT_KEY>, <CLIENT_SECRET>
18
+
19
+ ## License
20
+
21
+ Copyright (c) 2013 Universidad Politécnica de Madrid
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Run specs'
8
+ task :default => :spec
@@ -0,0 +1,4 @@
1
+ require 'omniauth-socialstream'
2
+
3
+ require "omniauth/fiware/version"
4
+ require 'omniauth/strategies/fiware'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Fiware
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ require 'omniauth-socialstream'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Fiware < OmniAuth::Strategies::Socialstream
6
+ option :client_options, {
7
+ :site => 'https://idm.lab.fi-ware.eu',
8
+ :authorize_url => 'https://idm.lab.fi-ware.eu/oauth2/authorize',
9
+ :token_url => 'https://idm.lab.fi-ware.eu/oauth2/token'
10
+ }
11
+
12
+ =begin
13
+ uid { raw_info['id'].to_s }
14
+
15
+ info do
16
+ {
17
+ 'nickname' => raw_info['nickName'],
18
+ 'email' => raw_info['email'],
19
+ 'name' => raw_info['displayName'],
20
+ }
21
+ end
22
+
23
+ extra do
24
+ {:raw_info => raw_info}
25
+ end
26
+ =end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/omniauth/fiware/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = [ "Antonio Tapiador",
6
+ "GING - DIT - UPM" ]
7
+ gem.email = [ "social-stream@dit.upm.es"]
8
+ gem.description = "OmniAuth strategy for FI-WARE IdM GE."
9
+ gem.summary = "FI-WARE will deliver a novel service infrastructure, building upon elements (called Generic Enablers). This is the OmniAuth strategy for Identity Management GE"
10
+ gem.homepage = "https://github.com/ging/omniauth-fiware"
11
+
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
+ gem.files = `git ls-files`.split("\n")
14
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ gem.name = "omniauth-fiware"
16
+ gem.require_paths = ["lib"]
17
+ gem.version = OmniAuth::Fiware::VERSION
18
+
19
+ gem.add_dependency 'omniauth-socialstream', '~> 0.1.3'
20
+
21
+ gem.add_development_dependency 'rspec', '~> 2.7'
22
+ gem.add_development_dependency 'rake'
23
+ gem.add_development_dependency 'rack-test'
24
+ gem.add_development_dependency 'simplecov'
25
+ gem.add_development_dependency 'webmock'
26
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Fiware do
4
+ let(:access_token) { stub('AccessToken', :options => {}) }
5
+ let(:parsed_response) { stub('ParsedResponse') }
6
+ let(:response) { stub('Response', :parsed => parsed_response) }
7
+
8
+ let(:other_site) { 'https://some.other.site.com' }
9
+ let(:other_authorize_url) { 'https://some.other.site.com/login/oauth/authorize' }
10
+ let(:other_token_url) { 'https://some.other.site.com/login/oauth/access_token' }
11
+ let(:other) do
12
+ OmniAuth::Strategies::Socialstream.new('CLIENT_KEY', 'CLIENT_SECRET',
13
+ {
14
+ :client_options => {
15
+ :site => other_site,
16
+ :authorize_url => other_authorize_url,
17
+ :token_url => other_token_url
18
+ }
19
+ }
20
+ )
21
+ end
22
+
23
+ subject do
24
+ OmniAuth::Strategies::Fiware.new({})
25
+ end
26
+
27
+ before(:each) do
28
+ subject.stub!(:access_token).and_return(access_token)
29
+ end
30
+
31
+ context "client options" do
32
+ it 'should have correct site' do
33
+ subject.options.client_options.site.should eq("https://idm.lab.fi-ware.eu")
34
+ end
35
+
36
+ it 'should have correct authorize url' do
37
+ subject.options.client_options.authorize_url.should eq('https://idm.lab.fi-ware.eu/oauth2/authorize')
38
+ end
39
+
40
+ it 'should have correct token url' do
41
+ subject.options.client_options.token_url.should eq('https://idm.lab.fi-ware.eu/oauth2/token')
42
+ end
43
+
44
+ describe "should be overrideable" do
45
+ it "for site" do
46
+ other.options.client_options.site.should eq(other_site)
47
+ end
48
+
49
+ it "for authorize url" do
50
+ other.options.client_options.authorize_url.should eq(other_authorize_url)
51
+ end
52
+
53
+ it "for token url" do
54
+ other.options.client_options.token_url.should eq(other_token_url)
55
+ end
56
+ end
57
+ end
58
+
59
+ context "#raw_info" do
60
+ it "should use relative paths" do
61
+ access_token.should_receive(:token)
62
+ access_token.should_receive(:get).with('user.json', {:params=>{:access_token=>nil}}).and_return(response)
63
+ subject.raw_info.should eq(parsed_response)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,16 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-fiware'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-fiware
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Antonio Tapiador
9
+ - GING - DIT - UPM
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2013-02-18 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: omniauth-socialstream
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.3
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.1.3
31
+ - !ruby/object:Gem::Dependency
32
+ name: rspec
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '2.7'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '2.7'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: rack-test
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: simplecov
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: webmock
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: OmniAuth strategy for FI-WARE IdM GE.
112
+ email:
113
+ - social-stream@dit.upm.es
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - .travis.yml
121
+ - Gemfile
122
+ - README.md
123
+ - Rakefile
124
+ - lib/omniauth-fiware.rb
125
+ - lib/omniauth/fiware/version.rb
126
+ - lib/omniauth/strategies/fiware.rb
127
+ - omniauth-fiware.gemspec
128
+ - spec/omniauth/strategies/fiware_spec.rb
129
+ - spec/spec_helper.rb
130
+ homepage: https://github.com/ging/omniauth-fiware
131
+ licenses: []
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ! '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 1.8.24
151
+ signing_key:
152
+ specification_version: 3
153
+ summary: FI-WARE will deliver a novel service infrastructure, building upon elements
154
+ (called Generic Enablers). This is the OmniAuth strategy for Identity Management
155
+ GE
156
+ test_files: []
157
+ has_rdoc: