Skip to content

Commit

Permalink
Add --win-sso option (needs optional dependencies)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor Biryukov committed Apr 19, 2020
1 parent a0bead2 commit b68ff70
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,8 @@ def get_version(rel_path):
},

zip_safe=False,
extras_require={
'win-sso': ['requests_negotiate_sspi'],
},
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
)
11 changes: 11 additions & 0 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,16 @@ def check_list_path_option(options):
) # type: Callable[..., Option]


win_sso = partial(
Option,
'--win-sso',
dest='win_sso',
action='store_true',
default=False,
help='Similar to the -UseDefaultCredentials parameter '
'of the Invoke-WebRequest cmdlet in PowerSheell.')


##########
# groups #
##########
Expand Down Expand Up @@ -959,6 +969,7 @@ def check_list_path_option(options):
no_color,
no_python_version_warning,
unstable_feature,
win_sso,
]
} # type: Dict[str, Any]

Expand Down
4 changes: 4 additions & 0 deletions src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def _build_session(self, options, retries=None, timeout=None):
"https": options.proxy,
}

if options.win_sso:
from requests_negotiate_sspi import HttpNegotiateAuth
session.auth = HttpNegotiateAuth()

# Determine if we can prompt the user for authentication or not
session.auth.prompting = not options.no_input

Expand Down

0 comments on commit b68ff70

Please sign in to comment.