Module: Agilix::Buzz::Commands::Authentication
- Included in:
- Api
- Defined in:
- lib/agilix/buzz/commands/authentication.rb
Instance Method Summary collapse
-
#compute_hmac(options = {}) ⇒ Object
This requires a key to exist with the given keyname, see putkey not sure what its used for yet api.compute_hmac.
-
#extend_session ⇒ Object
This is handled automatically by instantiation of a base Agilix::Buzz::Api instance and on subsequent calls to the api through the check_authentication method api.extend_session.
-
#force_password_change(options = {}) ⇒ Object
api.force_password_change userid: 57181.
-
#get_key(options = {}) ⇒ Object
api.get_key entityid: 57031, name: ‘secret_key_1’.
-
#get_password_login_attempt_history(options = {}) ⇒ Object
api.get_password_login_attempt_history userid: 57181 api.get_password_login_attempt_history userid: 57181, earliestrecordtoreturn: ‘2018-01-01’.
-
#get_password_policy(options = {}) ⇒ Object
api.get_password_policy api.get_password_policy domainid: 57031.
-
#get_password_question(options = {}) ⇒ Object
api.get_password_question username: “auto-tests/BuzzUserUp1”.
-
#login2(username:, password:, domain:) ⇒ Object
(also: #login)
This is handled automatically by instantiation of a base Agilix::Buzz::Api instance.
-
#logout ⇒ Object
api.logout.
-
#proxy(options = {}) ⇒ Object
api.proxy userid: 57181.
-
#proxy_api(userid:) ⇒ Object
proxy_api = api.proxy_api userid: 57181.
-
#proxy_sso_link(userid:, redirect_url: "home") ⇒ Object
api.proxy_sso_link userid: 57181.
-
#put_key(options = {}) ⇒ Object
ISSUE: This should be a POST method as it’s storing data api.put_key entityid: 57031, name: ‘secret_key_1’, value: “Super Secret”.
-
#reset_lockout(options = {}) ⇒ Object
api.reset_lockout userid: 57181.
- #reset_password(options = {}) ⇒ Object
-
#unproxy(options = {}) ⇒ Object
proxy_api = api.proxy_api userid: 57181 proxy_api.unproxy userid: 57181.
-
#update_password(options = {}) ⇒ Object
api.update_password userid: 57181, password: “IChanged123”.
-
#update_password_question_answer(options = {}) ⇒ Object
ISSUE: This works with a GET call api.update_password_question_answer userid: 57181, passwordquestion: “Where is your favorite vacation place?”, passwordanswer: “Hawaii”.
Instance Method Details
#compute_hmac(options = {}) ⇒ Object
This requires a key to exist with the given keyname, see putkey not sure what its used for yet api.compute_hmac
139 140 141 142 143 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 139 def compute_hmac( = {}) = argument_cleaner(required_params: %i( domainid keyname message ), optional_params: %i( algorithm format ), options: ) [:message] = "$VAR_USERID#{[:message]}$VAR_SECRETTime$VAR_TIME" authenticated_get cmd: "computeHMAC", ** end |
#extend_session ⇒ Object
This is handled automatically by instantiation of a base Agilix::Buzz::Api instance and on subsequent calls to the api through the check_authentication method api.extend_session
23 24 25 26 27 28 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 23 def extend_session response = authenticated_post cmd: "extendsession", bypass_authentication_check: true @token_expiration = set_token_expiration(response.dig("response", "session", "authenticationexpirationminutes")) authenticate! if response.dig("response", "code") == "NoAuthentication" response end |
#force_password_change(options = {}) ⇒ Object
api.force_password_change userid: 57181
31 32 33 34 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 31 def force_password_change( = {}) = argument_cleaner(required_params: %i( userid ), optional_params: %i( ), options: ) authenticated_post cmd: "forcepasswordchange", ** end |
#get_key(options = {}) ⇒ Object
api.get_key entityid: 57031, name: ‘secret_key_1’
131 132 133 134 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 131 def get_key( = {}) = argument_cleaner(required_params: %i( entityid name ), optional_params: %i( ), options: ) authenticated_get cmd: "getkey", ** end |
#get_password_login_attempt_history(options = {}) ⇒ Object
api.get_password_login_attempt_history userid: 57181 api.get_password_login_attempt_history userid: 57181, earliestrecordtoreturn: ‘2018-01-01’
38 39 40 41 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 38 def get_password_login_attempt_history( = {}) = argument_cleaner(required_params: %i( userid ), optional_params: %i( earliestrecordtoreturn ), options: ) authenticated_get cmd: "getpasswordloginattempthistory", ** end |
#get_password_policy(options = {}) ⇒ Object
api.get_password_policy api.get_password_policy domainid: 57031
45 46 47 48 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 45 def get_password_policy( = {}) = argument_cleaner(required_params: %i( ), optional_params: %i( domainid bypasscache ), options: ) authenticated_get cmd: "getpasswordpolicy", ** end |
#get_password_question(options = {}) ⇒ Object
api.get_password_question username: “auto-tests/BuzzUserUp1”
51 52 53 54 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 51 def get_password_question( = {}) = argument_cleaner(required_params: %i( username ), optional_params: %i( ), options: ) authenticated_get cmd: "getpasswordquestion", ** end |
#login2(username:, password:, domain:) ⇒ Object Also known as: login
This is handled automatically by instantiation of a base Agilix::Buzz::Api instance. It wouldn’t need to be called manually unless using for other users or making calls on their behalf api.login username: ‘my-username’, password: ‘my-password’, domain: ‘my-domain’
8 9 10 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 8 def login2(username: , password: , domain: ) post cmd: "login2", username: "#{domain}/#{username}", password: password end |
#logout ⇒ Object
api.logout
14 15 16 17 18 19 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 14 def logout response = authenticated_get cmd: "logout" @token = nil @token_expiration = nil response end |
#proxy(options = {}) ⇒ Object
api.proxy userid: 57181
64 65 66 67 68 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 64 def proxy( = {}) = argument_cleaner(required_params: %i( userid ), optional_params: %i( noazt ), options: ) [:noazt] ||= true authenticated_post cmd: "proxy", ** end |
#proxy_api(userid:) ⇒ Object
proxy_api = api.proxy_api userid: 57181
79 80 81 82 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 79 def proxy_api(userid: ) response = proxy userid: userid self.class.new username: response.dig('response', 'user', 'username'), token: response.dig('response', 'user', 'token'), domain: response.dig('response', 'user', 'userspace'), token_expiration: set_token_expiration(response.dig('response', 'user', 'authenticationexpirationminutes')) end |
#proxy_sso_link(userid:, redirect_url: "home") ⇒ Object
api.proxy_sso_link userid: 57181
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 85 def proxy_sso_link(userid: , redirect_url: "home") response = proxy userid: userid # sso = { # "customization": { # "authentication": { # "provider": { # "server": "https://www.google.com" # } # } # } # } # self.update_domains [ {domainid: response.dig('response', 'user', 'domainid'), data: sso}] userspace = response.dig('response', 'user', 'userspace') token = response.dig('response', 'user', 'token') # "https://api.leaderinme.net/SSOLogin?domainid=#{response.dig('response', 'user', 'domainid')}&url=/home&token=#{response.dig('response', 'user', 'token')}" if token && userspace "https://#{userspace}.leaderinme.net/login?token=#{token}&url=/#{redirect_url}" end end |
#put_key(options = {}) ⇒ Object
ISSUE: This should be a POST method as it’s storing data api.put_key entityid: 57031, name: ‘secret_key_1’, value: “Super Secret”
125 126 127 128 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 125 def put_key( = {}) = argument_cleaner(required_params: %i( entityid name value ), optional_params: %i( ), options: ) authenticated_get cmd: "putkey", ** end |
#reset_lockout(options = {}) ⇒ Object
api.reset_lockout userid: 57181
106 107 108 109 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 106 def reset_lockout( = {}) = argument_cleaner(required_params: %i( userid ), optional_params: %i( ), options: ) authenticated_post cmd: "resetlockout", ** end |
#reset_password(options = {}) ⇒ Object
112 113 114 115 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 112 def reset_password( = {}) = argument_cleaner(required_params: %i( username ), optional_params: %i( answer ), options: ) authenticated_get cmd: "resetpassword", ** end |
#unproxy(options = {}) ⇒ Object
proxy_api = api.proxy_api userid: 57181 proxy_api.unproxy userid: 57181
72 73 74 75 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 72 def unproxy( = {}) = argument_cleaner(required_params: %i( userid ), optional_params: %i( noazt ), options: ) authenticated_post cmd: "unproxy", ** end |
#update_password(options = {}) ⇒ Object
api.update_password userid: 57181, password: “IChanged123”
118 119 120 121 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 118 def update_password( = {}) = argument_cleaner(required_params: %i( userid password ), optional_params: %i( token oldpassword ), options: ) authenticated_get cmd: "updatepassword", ** end |
#update_password_question_answer(options = {}) ⇒ Object
ISSUE: This works with a GET call api.update_password_question_answer userid: 57181, passwordquestion: “Where is your favorite vacation place?”, passwordanswer: “Hawaii”
58 59 60 61 |
# File 'lib/agilix/buzz/commands/authentication.rb', line 58 def update_password_question_answer( = {}) = argument_cleaner(required_params: %i( userid passwordquestion passwordanswer ), optional_params: %i( oldpassword ), options: ) authenticated_post cmd: "updatepasswordquestionanswer", ** end |