Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated about a month ago

total matches: 40

HTTP-4000.3.14
2 matches
Network/HTTP/Auth.hs
-- If a client nonce was to be used then this function might need to be of type ... -> BrowserAction String
withAuthority :: Authority -> Request ty -> String
withAuthority a rq = case a of
        AuthBasic{}  -> "Basic " ++ base64encode (auUsername a ++ ':' : auPassword a)
        AuthDigest{} ->
            "Digest " ++
             concat [ "username="  ++ quo (auUsername a)
                    , ",realm="    ++ quo (auRealm a)
                    , ",nonce="    ++ quo (auNonce a)

            
Network/HTTP/Base.hs
        (Just u, Just p) ->
          insertHeaderIfMissing HdrAuthorization astr req
            where
              astr = "Basic " ++ base64encode (u ++ ":" ++ p)
              base64encode = Base64.encode . stringToOctets :: String -> String
              stringToOctets = map (fromIntegral . fromEnum) :: String -> [Word8]
        (_, _) -> req
    Nothing ->req


            
Spock-core-0.13.0.0
1 matches
test/Web/Spock/FrameworkSpecHelper.hs
    where
      mkAuthHeader :: BS.ByteString -> BS.ByteString -> Header
      mkAuthHeader user pass =
          ("Authorization", "Basic " <> (B64.encode $ user <> ":" <> pass))

cookieTest :: SpecWith Wai.Application
cookieTest =
    describe "Cookies" $
    do it "sets single cookies correctly" $

            
access-token-provider-0.1.1.0
1 matches
src/Security/AccessTokenProvider/Internal/Providers/OAuth2/Ropcg.hs
                 & map Text.encodeUtf8
                 & ByteString.intercalate ":"
                 & B64.encode
  in ("Authorization", "Basic " <> b64Token)

retrieveJson
  :: (FromJSON a, MonadCatch m)
  => Backend m
  -> FilePath

            
api-tools-0.8.0.2
1 matches
src/Data/API/NormalForm.hs
  ppLines (NEnumType vals)   = "enum"   : map (\ v -> "  | " ++ pp v)
                                              (Set.toList vals)
  ppLines (NTypeSynonym t)   = [pp t]
  ppLines (NNewtype b)       = ["basic " ++ pp b]

            
approveapi-0.1.3.0
1 matches
lib/ApproveApi/Model.hs
      then req `setHeader` toHeader ("Authorization", T.decodeUtf8 cred)
           & L.over rAuthTypesL (P.filter (/= P.typeOf a))
      else req
    where cred = BC.append "Basic " (B64.encode $ BC.concat [ user, ":", pw ])



            
belka-0.8
1 matches
library/Belka/Ptr/Poking.hs

basicAuth :: Text -> Text -> Poking
basicAuth user password =
  bytes "Basic " <> bytes (A.encode bodyBytes)
  where
    bodyBytes =
      if password == ""
        then B.encodeUtf8 user
        else O.poking (bytes (B.encodeUtf8 user) <> asciiChar ':' <> bytes (B.encodeUtf8 password))

            
bitcoin-hs-0.0.1
1 matches
Bitcoin/RPC/HTTP.hs

  let text = (Text.JSON.encode $ encodeRequest request) 
  let Base64 unpw = base64Encode (uname ++ ":" ++ pw)
      auth = "Basic " ++ unpw

  -- print    auth                   -- debugging !!!!!!!!!!!!!!
  -- putStrLn text

  let headers = 

            
cabal-install-bundle-1.18.0.2.1
1 matches
Network/HTTP/Auth.hs
-- If a client nonce was to be used then this function might need to be of type ... -> BrowserAction String
withAuthority :: Authority -> Request ty -> String
withAuthority a rq = case a of
        AuthBasic{}  -> "Basic " ++ base64encode (auUsername a ++ ':' : auPassword a)
        AuthDigest{} ->
            "Digest " ++
	     concat [ "username="  ++ quo (auUsername a)
	            , ",realm="    ++ quo (auRealm a)
		    , ",nonce="    ++ quo (auNonce a)

            
gitit-0.12.3.2
1 matches
src/Network/Gitit/Framework.hs

pBasicHeader :: GenParser Char st String
pBasicHeader = do
  _ <- string "Basic "
  result' <- many (noneOf " \t\n")
  return $ takeWhile (/=':') $ UTF8.toString
         $ decodeLenient $ UTF8.fromString result'

-- | @unlessNoEdit responder fallback@ runs @responder@ unless the

            
gssapi-wai-0.1.2.3
1 matches
src/Network/Wai/Middleware/SpnegoAuth.hs
      fakeAuth user myreq
        | spnegoFakeBasicAuth =
            let oldHeaders = requestHeaders myreq
                fakeHeader = (hAuthorization, "Basic " <> B64.encode (stripSpnegoRealm user <> ":password"))
            in myreq{requestHeaders=fakeHeader : oldHeaders}
        | otherwise = myreq

      modifyKrbUser orig_user
        | spnegoForceRealm = user <> fromMaybe "" (("@" <>) <$> spnegoRealm)

            
hackage-server-0.5.0
2 matches
Distribution/Server/Features/LegacyPasswds/Auth.hs
    getHeaderAuth :: Request -> Maybe BS.ByteString
    getHeaderAuth req
      | Just hdr <- getHeader "authorization" req
      , BS.isPrefixOf (BS.pack "Basic ") hdr
      = Just (BS.drop 6 hdr)

      | otherwise
      = Nothing


            
Distribution/Server/Framework/Auth.hs
            |  BS.isPrefixOf (BS.pack "Digest ") hdr
            -> Just (DigestAuth, BS.drop 7 hdr)

            |  BS.isPrefixOf (BS.pack "Basic ") hdr
            -> Just (BasicAuth,  BS.drop 6 hdr)
          _ -> Nothing

data AuthType = BasicAuth | DigestAuth


            
hgithub-0.1.0
2 matches
Network/GitHub.hs
apiGetRequest :: B.ByteString -> String
  -> [(CI B.ByteString, B.ByteString)] -> IO (Request IO)
apiGetRequest usernamePassword uri parameters = do
  let auth = "Basic " `B.append` B64.encode usernamePassword
  request <- parseUrl $ "https://api.github.com" ++ uri
  let request' = request
        { requestHeaders = ("Authorization", auth) : parameters }
  return request'


            
Network/GitHub.hs
-- body.
apiPostRequest :: B.ByteString -> String -> L.ByteString -> IO (Request IO)
apiPostRequest usernamePassword uri body = do
  let auth = "Basic " `B.append` B64.encode usernamePassword
  request <- parseUrl $ "https://api.github.com" ++ uri
  let request' = request
        { method = "POST"
        , requestHeaders = [("Authorization", auth)]
        , requestBody = RequestBodyLBS body

            
hoggl-0.2.0.0
1 matches
src/Network/Hoggl/Types.hs
           deriving (Show,Eq)

instance ToHttpApiData Token where
   toUrlPiece (Api token) = toUrlPiece $ "Basic " ++ encode (token ++ ":api_token")
   toUrlPiece (UserPass user pass) = toUrlPiece $ "Basic " ++ encode (user ++ ":" ++ pass)

data HogglError = ServantError ServantError | HogglError String deriving Show

data TimeEntryStart = TES { tesDescription :: Maybe Text
                          , tesTags :: [Text]

            
http-api-data-0.4.1
2 matches
src/Web/Internal/HttpApiData.hs

-- $setup
-- >>> data BasicAuthToken = BasicAuthToken Text deriving (Show)
-- >>> instance FromHttpApiData BasicAuthToken where parseHeader h = BasicAuthToken <$> parseHeaderWithPrefix "Basic " h; parseQueryParam p = BasicAuthToken <$> parseQueryParam p
-- >>> import Data.Time.Compat
-- >>> import Data.Version

-- | Convert value to HTTP API data.
--

            
src/Web/Internal/HttpApiData.hs
-- data BasicAuthToken = BasicAuthToken Text deriving (Show)
--
-- instance FromHttpApiData BasicAuthToken where
--   parseHeader h     = BasicAuthToken \<$\> parseHeaderWithPrefix "Basic " h
--   parseQueryParam p = BasicAuthToken \<$\> parseQueryParam p
-- @
--
-- >>> parseHeader "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" :: Either Text BasicAuthToken
-- Right (BasicAuthToken "QWxhZGRpbjpvcGVuIHNlc2FtZQ==")

            
http-client-0.6.4
1 matches
Network/HTTP/Client/Request.hs
    -> S8.ByteString -- ^ Password
    -> S8.ByteString
buildBasicAuth user passwd =
    S8.append "Basic " (BAE.convertToBase BAE.Base64 (S8.concat [ user, ":", passwd ]))

-- | Add a Basic Auth header (with the specified user name and password) to the
-- given Request. Ignore error handling:
--
-- >  applyBasicAuth "user" "pass" $ parseRequest_ url

            
http-client-auth-0.1.0.1
1 matches
src/Network/HTTP/Client/Auth.hs
    -> MaybeT (ResourceT IO) String
makeRequestHeader _ _ _ _ None = mzero
makeRequestHeader login password _ _ (Basic _) =
    return $ "Basic " ++ concat (lines $ B64.encode $ login ++ ':' : password)
makeRequestHeader login password cnonce req (Digest dc) =
    do entityBodyHash <- lift $ lift $ makeRequestBodyHash req
       let fields =
               [
                return "Digest",

            
http-common-0.8.2.0
1 matches
lib/Network/Http/RequestBuilder.hs
setAuthorizationBasic user' passwd' = do
    setHeader "Authorization" v'
  where
    v'   = S.concat ["Basic ", msg']
    msg' = BS64.encode str'
    str' = S.concat [user', ":", passwd']


type ContentType = ByteString

            
http-conduit-browser-2.0.0.1
1 matches
test/main.hs
                        setAuthorities $ const $ Just (user, pass)
                        makeRequestLbs request
                killThread tid
                if lazyToStrict (responseBody elbs) /= (utf8String "Basic " `mappend` (encode $ user `mappend` ":" `mappend` pass))
                     then error "Authorities didn't get set correctly!"
                     else return ()
            it "can follow redirects" $ do
                tid <- forkIO $ run 3014 app
                request <- parseUrl "http://127.0.0.1:3014/redir1"

            
http-dispatch-0.6.2.0
1 matches
src/Network/HTTP/Dispatch/Headers.hs
-- | Helper to generate Basic authentication
basicAuth :: S.ByteString -> S.ByteString -> Header
basicAuth user pass = ("Authorization", auth)
    where auth = "Basic " <> userPassEncoded
          userPassEncoded = B64.encode $ user <> ":" <> pass

            
http-enumerator-0.7.3.3
1 matches
Network/HTTP/Enumerator.hs
    req { requestHeaders = authHeader : requestHeaders req }
  where
    authHeader = (CI.mk "Authorization", basic)
    basic = S8.append "Basic " (B64.encode $ S8.concat [ user, ":", passwd ])


-- | Add a proxy to the the Request so that the Request when executed will use
-- the provided proxy.
addProxy :: S.ByteString -> Int -> Request m -> Request m

            
openapi-petstore-0.0.4.0
1 matches
lib/OpenAPIPetstore/Model.hs
      then req `setHeader` toHeader ("Authorization", T.decodeUtf8 cred)
           & L.over rAuthTypesL (P.filter (/= P.typeOf a))
      else req
    where cred = BC.append "Basic " (B64.encode $ BC.concat [ user, ":", pw ])

-- ** AuthOAuthPetstoreAuth
data AuthOAuthPetstoreAuth =
  AuthOAuthPetstoreAuth Text -- ^ secret
  deriving (P.Eq, P.Show, P.Typeable)

            
pokitdok-4.1.0.2
1 matches
PokitDok/Requests.hs

-- The basic authorization header as a String tuple, given an OAuth2.
basicH     :: OAuth2      -> (String, String)
basicH (OAuth2 id sec _ _ _ _)      = makeAuthHeader $ "Basic "++B64.encode(id++":"++sec)

-- The pokitdok-haskell user agent header, as a String tuple.
userAgentH :: (String, String)
userAgentH = makeUserAgentHeader $ "haskell-pokitdok/" ++ httpPackageVersion


            
postgrest-6.0.0
1 matches
test/SpecHelper.hs

authHeaderBasic :: BS.ByteString -> BS.ByteString -> Header
authHeaderBasic u p =
  (hAuthorization, "Basic " <> (toS . B64.encode . toS $ u <> ":" <> p))

authHeaderJWT :: BS.ByteString -> Header
authHeaderJWT token =
  (hAuthorization, "Bearer " <> token)


            
req-oauth2-0.1.0.0
1 matches
lib/Network/HTTP/Req/OAuth2/Internal/Util.hs

oAuth2AuthHeader :: ClientPair -> Option scheme
oAuth2AuthHeader clientPair =
    header "Authorization" (ByteString.append "Basic " (encodeClientAuth clientPair))
    where
        encodeClientAuth (ClientPair (ClientId cid) (ClientSecret cs)) = Base64.encode $ ByteString.concat [Text.encodeUtf8 cid, ":", Text.encodeUtf8 cs]

oAuth2BearerHeader :: AccessToken -> Option 'Https
oAuth2BearerHeader (AccessToken at) = oAuth2Bearer (Text.encodeUtf8 at)

            
servant-client-core-0.16
1 matches
src/Servant/Client/Core/BasicAuth.hs
-- | Authenticate a request using Basic Authentication
basicAuthReq :: BasicAuthData -> Request -> Request
basicAuthReq (BasicAuthData user pass) req =
    let authText = decodeUtf8 ("Basic " <> encode (user <> ":" <> pass))
    in addHeader "Authorization" authText req

            
servant-server-0.16.1
1 matches
test/Servant/ServerSpec.hs

      context "Basic Authentication" $ do
        let basicAuthHeaders user password =
              [("Authorization", "Basic " <> Base64.encode (user <> ":" <> password))]
        it "returns 401 when no credentials given" $ do
          get "/basic" `shouldRespondWith` 401

        it "returns 403 when invalid credentials given" $ do
          THW.request methodGet "/basic" (basicAuthHeaders "servant" "wrong") ""