cf-uaa-lib 3.2.5 → 3.3.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: 22244230c33436d1113ddefaa82fd4e8f68f611b
4
- data.tar.gz: 67c4faa41e5dabcd57944e634dc1d7689ff63402
3
+ metadata.gz: 724dc6bfaa51c2bfcf8488c914581b4596a52fca
4
+ data.tar.gz: a9c9f6d61094c2c5b0008f9b232540c17aad81ca
5
5
  SHA512:
6
- metadata.gz: 08a6c3960dfd815606d99b477450068c1350f8ecfca4617f2bd9401faa594565290aa4c1c191fc48254a25b27b629701525bee4192cc23df8a1c835b791257b5
7
- data.tar.gz: be6448d4cc5dddb693a122b7cf86062c62f950163dbb648cb0c03cee05899f74b47081e7b1e85aef9f95973fa995c5b52f004bd152c401050713ee2a44eb12b1
6
+ metadata.gz: a7ea32c489b18713ac195b8ef3819718d8f4c2767d823670a8efef03563176c4c8d9e1cf368134551323d7a6e2575cc3fec1c3efb3a1730e6d1013904b0c6cab
7
+ data.tar.gz: 60714df4d646b641c90cefbb18957fb4da0074f11c9bd6fa54e346d55785c453f9c9545c9323143d1b957cb8be6a17f03fa5bb2f68a09586d3b41fb85731e30d
@@ -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
@@ -14,6 +14,6 @@
14
14
  # Cloud Foundry namespace
15
15
  module CF
16
16
  module UAA
17
- VERSION = "3.2.5"
17
+ VERSION = "3.3.0"
18
18
  end
19
19
  end
@@ -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.2.5
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: 2015-12-01 00:00:00.000000000 Z
15
+ date: 2016-03-25 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json