Class: ADAL::UserCredential
- Inherits:
-
Object
- Object
- ADAL::UserCredential
- Includes:
- Logging
- Defined in:
- lib/adal/user_credential.rb
Overview
A convenience class for username and password credentials.
Defined Under Namespace
Modules: AccountType Classes: UnsupportedAccountTypeError
Constant Summary
Constants included from Logging
Logging::DEFAULT_LOG_LEVEL, Logging::DEFAULT_LOG_OUTPUT
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#account_type ⇒ Object
Determines the account type based on a Home Realm Discovery request.
-
#initialize(username, password, authority_host = Authority::WORLD_WIDE_AUTHORITY) ⇒ UserCredential
constructor
Constructs a new UserCredential.
-
#request_params ⇒ Object
The OAuth parameters that respresent this UserCredential.
-
#to_s ⇒ Object
:nocov:.
Methods included from Logging
Constructor Details
#initialize(username, password, authority_host = Authority::WORLD_WIDE_AUTHORITY) ⇒ UserCredential
Constructs a new UserCredential.
63 64 65 66 67 68 69 |
# File 'lib/adal/user_credential.rb', line 63 def initialize( username, password, = Authority::WORLD_WIDE_AUTHORITY) @username = username @password = password @authority_host = @discovery_path = "/common/userrealm/#{URI.escape @username}" end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
54 55 56 |
# File 'lib/adal/user_credential.rb', line 54 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
53 54 55 |
# File 'lib/adal/user_credential.rb', line 53 def username @username end |
Instance Method Details
#account_type ⇒ Object
Determines the account type based on a Home Realm Discovery request.
75 76 77 |
# File 'lib/adal/user_credential.rb', line 75 def account_type realm_discovery_response['account_type'] end |
#request_params ⇒ Object
The OAuth parameters that respresent this UserCredential.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/adal/user_credential.rb', line 83 def request_params case account_type when AccountType::MANAGED managed_request_params when AccountType::FEDERATED federated_request_params else fail UnsupportedAccountTypeError, account_type end end |
#to_s ⇒ Object
:nocov:
95 96 97 |
# File 'lib/adal/user_credential.rb', line 95 def to_s "UserCredential[Username: #{@username}, AccountType: #{account_type}]" end |