support git remotes that need http basic auth
using git credential to get the password One thing this doesn't do is wrap the password prompting inside the prompt action. So with -J, the output can be a bit garbled.
This commit is contained in:
parent
45250c3273
commit
1883f7ef8f
12 changed files with 143 additions and 44 deletions
|
@ -1,6 +1,6 @@
|
|||
{- git credential interface
|
||||
-
|
||||
- Copyright 2019 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2019-2020 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -22,6 +22,23 @@ credentialUsername = M.lookup "username" . fromCredential
|
|||
credentialPassword :: Credential -> Maybe String
|
||||
credentialPassword = M.lookup "password" . fromCredential
|
||||
|
||||
credentialBasicAuth :: Credential -> Maybe BasicAuth
|
||||
credentialBasicAuth cred = BasicAuth
|
||||
<$> credentialUsername cred
|
||||
<*> credentialPassword cred
|
||||
|
||||
getBasicAuthFromCredential :: Repo -> GetBasicAuth
|
||||
getBasicAuthFromCredential r u = do
|
||||
c <- getUrlCredential u r
|
||||
case credentialBasicAuth c of
|
||||
Just ba -> return $ Just (ba, signalsuccess c)
|
||||
Nothing -> do
|
||||
signalsuccess c False
|
||||
return Nothing
|
||||
where
|
||||
signalsuccess c True = approveUrlCredential c r
|
||||
signalsuccess c False = rejectUrlCredential c r
|
||||
|
||||
-- | This may prompt the user for login information, or get cached login
|
||||
-- information.
|
||||
getUrlCredential :: URLString -> Repo -> IO Credential
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue