Skip to content

Commit cbfaa5b

Browse files
committed
Se actualiza a V2
1 parent 52e380d commit cbfaa5b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/Authentication/auth_request.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
require 'net/http'
21
require_relative 'auth_response.rb'
2+
require_relative '../Helpers/request_helper.rb'
33

44
class SwAuthentication
55
def self.authentication(url, user, password)
6-
url = URI(url + "/security/authenticate")
7-
http = Net::HTTP.new(url.host, url.port)
8-
request = Net::HTTP::Post.new(url)
9-
request["user"] = user
10-
request["password"] = password
11-
response = http.request(request)
6+
endpoint = URI(url + "/v2/security/authenticate")
7+
payload = {'user': user, 'password': password}
8+
response = RequestHelper.post_json_request_without_token(endpoint,payload)
129
response_obj = AuthResponse.new(response)
1310
return response_obj.validate_status_code(response_obj)
14-
end
15-
end
11+
end
12+
end

0 commit comments

Comments
 (0)