Module: FellowshipOneAPI::OAuth::CredentialsAuthentication
- Includes:
- FellowshipOneAPI::OAuth
- Defined in:
- lib/f1api/oauth/credentials_authentication.rb
Overview
Implements the Credentials method of authentication. You must manage the credentials.
Instance Attribute Summary
Attributes included from FellowshipOneAPI::OAuth
#authenticated_user_uri, #oauth_access_token, #oauth_consumer, #oauth_consumer_key, #oauth_consumer_secret
Instance Method Summary collapse
-
#authenticate(username, password, type = :portal) ⇒ Object
(also: #authorize)
- Authenticates a user and returns true if successful
username
- The username of the user
password
- The password of the user
type
-
Can be :portal or :weblink based on which credentials you want to authenticate against Returns true if was able to authenticate, false if not.
- The password of the user
- The username of the user
- Authenticates a user and returns true if successful
-
#authenticate!(username, password, type = :portal) ⇒ Object
(also: #authorize!)
- Authenticates a user and throws and error if unable
username
- The username of the user
password
- The password of the user
type
-
Can be :portal or :weblink based on which credentials you want to authenticate against Returns the URI for the authenticated user.
- The password of the user
- The username of the user
- Authenticates a user and throws and error if unable
Methods included from FellowshipOneAPI::OAuth
Instance Method Details
#authenticate(username, password, type = :portal) ⇒ Object Also known as:
Authenticates a user and returns true if successful
username
-
The username of the user
password
-
The password of the user
type
-
Can be :portal or :weblink based on which credentials you want to authenticate against
Returns true if was able to authenticate, false if not
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/f1api/oauth/credentials_authentication.rb', line 25 def authenticate(username, password, type = :portal) response = get_api_response(username, password, type) if(response.code.to_i == 400) return false end handle_response_code(response) @authenticated_user_uri = response["Content-Location"] return true end |
#authenticate!(username, password, type = :portal) ⇒ Object Also known as:
Authenticates a user and throws and error if unable
username
-
The username of the user
password
-
The password of the user
type
-
Can be :portal or :weblink based on which credentials you want to authenticate against
Returns the URI for the authenticated user
11 12 13 14 15 16 17 |
# File 'lib/f1api/oauth/credentials_authentication.rb', line 11 def authenticate!(username, password, type = :portal) response = get_api_response(username, password, type) handle_response_code(response) # Gettting the URI of the authenticated user @authenticated_user_uri = response["Content-Location"] end |