Commit graph

58 commits

Author SHA1 Message Date
aaron levin
743c51b3c5 Update server authentication with new GADT 2015-12-24 12:09:12 +01:00
aaron levin
88974106b1 Update server for new Delayed type 2015-12-20 23:00:43 +01:00
aaron levin
b2103790b0 Remove warnings 2015-12-20 22:51:34 +01:00
aaron levin
c432891035 Update HasServer instances for auth lax/strict 2015-12-20 22:51:34 +01:00
aaron levin
ee1e0fe355 Delayed handler for Lax authentication 2015-12-20 22:51:32 +01:00
aaron levin
1aca415ec7 Use new Delayed type to capture authentication 2015-12-20 22:49:56 +01:00
Arian van Putten
667dbbc8cd Make auth tests 2015-12-20 22:49:50 +01:00
Arian van Putten
dc699a93e0 Refine the jwt api 2015-12-20 22:49:50 +01:00
aaron levin
2b3df72fa2 Begin integrating upstream changes into auth 2015-12-20 22:49:50 +01:00
aaron levin
2424424ab2 servant-server: Remove unnecessary dependency on Common.Text 2015-12-20 22:49:50 +01:00
Arian van Putten
4965f1a113 Add instances for auth in servant-mock 2015-12-20 22:47:35 +01:00
Arian van Putten
c64fa05611 Change JSON to be the bearing type of JWT auth.
This way both client and server can be the same API type.
2015-12-20 22:41:06 +01:00
Arian van Putten
a76b1f9e90 Export the auth stuff for jwt 2015-12-20 22:41:06 +01:00
Arian van Putten
51a68bd60d Add JWT to servant-server 2015-12-20 22:41:06 +01:00
aaron levin
dd003b6887 Fix warnings 2015-12-20 22:41:05 +01:00
aaron levin
c7da1ba9dc Small haddocks changes for authentication 2015-12-20 22:41:05 +01:00
aaron levin
65bfa1d844 Remove derived 'Show' instance for 'RR' 2015-12-20 22:41:05 +01:00
aaron levin
4cb14a6659 Remove 'Show' instance for RouteMismatch 2015-12-20 22:41:05 +01:00
Alp Mestanogullari
c7caebad59 fix some build errors on 7.8/7.10 2015-12-20 22:41:05 +01:00
aaron levin
842dc1d934 explicitly import 'mempty' for GHC 7.8.4 2015-12-20 22:41:05 +01:00
aaron levin
961c08bdac Swap AuthHandlers and subserver placement
if subserver is last it makes it easier to work with.
2015-12-20 22:41:05 +01:00
aaron levin
db0931941b Cleanup import failures and compiler warnings 2015-12-20 22:41:05 +01:00
Andres Loeh
4c83843489 Second Iteration of Authentication
Implemented with the AuthProtected data family as per alp's suggestion.

(during rebase, removed monoid instance for RouteResult)
2015-12-20 22:41:05 +01:00
aaron levin
42d0234cdc Add BasicAuth tests 2015-12-20 22:41:05 +01:00
aaron levin
bc10a9a127 Authentication cleanup 2015-12-20 22:41:05 +01:00
aaron levin
bde02d5f45 First attempt at BasicAuth combinators
Add `authVal` to BasicAuth, assist type inference

Type inference is difficult with `BasicAuth` and  `BasicAuthLookup`.
This is because `BasicAuthLookup` introduces a type variable `authVal`
and is not bound to anything when used in the context of `HasServer`'s
type.

Servant compiles (temp commit - delete)
2015-12-20 22:41:05 +01:00
Julian K. Arni
9c12b7839b 7.8 routing fixes, -Wall, cleanup, changelog. 2015-10-26 16:56:46 +01:00
Andres Loeh
1398d1f5e1 More systematic approach to delayed checks.
This introduces a `Delayed` type in `RoutingApplication.hs` that
contains a handler together with delayed checks. There are several
blocks of delayed checks, so that we can ultimately execute them in the
order we desire.

The process is documented in more detail in `RoutingApplication.hs`.
2015-10-26 16:56:25 +01:00
Julian K. Arni
ccadba81ec Cleanup errorspec description of routing, changelog.
Review fixes
2015-10-26 16:55:13 +01:00
Julian K. Arni
a3b5652ab9 Refactor RouteResult.
Fix rerouting tests
        Fix 405 > 404 issue with Capture.
        Remove ServantErrWithPriority and Monoid instance
        More tests
        Update auth-combinator for routing changes
