Class: CFoundry::UAAClient
- Inherits:
-
BaseClient
- Object
- BaseClient
- CFoundry::UAAClient
- Defined in:
- lib/cfoundry/uaaclient.rb
Constant Summary
Constants inherited from BaseClient
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#target ⇒ Object
Returns the value of attribute target.
-
#token ⇒ Object
Returns the value of attribute token.
-
#trace ⇒ Object
Returns the value of attribute trace.
Attributes inherited from BaseClient
Instance Method Summary collapse
- #authorize(credentials) ⇒ Object
- #change_password(guid, new, old) ⇒ Object
-
#initialize(target = "https://uaa.cloudfoundry.com", client_id = "vmc") ⇒ UAAClient
constructor
A new instance of UAAClient.
- #prompts ⇒ Object
- #users ⇒ Object
Methods inherited from BaseClient
Constructor Details
#initialize(target = "https://uaa.cloudfoundry.com", client_id = "vmc") ⇒ UAAClient
Returns a new instance of UAAClient.
7 8 9 10 11 12 13 |
# File 'lib/cfoundry/uaaclient.rb', line 7 def initialize( target = "https://uaa.cloudfoundry.com", client_id = "vmc") @target = target @client_id = client_id @redirect_uri = @target + "/redirect/vmc" end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
5 6 7 |
# File 'lib/cfoundry/uaaclient.rb', line 5 def client_id @client_id end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
5 6 7 |
# File 'lib/cfoundry/uaaclient.rb', line 5 def redirect_uri @redirect_uri end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/cfoundry/uaaclient.rb', line 5 def target @target end |
#token ⇒ Object
Returns the value of attribute token.
5 6 7 |
# File 'lib/cfoundry/uaaclient.rb', line 5 def token @token end |
#trace ⇒ Object
Returns the value of attribute trace.
5 6 7 |
# File 'lib/cfoundry/uaaclient.rb', line 5 def trace @trace end |
Instance Method Details
#authorize(credentials) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cfoundry/uaaclient.rb', line 19 def (credentials) query = { :client_id => @client_id, :response_type => "token", :redirect_uri => @redirect_uri } extract_token( post( { :credentials => credentials }, "oauth", "authorize", :form => :headers, :params => query)[:location]) end |
#change_password(guid, new, old) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/cfoundry/uaaclient.rb', line 38 def change_password(guid, new, old) put( { :schemas => ["urn:scim:schemas:core:1.0"], :password => new, :oldPassword => old }, "User", guid, "password", :json => nil) end |
#prompts ⇒ Object
15 16 17 |
# File 'lib/cfoundry/uaaclient.rb', line 15 def prompts get("login", nil => :json)[:prompts] end |
#users ⇒ Object
34 35 36 |
# File 'lib/cfoundry/uaaclient.rb', line 34 def users get("Users", nil => :json) end |