cf-uaa-lib 1.3.7 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/lib/uaa/misc.rb +15 -0
- data/lib/uaa/version.rb +1 -1
- data/spec/misc_spec.rb +12 -0
- metadata +20 -65
data/lib/uaa/misc.rb
CHANGED
@@ -60,6 +60,21 @@ class Misc
|
|
60
60
|
raise BadResponse, "Invalid response from target #{target}"
|
61
61
|
end
|
62
62
|
|
63
|
+
# Gets a base url for the associated UAA from the target server by inspecting the
|
64
|
+
# links returned from its info endpoint.
|
65
|
+
# @param [String] target The base URL of the server. For example the target could
|
66
|
+
# be {https://login.cloudfoundry.com}, {https://uaa.cloudfoundry.com}, or
|
67
|
+
# {http://localhost:8080/uaa}.
|
68
|
+
# @return [String] url of UAA (or the target itself if it didn't provide a response)
|
69
|
+
def self.discover_uaa(target)
|
70
|
+
info = server(target)
|
71
|
+
if info['links'] && info['links']['uaa']
|
72
|
+
info['links']['uaa']
|
73
|
+
else
|
74
|
+
target
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
63
78
|
# Gets the key from the server that is used to validate token signatures. If
|
64
79
|
# the server is configured to use a symetric key, the caller must authenticate
|
65
80
|
# by providing a a +client_id+ and +client_secret+. If the server
|
data/lib/uaa/version.rb
CHANGED
data/spec/misc_spec.rb
CHANGED
@@ -37,6 +37,18 @@ describe Misc do
|
|
37
37
|
result["commit_id"].should_not be_nil
|
38
38
|
end
|
39
39
|
|
40
|
+
it "gets UAA target" do
|
41
|
+
Misc.set_request_handler do |url, method, body, headers|
|
42
|
+
url.should == "https://login.cloudfoundry.com/login"
|
43
|
+
method.should == :get
|
44
|
+
headers["content-type"].should be_nil
|
45
|
+
headers["accept"].gsub(/\s/, '').should =~ /application\/json;charset=utf-8/i
|
46
|
+
[200, '{"links":{"uaa":"https://uaa.cloudfoundry.com"},"prompts":["one","two"]}', {"content-type" => "application/json"}]
|
47
|
+
end
|
48
|
+
result = Misc.discover_uaa("https://login.cloudfoundry.com")
|
49
|
+
result.should == "https://uaa.cloudfoundry.com"
|
50
|
+
end
|
51
|
+
|
40
52
|
end
|
41
53
|
|
42
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf-uaa-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,11 +13,11 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-
|
16
|
+
date: 2013-03-08 00:00:00.000000000Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: multi_json
|
20
|
-
requirement: !ruby/object:Gem::Requirement
|
20
|
+
requirement: &21137860 !ruby/object:Gem::Requirement
|
21
21
|
none: false
|
22
22
|
requirements:
|
23
23
|
- - ! '>='
|
@@ -25,15 +25,10 @@ dependencies:
|
|
25
25
|
version: '0'
|
26
26
|
type: :runtime
|
27
27
|
prerelease: false
|
28
|
-
version_requirements:
|
29
|
-
none: false
|
30
|
-
requirements:
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
28
|
+
version_requirements: *21137860
|
34
29
|
- !ruby/object:Gem::Dependency
|
35
30
|
name: bundler
|
36
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirement: &21136940 !ruby/object:Gem::Requirement
|
37
32
|
none: false
|
38
33
|
requirements:
|
39
34
|
- - ! '>='
|
@@ -41,15 +36,10 @@ dependencies:
|
|
41
36
|
version: '0'
|
42
37
|
type: :development
|
43
38
|
prerelease: false
|
44
|
-
version_requirements:
|
45
|
-
none: false
|
46
|
-
requirements:
|
47
|
-
- - ! '>='
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0'
|
39
|
+
version_requirements: *21136940
|
50
40
|
- !ruby/object:Gem::Dependency
|
51
41
|
name: rake
|
52
|
-
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirement: &21136160 !ruby/object:Gem::Requirement
|
53
43
|
none: false
|
54
44
|
requirements:
|
55
45
|
- - ! '>='
|
@@ -57,15 +47,10 @@ dependencies:
|
|
57
47
|
version: '0'
|
58
48
|
type: :development
|
59
49
|
prerelease: false
|
60
|
-
version_requirements:
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - ! '>='
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
50
|
+
version_requirements: *21136160
|
66
51
|
- !ruby/object:Gem::Dependency
|
67
52
|
name: rspec
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
53
|
+
requirement: &21135460 !ruby/object:Gem::Requirement
|
69
54
|
none: false
|
70
55
|
requirements:
|
71
56
|
- - ! '>='
|
@@ -73,15 +58,10 @@ dependencies:
|
|
73
58
|
version: '0'
|
74
59
|
type: :development
|
75
60
|
prerelease: false
|
76
|
-
version_requirements:
|
77
|
-
none: false
|
78
|
-
requirements:
|
79
|
-
- - ! '>='
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
61
|
+
version_requirements: *21135460
|
82
62
|
- !ruby/object:Gem::Dependency
|
83
63
|
name: simplecov
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirement: &21134840 !ruby/object:Gem::Requirement
|
85
65
|
none: false
|
86
66
|
requirements:
|
87
67
|
- - ! '>='
|
@@ -89,15 +69,10 @@ dependencies:
|
|
89
69
|
version: '0'
|
90
70
|
type: :development
|
91
71
|
prerelease: false
|
92
|
-
version_requirements:
|
93
|
-
none: false
|
94
|
-
requirements:
|
95
|
-
- - ! '>='
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
72
|
+
version_requirements: *21134840
|
98
73
|
- !ruby/object:Gem::Dependency
|
99
74
|
name: simplecov-rcov
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirement: &21134140 !ruby/object:Gem::Requirement
|
101
76
|
none: false
|
102
77
|
requirements:
|
103
78
|
- - ! '>='
|
@@ -105,15 +80,10 @@ dependencies:
|
|
105
80
|
version: '0'
|
106
81
|
type: :development
|
107
82
|
prerelease: false
|
108
|
-
version_requirements:
|
109
|
-
none: false
|
110
|
-
requirements:
|
111
|
-
- - ! '>='
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '0'
|
83
|
+
version_requirements: *21134140
|
114
84
|
- !ruby/object:Gem::Dependency
|
115
85
|
name: ci_reporter
|
116
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirement: &21133500 !ruby/object:Gem::Requirement
|
117
87
|
none: false
|
118
88
|
requirements:
|
119
89
|
- - ! '>='
|
@@ -121,15 +91,10 @@ dependencies:
|
|
121
91
|
version: '0'
|
122
92
|
type: :development
|
123
93
|
prerelease: false
|
124
|
-
version_requirements:
|
125
|
-
none: false
|
126
|
-
requirements:
|
127
|
-
- - ! '>='
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '0'
|
94
|
+
version_requirements: *21133500
|
130
95
|
- !ruby/object:Gem::Dependency
|
131
96
|
name: json_pure
|
132
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
+
requirement: &21132540 !ruby/object:Gem::Requirement
|
133
98
|
none: false
|
134
99
|
requirements:
|
135
100
|
- - ! '>='
|
@@ -137,12 +102,7 @@ dependencies:
|
|
137
102
|
version: '0'
|
138
103
|
type: :development
|
139
104
|
prerelease: false
|
140
|
-
version_requirements:
|
141
|
-
none: false
|
142
|
-
requirements:
|
143
|
-
- - ! '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
105
|
+
version_requirements: *21132540
|
146
106
|
description: Client library for interacting with the CloudFoundry User Account and
|
147
107
|
Authorization (UAA) server. The UAA is an OAuth2 Authorization Server so it can
|
148
108
|
be used by webapps and command line apps to obtain access tokens to act on behalf
|
@@ -159,6 +119,7 @@ extensions: []
|
|
159
119
|
extra_rdoc_files: []
|
160
120
|
files:
|
161
121
|
- .gitignore
|
122
|
+
- .travis.yml
|
162
123
|
- .yardopts
|
163
124
|
- Gemfile
|
164
125
|
- LICENSE.TXT
|
@@ -193,21 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
154
|
- - ! '>='
|
194
155
|
- !ruby/object:Gem::Version
|
195
156
|
version: '0'
|
196
|
-
segments:
|
197
|
-
- 0
|
198
|
-
hash: -1584033744634561596
|
199
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
158
|
none: false
|
201
159
|
requirements:
|
202
160
|
- - ! '>='
|
203
161
|
- !ruby/object:Gem::Version
|
204
162
|
version: '0'
|
205
|
-
segments:
|
206
|
-
- 0
|
207
|
-
hash: -1584033744634561596
|
208
163
|
requirements: []
|
209
164
|
rubyforge_project: cf-uaa-lib
|
210
|
-
rubygems_version: 1.8.
|
165
|
+
rubygems_version: 1.8.15
|
211
166
|
signing_key:
|
212
167
|
specification_version: 3
|
213
168
|
summary: Client library for CloudFoundry UAA
|