omniauth-uaa-oauth2 0.0.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -2
- data/README.md +9 -19
- data/examples/config.ru +1 -1
- data/lib/omniauth/strategies/cloudfoundry.rb +13 -7
- data/lib/omniauth/uaa_oauth2/version.rb +1 -1
- data/spec/omniauth/strategies/uaa_oauth2_spec.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8de9c63b6c5f6302ff2188fcb99045128f8af146d6014c8a0e26403e23e7b0
|
4
|
+
data.tar.gz: 995fc9391a8e7c91d6464adc34565a825f7c6853877e4b1467326043e38aeb21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a906769d31270b17cf11c0ee1c9f2f905ff7fe2d36d7024a522ffb3d2da756714854f8e3ff71b237944ab11794dbf60161ca44d115986c8c05732a57a3ae0c
|
7
|
+
data.tar.gz: 88982fdba7d3fc827a892bf0fc3317e8261ce7fd1b2d0cd94c9c7730d8d6c9b157bbe6d2f88b1c2d1e82f99dc52fad7c67d0ae0d5767c0689e60162a2633a1b6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -3,28 +3,18 @@ CloudFoundry UAA OmniAuth Strategy
|
|
3
3
|
|
4
4
|
OmniAuth strategy for authenticating users using the CloudFoundry UAA server.
|
5
5
|
|
6
|
-
|
6
|
+
Add the following to your `Gemfile`:
|
7
7
|
|
8
|
-
|
8
|
+
```text
|
9
|
+
gem 'omniauth-uaa-oauth2'
|
10
|
+
```
|
9
11
|
|
10
|
-
|
12
|
+
For example usage see:
|
11
13
|
|
12
|
-
|
14
|
+
* the `examples/config.ru` sample code
|
15
|
+
* https://github.com/starkandwayne/ultimate-guide-to-uaa-examples/tree/master/ruby/omniauth-login-only
|
16
|
+
* https://github.com/starkandwayne/ultimate-guide-to-uaa-examples/tree/master/ruby/omniauth-login-and-uaa-api-calls
|
17
|
+
* https://github.com/starkandwayne/ultimate-guide-to-uaa-examples/tree/master/ruby/resource-server-wrapper-ui
|
13
18
|
|
14
|
-
see: https://rvm.io/ or http://rbenv.org/
|
15
|
-
|
16
|
-
Build and install the cf-uaa-lib gem located at https://github.com/cloudfoundry/cf-uaa-lib
|
17
|
-
|
18
|
-
Build the gem
|
19
|
-
|
20
|
-
$ bundle install
|
21
|
-
$ bundle exec gem build omniauth-uaa-oauth2.gemspec
|
22
|
-
|
23
|
-
Install it
|
24
|
-
|
25
|
-
$ gem install omniauth-uaa-oauth2-*.gem
|
26
|
-
|
27
|
-
|
28
|
-
See the examples folder for details on how to use it.
|
29
19
|
|
30
20
|
Warning: Unlike the omniauth-oauth2 gem, this gem does not support the oauth2 'state' security parameter.
|
data/examples/config.ru
CHANGED
@@ -35,6 +35,8 @@ module OmniAuth
|
|
35
35
|
option :scope, nil
|
36
36
|
option :async_calls, false
|
37
37
|
option :skip_ssl_validation, false
|
38
|
+
option :ssl_ca_file, nil
|
39
|
+
option :ssl_cert_store, nil
|
38
40
|
|
39
41
|
attr_accessor :access_token
|
40
42
|
attr_reader :token_issuer
|
@@ -65,8 +67,10 @@ module OmniAuth
|
|
65
67
|
options.client_id,
|
66
68
|
options.client_secret,
|
67
69
|
{
|
68
|
-
:
|
69
|
-
:
|
70
|
+
token_target: @token_server_url,
|
71
|
+
ssl_ca_file: options.ssl_ca_file,
|
72
|
+
ssl_cert_store: options.ssl_cert_store,
|
73
|
+
skip_ssl_validation: options.skip_ssl_validation
|
70
74
|
})
|
71
75
|
log :info, "Client: #{options.client_id} auth_server: #{@auth_server_url} token_server: #{@token_server_url}"
|
72
76
|
@token_issuer.logger = OmniAuth.logger
|
@@ -78,7 +82,9 @@ module OmniAuth
|
|
78
82
|
def uaa_info
|
79
83
|
@uaa_info ||= CF::UAA::Info.new(
|
80
84
|
@token_server_url,
|
81
|
-
:
|
85
|
+
ssl_ca_file: options.ssl_ca_file,
|
86
|
+
ssl_cert_store: options.ssl_cert_store,
|
87
|
+
skip_ssl_validation: options.skip_ssl_validation
|
82
88
|
)
|
83
89
|
end
|
84
90
|
|
@@ -131,10 +137,10 @@ module OmniAuth
|
|
131
137
|
|
132
138
|
info do
|
133
139
|
prune!({
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
140
|
+
name: raw_info["name"],
|
141
|
+
email: raw_info["email"],
|
142
|
+
first_name: raw_info["given_name"],
|
143
|
+
last_name: raw_info["family_name"]
|
138
144
|
})
|
139
145
|
end
|
140
146
|
|
@@ -31,21 +31,21 @@ describe OmniAuth::Strategies::Cloudfoundry do
|
|
31
31
|
|
32
32
|
describe 'set auth and token server' do
|
33
33
|
it 'should set the right auth and token server' do
|
34
|
-
@options = {:
|
34
|
+
@options = {auth_server_url: 'https://login.cloudfoundry.com'}
|
35
35
|
subject.client
|
36
36
|
subject.auth_server_url.should eq('https://login.cloudfoundry.com')
|
37
37
|
subject.token_server_url.should eq('https://login.cloudfoundry.com')
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'should set the right auth and token server if independently set' do
|
41
|
-
@options = {:
|
41
|
+
@options = {auth_server_url: 'https://login.cloudfoundry.com', token_server_url: 'https://uaa.cloudfoundry.com'}
|
42
42
|
subject.client
|
43
43
|
subject.auth_server_url.should eq('https://login.cloudfoundry.com')
|
44
44
|
subject.token_server_url.should eq('https://uaa.cloudfoundry.com')
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'should set the right auth and token server' do
|
48
|
-
@options = {:
|
48
|
+
@options = {auth_server_url: 'login.cloudfoundry.com'}
|
49
49
|
subject.client
|
50
50
|
subject.auth_server_url.should eq('https://login.cloudfoundry.com')
|
51
51
|
subject.token_server_url.should eq('https://login.cloudfoundry.com')
|
@@ -111,13 +111,13 @@ describe OmniAuth::Strategies::Cloudfoundry do
|
|
111
111
|
|
112
112
|
describe 'set scopes' do
|
113
113
|
it 'should set the right scopes if requested' do
|
114
|
-
@options = {:
|
114
|
+
@options = {auth_server_url: 'https://login.cloudfoundry.com', token_server_url: 'https://uaa.cloudfoundry.com', :scope => "openid cloud_controller.read"}
|
115
115
|
subject.client
|
116
116
|
subject.options[:scope].should eq("openid cloud_controller.read")
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'should not set any scopes if not requested' do
|
120
|
-
@options = {:
|
120
|
+
@options = {auth_server_url: 'https://login.cloudfoundry.com', token_server_url: 'https://uaa.cloudfoundry.com'}
|
121
121
|
subject.client
|
122
122
|
subject.options[:scope].should eq(nil)
|
123
123
|
end
|