Class: Bosh::Director::Api::UAAIdentityProvider
- Defined in:
- lib/bosh/director/api/uaa_identity_provider.rb
Constant Summary collapse
- MAX_TOKEN_EXTENSION_TIME_IN_SECONDS =
3600
Instance Method Summary collapse
- #client_info ⇒ Object
- #get_user(request_env, options) ⇒ Object
-
#initialize(options) ⇒ UAAIdentityProvider
constructor
A new instance of UAAIdentityProvider.
- #supports_api_update? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ UAAIdentityProvider
Returns a new instance of UAAIdentityProvider.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bosh/director/api/uaa_identity_provider.rb', line 9 def initialize() raise ValidationExtraField if .has_key?('url') && .has_key?('urls') if .has_key?('url') @urls = [.fetch('url')] else @urls = .fetch('urls') end Config.logger.debug "Initializing UAA Identity provider with urls #{@urls}" @token_coder = CF::UAA::TokenCoder.new(skey: .fetch('symmetric_key', nil), pkey: .fetch('public_key', nil), scope: []) end |
Instance Method Details
#client_info ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/bosh/director/api/uaa_identity_provider.rb', line 24 def client_info { 'type' => 'uaa', 'options' => { 'url' => @urls.first, 'urls' => @urls } } end |
#get_user(request_env, options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bosh/director/api/uaa_identity_provider.rb', line 34 def get_user(request_env, ) auth_header = request_env['HTTP_AUTHORIZATION'] if [:extended_token_timeout] request_time_in_seconds = request_env.fetch('HTTP_X_BOSH_UPLOAD_REQUEST_TIME').to_i request_time_in_seconds = MAX_TOKEN_EXTENSION_TIME_IN_SECONDS if request_time_in_seconds > MAX_TOKEN_EXTENSION_TIME_IN_SECONDS Config.logger.debug("Using extended token timeout, request took #{request_time_in_seconds} seconds") token = @token_coder.decode_at_reference_time(auth_header, Time.now.to_i - request_time_in_seconds) else token = @token_coder.decode(auth_header) end UaaUser.new(token) rescue CF::UAA::DecodeError, CF::UAA::AuthError => e raise AuthenticationError, e. end |
#supports_api_update? ⇒ Boolean
20 21 22 |
# File 'lib/bosh/director/api/uaa_identity_provider.rb', line 20 def supports_api_update? false end |