cf-uaa-lib 3.2.5 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uaa/token_issuer.rb +7 -0
- data/lib/uaa/version.rb +1 -1
- data/spec/token_issuer_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724dc6bfaa51c2bfcf8488c914581b4596a52fca
|
4
|
+
data.tar.gz: a9c9f6d61094c2c5b0008f9b232540c17aad81ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ea32c489b18713ac195b8ef3819718d8f4c2767d823670a8efef03563176c4c8d9e1cf368134551323d7a6e2575cc3fec1c3efb3a1730e6d1013904b0c6cab
|
7
|
+
data.tar.gz: 60714df4d646b641c90cefbb18957fb4da0074f11c9bd6fa54e346d55785c453f9c9545c9323143d1b957cb8be6a17f03fa5bb2f68a09586d3b41fb85731e30d
|
data/lib/uaa/token_issuer.rb
CHANGED
@@ -245,6 +245,13 @@ class TokenIssuer
|
|
245
245
|
:password => password, :scope => scope)
|
246
246
|
end
|
247
247
|
|
248
|
+
# Uses a one-time passcode obtained from the UAA to get a
|
249
|
+
# token.
|
250
|
+
# @return [TokenInfo]
|
251
|
+
def passcode_grant(passcode, scope = nil)
|
252
|
+
request_token(:grant_type => 'password', :passcode => passcode, :scope => scope)
|
253
|
+
end
|
254
|
+
|
248
255
|
# Gets an access token with the user credentials used for authentication
|
249
256
|
# via the owner password grant.
|
250
257
|
# See {http://tools.ietf.org/html/rfc6749#section-4.3}.
|
data/lib/uaa/version.rb
CHANGED
data/spec/token_issuer_spec.rb
CHANGED
@@ -109,6 +109,27 @@ describe TokenIssuer do
|
|
109
109
|
token.info["expires_in"].should == 98765
|
110
110
|
end
|
111
111
|
|
112
|
+
it "gets a token with passcode" do
|
113
|
+
subject.set_request_handler do |url, method, body, headers|
|
114
|
+
headers["content-type"].should =~ /application\/x-www-form-urlencoded/
|
115
|
+
headers["accept"].should =~ /application\/json/
|
116
|
+
# TODO check basic auth header
|
117
|
+
url.should == "http://test.uaa.target/oauth/token"
|
118
|
+
body.should =~ /(^|&)passcode=12345($|&)/
|
119
|
+
body.should =~ /(^|&)grant_type=password($|&)/
|
120
|
+
method.should == :post
|
121
|
+
reply = {:access_token => "test_access_token", :token_type => "BEARER",
|
122
|
+
:scope => "openid", :expires_in => 98765}
|
123
|
+
[200, Util.json(reply), {"content-type" => "application/json"}]
|
124
|
+
end
|
125
|
+
token = subject.passcode_grant("12345")
|
126
|
+
token.should be_an_instance_of TokenInfo
|
127
|
+
token.info["access_token"].should == "test_access_token"
|
128
|
+
token.info["token_type"].should =~ /^bearer$/i
|
129
|
+
token.info["scope"].should == "openid"
|
130
|
+
token.info["expires_in"].should == 98765
|
131
|
+
end
|
132
|
+
|
112
133
|
end
|
113
134
|
|
114
135
|
describe "#owner_password_credentials_grant" do
|
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Syer
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: multi_json
|