@@ -52,57 +52,58 @@ For a more technical explanation of what mutual authentication actually
52
52
guarantees, I refer you to rfc2743 (GSSAPIv2), rfc4120 (krb5 in GSSAPI),
53
53
rfc4178 (SPNEGO), and rfc4559 (HTTP Negotiate).
54
54
55
- REQUIRED
55
+
56
+ DISABLED
56
57
^^^^^^^^
57
58
58
- By default, ``HTTPSPNEGOAuth `` will require mutual authentication from the
59
- server, and if a server emits a non-error response which cannot be
60
- authenticated, a ``requests_gssapi.errors.MutualAuthenticationError `` will
61
- be raised. If a server emits an error which cannot be authenticated, it will
62
- be returned to the user but with its contents and headers stripped. If the
63
- response content is more important than the need for mutual auth on errors,
64
- (eg, for certain WinRM calls) the stripping behavior can be suppressed by
65
- setting ``sanitize_mutual_error_response=False ``:
59
+ By default, there's no need to explicitly disable mutual authentication.
60
+ However, for compatability with older versions of request_gssapi or
61
+ requests_kerberos, you can explicitly request it not be attempted:
66
62
67
63
.. code-block :: python
68
64
69
65
>> > import requests
70
- >> > from requests_gssapi import HTTPSPNEGOAuth, REQUIRED
71
- >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = REQUIRED , sanitize_mutual_error_response = False )
72
- >> > r = requests.get(" https://windows. example.org/wsman " , auth = gssapi_auth)
66
+ >> > from requests_gssapi import HTTPSPNEGOAuth, DISABLED
67
+ >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = DISABLED )
68
+ >> > r = requests.get(" https://example.org" , auth = gssapi_auth)
73
69
...
74
70
75
-
76
- OPTIONAL
71
+ REQUIRED
77
72
^^^^^^^^
78
73
79
- If you'd prefer to not require mutual authentication, you can set your
80
- preference when constructing your ``HTTPSPNEGOAuth `` object:
74
+ This was historically the default, but no longer is. If requested,
75
+ ``HTTPSPNEGOAuth `` will require mutual authentication from the server, and if
76
+ a server emits a non-error response which cannot be authenticated, a
77
+ ``requests_gssapi.errors.MutualAuthenticationError `` will be raised. (See
78
+ above for what this means.) If a server emits an error which cannot be
79
+ authenticated, it will be returned to the user but with its contents and
80
+ headers stripped. If the response content is more important than the need for
81
+ mutual auth on errors, (eg, for certain WinRM calls) the stripping behavior
82
+ can be suppressed by setting ``sanitize_mutual_error_response=False ``:
81
83
82
84
.. code-block :: python
83
85
84
86
>> > import requests
85
- >> > from requests_gssapi import HTTPSPNEGOAuth, OPTIONAL
86
- >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = OPTIONAL )
87
- >> > r = requests.get(" http ://example.org" , auth = gssapi_auth)
87
+ >> > from requests_gssapi import HTTPSPNEGOAuth, REQUIRED
88
+ >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = REQUIRED , sanitize_mutual_error_response = False )
89
+ >> > r = requests.get(" https ://windows. example.org/wsman " , auth = gssapi_auth)
88
90
...
89
91
90
- This will cause ``requests_gssapi `` to attempt mutual authentication if the
91
- server advertises that it supports it, and cause a failure if authentication
92
- fails, but not if the server does not support it at all.
93
-
94
- DISABLED
92
+ OPTIONAL
95
93
^^^^^^^^
96
94
97
- While we don't recommend it, if you'd prefer to never attempt mutual
98
- authentication, you can do that as well:
95
+ This will cause ``requests_gssapi `` to attempt mutual authentication if the
96
+ server advertises that it supports it, and cause a failure if authentication
97
+ fails, but not if the server does not support it at all. This is probably not
98
+ what you want: link tampering will either cause hard failures, or silently
99
+ cause it to not happen at all. It is retained for compatability.
99
100
100
101
.. code-block :: python
101
102
102
103
>> > import requests
103
- >> > from requests_gssapi import HTTPSPNEGOAuth, DISABLED
104
- >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = DISABLED )
105
- >> > r = requests.get(" http ://example.org" , auth = gssapi_auth)
104
+ >> > from requests_gssapi import HTTPSPNEGOAuth, OPTIONAL
105
+ >> > gssapi_auth = HTTPSPNEGOAuth(mutual_authentication = OPTIONAL )
106
+ >> > r = requests.get(" https ://example.org" , auth = gssapi_auth)
106
107
...
107
108
108
109
Opportunistic Authentication
0 commit comments