Class: Bosh::Cli::Client::Uaa::AuthInfo
- Defined in:
- lib/cli/client/uaa/auth_info.rb
Defined Under Namespace
Classes: ValidationError
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#ssl_ca_file ⇒ Object
readonly
Returns the value of attribute ssl_ca_file.
Instance Method Summary collapse
- #client_auth? ⇒ Boolean
-
#initialize(director, env, ssl_ca_file) ⇒ AuthInfo
constructor
A new instance of AuthInfo.
- #uaa? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize(director, env, ssl_ca_file) ⇒ AuthInfo
Returns a new instance of AuthInfo.
12 13 14 15 16 |
# File 'lib/cli/client/uaa/auth_info.rb', line 12 def initialize(director, env, ssl_ca_file) @director = director @client_id, @client_secret = env['BOSH_CLIENT'], env['BOSH_CLIENT_SECRET'] @ssl_ca_file = ssl_ca_file end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
10 11 12 |
# File 'lib/cli/client/uaa/auth_info.rb', line 10 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
10 11 12 |
# File 'lib/cli/client/uaa/auth_info.rb', line 10 def client_secret @client_secret end |
#ssl_ca_file ⇒ Object (readonly)
Returns the value of attribute ssl_ca_file.
10 11 12 |
# File 'lib/cli/client/uaa/auth_info.rb', line 10 def ssl_ca_file @ssl_ca_file end |
Instance Method Details
#client_auth? ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cli/client/uaa/auth_info.rb', line 18 def client_auth? if @client_id.nil? && !@client_secret.nil? raise ValidationError.new('BOSH_CLIENT is missing') end if @client_secret.nil? && !@client_id.nil? raise ValidationError.new('BOSH_CLIENT_SECRET is missing') end !@client_id.nil? && !@client_secret.nil? end |
#uaa? ⇒ Boolean
29 30 31 |
# File 'lib/cli/client/uaa/auth_info.rb', line 29 def uaa? auth_info['type'] == 'uaa' end |
#url ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cli/client/uaa/auth_info.rb', line 33 def url url = auth_info.fetch('options', {}).fetch('url', nil) if url unless URI.parse(url).instance_of?(URI::HTTPS) raise ValidationError.new('HTTPS protocol is required') end end url end |