2015-10-26 16:54:49 +01:00
Julian K. Arni
afc76b8f6c Remove MatrixParam.
In servant, servant-server, and servant-client.
2015-10-13 21:37:07 +02:00
Matthias Fischmann
8f01efd599 Export tweakResponse from non-internal module; better haddock comment. 2015-10-12 21:58:06 +02:00
Matthias Fischmann
d106ed9c9f Use Functor class for functor business. 2015-10-12 21:47:47 +02:00
Matthias Fischmann
96f10add65 fmapRouter. 2015-10-12 17:06:43 +02:00
Nickolay Kudasov
63a36e3b4e Fix warning 2015-10-08 00:57:18 +03:00
Nickolay Kudasov
40d2c68897 Use http-api-data package instead of ToText/FromText 2015-10-08 00:38:47 +03:00
Julian K. Arni
2be621871d Document octet-stream default RFC. 2015-09-15 17:24:37 +02:00
Index Int
f2f7b061d2 Drop EitherT in favor of ExceptT 2015-09-12 15:11:24 +03:00
Julian K. Arni
6eb7add53a stylish haskell changes
And import fix.
2015-08-18 00:07:12 +02:00
Julian K. Arni
98b6e85128 Contributing 2015-08-17 23:50:42 +02:00
Brandon Martin
050aa21b9d Response with Head to all Get requests
Signed-off-by: Brandon Martin <zmbmartin@gmail.com>
2015-08-01 07:58:56 -06:00
Alp Mestanogullari
f39d57c6b3 add HttpVersion, IsSecure, RemoteHost and Vault combinators with instances for all interpretations (all but the server ones being 'ignore that combinator')
tighter version bounds for network

cleanup

document the new combinators

servant-server: add some tests for HttpVersion, IsSecure, RemoteHost and Vault

update changelogs

address Julian's feedback

remove vault test in servant-server

servant-server tests: -Werror friendly
2015-07-10 14:00:01 +02:00
Andres Loeh
31b12d4bf4 Refactoring: abstracting common parts of method handlers.
This change makes an attempt of abstracting out some of the common
functionality found in the handlers for the different request methods.
There's still a bit of code duplication between the cases for headers
and no headers and empty responses. But it's a significant relative
improvement already.
2015-06-04 13:14:51 +02:00
Andres Loeh
eb86a82105 Refactoring: one module per concept.
The main `Server.Internal` module was getting a bit large for my taste.
It now contains just the instances. All the administrative utilities
are in their own dedicated modules.
2015-06-04 13:14:31 +02:00
Andres Loeh
f9b1e7fc50 Switch server interpretation to a datatype for efficiency.
Instead of directly interpreting a server as a `RoutingApplication`,
this change introduces the concept of a `Router`, which is a datatype
with several constructors.

In particular, the type of the `route` function changes from

    route :: Proxy layout -> Server layout -> RoutingApplication

to

    route :: Proxy layout -> IO (RouteResult (Server layout)) -> Router

Most important in practice is the case of the `StaticRouter` constructor
in `Router`. For choices between statically known paths, we can now use
a lookup table to dispatch requests rather than trying each request
individually.

This brings down routing complexity of a common case from
O(n) to O(log n).

Another important change is that the handler that is passed down by
`route` is no longer of type `Server layout`, but of type
`IO (RouteResult (Server layout))`. This means that API constructs
can "delay" checks and failure. For example, `ReqBody` does not have
to fetch the request body and feed it to the handler immediately; it
can instead record these actions in the handler that is passed down.
The code will only be executed at a leaf / endpoint of the API.

This is desired behaviour: We prefer to save work by doing all matching
on static path components first. Furthermore, we get better error codes
by doing so.
2015-06-04 13:07:53 +02:00
Julian K. Arni
5de9daf528 Fix outdated docs 2015-05-29 10:59:24 +02:00
Ilya Smelkov
7e14eeafe9 Use filepath to add trailing path separator 2015-05-16 01:03:48 +03:00
Julian K. Arni
c41267811e CPP for support for all 3.X versions of wai-app-static 2015-05-16 01:01:55 +03:00
Brandon Martin
10a6020ca2 modify delete to allow for response body 2015-05-06 13:21:35 -06:00
Julian K. Arni
92d65aaf49 -Wall fixes 2015-05-03 13:36:51 +02:00