Hello.
I cannot get uri module to do authentication management with user: and
password: key:value pairs.
It seems the underlying command does not have the auth info, so it cannot
deal with the 401, so the higher level must deal with it. It doesn't do
that, so it looks like the uri module has not implemented it.
Any ETA when basic auth functionality will be implemented?
*FAILING SNIPPET 1*
- name: Get License and Fail
uri:
url: http://127.0.0.1:{{ rt_port }}/{{ rt_route.licenses }}
method: GET
user: "{{ rt_admin.user }}"
passwd: "{{ rt_admin.password }}"
force_basic_auth: yes
return_content: yes
*ACTUAL RESULTS 1 (FAILURE)*
With forced auth, it tries it immediately, then fails with 401. Without
forced auth, tries without any auth, and just completely fails.
Using ngrep:
####
T 2017/04/04 02:47:59.036752 127.0.0.1:52456 -> 127.0.0.1:8081 [AP]
GET /artifactory/api/system/licenses HTTP/1.1.
Accept-Encoding: identity.
Host: 127.0.0.1:8081.
Connection: close.
Authorization: Basic YWRtaW46Tm9uZQ==.
User-Agent: ansible-httpget.
.
##
T 2017/04/04 02:47:59.044548 127.0.0.1:8081 -> 127.0.0.1:52456 [AP]
HTTP/1.1 401 Unauthorized.
Server: Artifactory/5.2.0.
X-Artifactory-Id: 37a6f5fb9ef2b9a4:-3e655bfc:15b34f2ab01:-8000.
WWW-Authenticate: Basic realm="Artifactory Realm".
Content-Type: application/json;charset=ISO-8859-1.
Content-Length: 80.
Date: Tue, 04 Apr 2017 02:47:59 GMT.
Connection: close.
.
##
T 2017/04/04 02:47:59.044658 127.0.0.1:8081 -> 127.0.0.1:52456 [AP]
{
"errors" : [ {
"status" : 401,
"message" : "Bad credentials"
} ]
}
####
*FAILING SNIPPET 2*
- name: Get License and Fail
uri:
url: http://127.0.0.1:{{ rt_port }}/{{ rt_route.licenses }}
method: GET
user: "{{ rt_admin.user }}"
passwd: "{{ rt_admin.password }}"
return_content: yes
*ACTUAL RESULTS 2 (FAILURE)*####
T 2017/04/04 02:50:14.949689 127.0.0.1:52457 -> 127.0.0.1:8081 [AP]
GET /artifactory/api/system/licenses HTTP/1.1.
Accept-Encoding: identity.
Host: 127.0.0.1:8081.
Connection: close.
User-Agent: ansible-httpget.
.
##
T 2017/04/04 02:50:14.951253 127.0.0.1:8081 -> 127.0.0.1:52457 [AP]
HTTP/1.1 401 Unauthorized.
Server: Artifactory/5.2.0.
X-Artifactory-Id: 37a6f5fb9ef2b9a4:-3e655bfc:15b34f2ab01:-8000.
WWW-Authenticate: Basic realm="Artifactory Realm".
Content-Type: application/json.
Transfer-Encoding: chunked.
Date: Tue, 04 Apr 2017 02:50:14 GMT.
Connection: close.
.
##
T 2017/04/04 02:50:14.951330 127.0.0.1:8081 -> 127.0.0.1:52457 [AP]
4d.
##
T 2017/04/04 02:50:14.951365 127.0.0.1:8081 -> 127.0.0.1:52457 [AP]
{
"errors" : [ {
"status" : 401,
"message" : "Unauthorized"
} ]
}
##
T 2017/04/04 02:50:14.951394 127.0.0.1:8081 -> 127.0.0.1:52457 [AP]
.
##
T 2017/04/04 02:50:14.951658 127.0.0.1:8081 -> 127.0.0.1:52457 [AP]
0.
.
####
*WORKAROUND (SUCCESS) SNIPPET*
- name: Get License without user/password key/values
uri:
url: http://{{ rt_admin.user }}:{{ rt_admin.password }}@127.0.0.1:{{
rt_port }}/{{ rt_route.licenses }}
method: GET
return_content: yes
*EXPECTED RESULTS OF SUCCESSFUL SESSION*
Using ngrep:
####
T 2017/04/04 02:46:31.896296 127.0.0.1:52454 -> 127.0.0.1:8081 [AP]
GET /artifactory/api/system/licenses HTTP/1.1.
Accept-Encoding: identity.
Host: 127.0.0.1:8081.
Connection: close.
User-Agent: ansible-httpget.
.
##
T 2017/04/04 02:46:31.900427 127.0.0.1:8081 -> 127.0.0.1:52454 [AP]
HTTP/1.1 401 Unauthorized.
Server: Artifactory/5.2.0.
X-Artifactory-Id: 37a6f5fb9ef2b9a4:-3e655bfc:15b34f2ab01:-8000.
WWW-Authenticate: Basic realm="Artifactory Realm".
Content-Type: application/json.
Transfer-Encoding: chunked.
Date: Tue, 04 Apr 2017 02:46:31 GMT.
Connection: close.
.
##
T 2017/04/04 02:46:31.902824 127.0.0.1:8081 -> 127.0.0.1:52454 [AP]
4d.
#####
T 2017/04/04 02:46:31.903330 127.0.0.1:52455 -> 127.0.0.1:8081 [AP]
GET /artifactory/api/system/licenses HTTP/1.1.
Accept-Encoding: identity.
Host: 127.0.0.1:8081.
Connection: close.
Authorization: Basic YWRtaW46cGFzc3dvcmQ=.
User-Agent: ansible-httpget.
.
##
T 2017/04/04 02:46:31.903436 127.0.0.1:8081 -> 127.0.0.1:52454 [AP]
{
"errors" : [ {
"status" : 401,
"message" : "Unauthorized"
} ]
}
##
T 2017/04/04 02:46:31.903482 127.0.0.1:8081 -> 127.0.0.1:52454 [AP]
.
##
T 2017/04/04 02:46:31.903744 127.0.0.1:8081 -> 127.0.0.1:52454 [AP]
0.
.
###
T 2017/04/04 02:46:31.906314 127.0.0.1:8081 -> 127.0.0.1:52455 [AP]
HTTP/1.1 200 OK.
Server: Artifactory/5.2.0.
X-Artifactory-Id: 37a6f5fb9ef2b9a4:-3e655bfc:15b34f2ab01:-8000.
Content-Type: application/json.
Transfer-Encoding: chunked.
Date: Tue, 04 Apr 2017 02:46:31 GMT.
Connection: close.
.
##
T 2017/04/04 02:46:31.906436 127.0.0.1:8081 -> 127.0.0.1:52455 [AP]
40.
##
T 2017/04/04 02:46:31.906484 127.0.0.1:8081 -> 127.0.0.1:52455 [AP]
{
"type" : "N/A",
"validThrough" : "",
"licensedTo" : ""
}
##
T 2017/04/04 02:46:31.906542 127.0.0.1:8081 -> 127.0.0.1:52455 [AP]
.
##
T 2017/04/04 02:46:31.906916 127.0.0.1:8081 -> 127.0.0.1:52455 [AP]
0.
.
#####
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/fc44c197-1e0a-4a39-a549-0e3b5ce11858%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.