Robert Vollmert and Steve Chavez
3da5a2875e
Update to protolude 0.3.0
...
The good part is that protolude 0.3.0 builds with GHC 8.10.
The bad part is that this change is a bit painful:
- the default `toS` has changed to no longer convert to and from ByteString
- similarly, `show` no longer outputs ByteString
The changes here are pretty much minimal to keep things compiling; I didn't
see a nice way to work with the new ConvertText class, even though `toUtf8`
seems like it might help if used besides `toS` at just the right spots.
2020-04-23 14:14:21 -05:00
691bb5640d
Allow multiple schemas to be exposed in one instance ( #1450 )
...
The schema to use can be selected through the headers `Accept-Profile` for GET/HEAD and `Content-Profile` for POST/PATCH/PUT/DELETE.
This is based on the https://www.w3.org/TR/dx-prof-conneg/ttps://www.w3.org/TR/dx-prof-conneg/ spec.
Also increase all memory tests by 1M(otherwise CI fails).
Co-authored-by: Mahmoud Kassem <MKassem@gk-software.com >
Co-authored-by: Mahmoud Kassem <mahmoud_k@mail.com >
2020-03-30 14:04:20 -05:00
steve-chavez
7dade7f466
Add request method and path GUCs
2020-01-21 12:28:05 -05:00
steve-chavez
200540dfc3
refactor: put callProc core query to QueryBuilder
...
* Move set local queries to QueryBuilder
* Move unquoted to Middleware
2019-09-11 12:01:41 -05:00
Xavier Francisco and Steve Chávez
28b3d6cafd
Update stylish haskell config; apply all; add CI config ( #1299 )
...
* Update config default; Copy non-defaults
* Update .stylish-haskell config version to match pgrst
* Apply stylish haskell to all files
* CircleCI config
* Remove redundant import.
What is used from Network.HTTP.Types.Headers is also exported by Network.HTTP.Types.
* Grouped imports
* Show un-styled files on CircleCI failure
* Fix styling imports
* Apply adhoc standard correctly
2019-05-23 10:44:34 -05:00
Xavier Francisco and Steve Chávez
1cf54e6575
Small refactor around error responses and more tests ( #1282 )
...
* Fix #880 , Clean and consolidate error responses
* Fix #1285 , Abort on fatal errors
* Add / Detail tests
2019-05-22 09:30:33 -05:00
steve-chavez
1037313e77
Add comments to modules
2019-02-04 10:22:02 -05:00
Steve Chávez and GitHub
501edc718d
Add db-extra-search-path config ( #1218 )
...
For adding schemas to the search_path, solves issues related to extensions created in the public schema.
2018-12-08 11:39:31 -05:00
steve-chavez
dadfe965b9
Do hlint 2.1 hints
2018-11-06 11:54:10 -05:00
steve-chavez
63ead89470
Fix #1181 , correct qualify of function argument type
2018-11-06 11:54:10 -05:00
Steve Chávez and GitHub
30b5859b28
Fix #1141 , app.settings resetting on pool timeout ( #1169 )
...
* Add test for ensuring app.settings don't reset
2018-08-20 11:02:03 -05:00
steve-chavez
f033c2c4b5
Add role-claim-key config value
2018-04-30 11:31:06 -05:00
steve-chavez
85d9feeeab
Add set schema to middleware
...
Fix #828 , breaking change: computed columns now only work if they are on
the config schema.
Fix #835 , tests now not depend on the search_path of the
postgrest_test_authenticator.
2018-01-10 09:50:20 -05:00
Joe Nelson and GitHub
0ed4215a0d
Support asymmetric JWK ( #919 )
2017-08-09 08:42:00 -05:00
Ruslan Talpa and Joe Nelson
5fffbbe381
Make HTTP headers available as GUCs #800 ( #849 )
2017-04-10 19:23:48 -05:00
Diogo Biazus and Joe Nelson
206ab163b6
Refactor error type and fix nested error message [ fix #791 ] ( #829 )
2017-03-12 22:02:13 -07:00
Diogo Biazus and Joe Nelson
41c1cf6e01
Reduce app function ( #733 )
...
Simplify the big app function
2016-11-10 20:42:00 -08:00
Joe Nelson
5a166e8e80
Fix custom pre-request handler
...
Uses Ruslan's technique
2016-09-27 23:17:08 -07:00
Joe Nelson
06363ccc77
WIP: add argument for custom pre-request handler
2016-09-27 00:19:05 -07:00
Joe Nelson
2f8ac24128
Do not share JWT secret with SQL
2016-09-24 23:40:54 -07:00
Joe Nelson
71bc666a8e
Forgot jwt fixture, also hlint fix
2016-09-24 21:32:47 -07:00
Joe Nelson
12a8c682bd
Use sql to generate jwt, rather than custom haskell
2016-09-24 21:32:47 -07:00
Joe Nelson
62ed9e2c4d
Do not require jwt secret, but die on auth without it
2016-09-24 21:28:08 -07:00
Joe Nelson
7bf5b0106d
Semantic WWW-Authenticate headers for problematic JWT
...
Adapting an OAuth 2.0 convention from RFC 6750 for use with JWT
2016-09-24 21:28:08 -07:00
Joe Nelson
fb5fce026d
Issue http 401 for expired jwt
...
Fixes #512
2016-09-24 21:28:08 -07:00
Diogo Biazus and Joe Nelson
6f737056a2
Protolude completion in library and executable ( #697 )
2016-08-21 15:10:19 -07:00
Joe Nelson and GitHub
1d5a0e4316
Per-route content negotiation, and OpenAPI only for root ( #693 )
...
* WIP: remove non-openapi root spec
* Refactor ContentType
Different endpoints will favor one type over another
* Permit different Accept headers per endpoint
* Lint
* Add charset to Content-Type only when used as a header
Keep it out of error messages
* Accept: */* is last resort, not first
* Changelog
* makeMimeList consistently
* Remove schema description from OPTIONS response
2016-08-19 16:07:22 -07:00
Diogo Biazus and Joe Nelson
df6cbc4afa
Protolude second movement ( #677 )
...
* Replace Prelude import for Protolude in middleware
* Remove qualifier from Text type
* Replace Prelude for Protolude, replace 'cs' for 'toS' calls, also change some name bindings
* Replace Prelude in main for Protolude. Replace error calls for panic calls. Also replace cs for toS
* Replace Prelude for Protolude
* Replace Prelude for Protolude in OpenAPI
2016-07-23 12:20:36 -07:00
Jacky Hu
d3d1fbe7e5
Return HTTP 415 on non root path for openapi req
2016-06-18 10:18:43 +08:00
Diogo Biazus
abd81c998b
jwtClaims should always return Left for invalid JWT
2016-05-21 13:18:45 -04:00
Joe Nelson
18e3c30ad8
Return proper 401/403 when access denied
...
Fixes #584
2016-05-15 00:56:47 -07:00
Joe Nelson
5aadfba84b
Use read-only transaction mode for read requests ( #561 )
...
* Make middleware use ApiRequest rather than Request
* Fix outdated comments
* Use read-only transaction mode for read requests
This allows API requests against read replicas
2016-04-15 12:26:40 -07:00
Joe Nelson
eae5857d0e
Set role only once, and set it before other GUC vars ( #560 )
...
* Set role only once, and set it before other GUC vars
Fixes #559
* Unify role/claim logic in claimsToSQL
Suggested by @diogob
2016-04-15 07:30:36 -07:00
Joe Nelson
358254639a
Merge @ruslantalpa's fk improved detection
2016-03-12 12:42:57 -08:00
Joe Nelson
a779e9eb8b
Batch the sql commands to set local vars
2016-03-11 23:45:05 -08:00
Joe Nelson
f67e195f76
Expose all claims via sql postgrest.claims
2016-03-11 20:51:22 -08:00
Ruslan Talpa
40eec0b2ff
code beautify using stylish-haskell
2016-02-29 14:53:41 +02:00
Joe Nelson
d5c1438c6e
Use hasql-transaction
...
Also use hspec before-wrapper
2016-02-21 18:05:25 -08:00
Joe Nelson
6122bc4108
Middleware compiles
2016-01-24 18:09:18 -08:00
Joe Nelson
72cd6c37bd
Change some import statements and Session types
2016-01-24 18:09:18 -08:00
calebmer
b651a45734
Fix time fetch on initialization
2015-11-28 16:49:12 -05:00
Ruslan Talpa
50745ad48b
Type refactoring (ApiRequest/DbRequest)
2015-11-23 10:12:29 +02:00
Ruslan Talpa
f18cfbd7f4
Stricter pattern matching & case branches rearangement + remove a few small functions
2015-11-20 15:36:04 +02:00
Joe Nelson
87c946ef52
Treat JWT as a Secret, not String
2015-11-19 09:58:41 -08:00
calebmer
ad555986d4
Error refactors
2015-11-16 17:28:39 -05:00
Ruslan Talpa
6e9a28ba3c
fix the missing status400 include
2015-11-12 15:19:11 +02:00
Joe Nelson
22c50392e5
Merge pull request #344 from calebmer/feature/jwt-expire
...
Ensure JWT expires
2015-11-11 08:31:20 -08:00
calebmer
62cb8e0453
Cleanup JWT expires
2015-11-11 08:34:50 -05:00
calebmer
c024687629
Remove secure flag entirely
2015-11-08 13:03:50 -05:00
calebmer
34c153086c
Do not redirect insecure requests
2015-11-05 17:42:48 -05:00