summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/uri/tasks/use_gssapi.yml
blob: 6629cee7da10541b566d112072b05ec93ba64b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- name: test that endpoint offers Negotiate auth
  uri:
    url: http://{{ httpbin_host }}/gssapi
    status_code: 401
  register: no_auth_failure
  failed_when: no_auth_failure.www_authenticate != 'Negotiate'

- name: test Negotiate auth over HTTP with explicit credentials
  uri:
    url: http://{{ httpbin_host }}/gssapi
    use_gssapi: yes
    url_username: '{{ krb5_username }}'
    url_password: '{{ krb5_password }}'
    return_content: yes
  register: http_explicit

- name: test Negotiate auth over HTTPS with explicit credentials
  uri:
    url: https://{{ httpbin_host }}/gssapi
    use_gssapi: yes
    url_username: '{{ krb5_username }}'
    url_password: '{{ krb5_password }}'
    return_content: yes
  register: https_explicit

- name: assert test Negotiate auth with implicit credentials
  assert:
    that:
    - http_explicit.status == 200
    - http_explicit.content | trim == 'Microsoft Rulz'
    - https_explicit.status == 200
    - https_explicit.content | trim == 'Microsoft Rulz'

- name: skip tests on macOS, I cannot seem to get it to read a credential from a custom ccache
  when: ansible_facts.distribution != 'MacOSX'
  block:
  - name: get Kerberos ticket for implicit auth tests
    httptester_kinit:
      username: '{{ krb5_username }}'
      password: '{{ krb5_password }}'

  - name: test Negotiate auth over HTTP with implicit credentials
    uri:
      url: http://{{ httpbin_host }}/gssapi
      use_gssapi: yes
      return_content: yes
    register: http_implicit

  - name: test Negotiate auth over HTTPS with implicit credentials
    uri:
      url: https://{{ httpbin_host }}/gssapi
      use_gssapi: yes
      return_content: yes
    register: https_implicit

  - name: assert test Negotiate auth with implicit credentials
    assert:
      that:
      - http_implicit.status == 200
      - http_implicit.content | trim == 'Microsoft Rulz'
      - https_implicit.status == 200
      - https_implicit.content | trim == 'Microsoft Rulz'