1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/brightbox/oauth2.rb
2012-11-28 17:44:25 +00:00

35 lines
1 KiB
Ruby

# This module covers Brightbox's partial implementation of OAuth 2.0
# and enables fog clients to implement several authentictication strategies
#
# @see http://tools.ietf.org/html/draft-ietf-oauth-v2-10
#
module Fog::Brightbox::OAuth2
# Encapsulates credentials required to request access tokens from the
# Brightbox authorisation servers
#
# @todo Interface to update certain credentials (after password change)
#
class CredentialSet
attr_reader :client_id, :client_secret, :username, :password
#
# @param [String] client_id
# @param [String] client_secret
# @param [Hash] options
# @option options [String] :username
# @option options [String] :password
#
def initialize(client_id, client_secret, options = {})
@client_id = client_id
@client_secret = client_secret
@username = options[:username]
@password = options[:password]
end
# Returns true if user details are available
# @return [Boolean]
def user_details?
!!(@username && @password)
end
end
end