Commit Graph

180 Commits

Author SHA1 Message Date
62cedf64da
api/router/registry: extract path based parameters from url to req (#1530)
* api/router/registry: extract path based parameters from url to req
* api/handler/rpc: fix empty body request parsing
* bundle grpc-gateway util funcs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 17:50:51 +03:00
b700d425a4
api/handler/rpc: improvements and fixes (#1535)
* api/handler/rpc: fix empty body case
* api/handler/rpc: copy all request headers to metadata

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 01:37:15 +03:00
268651df18
regenerate all proto based files (#1531)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-14 16:25:09 +03:00
Asim Aslam
e515005083 Remove only allowing certain methods 2020-04-13 23:05:39 +01:00
Asim Aslam
a056bdce7c fix metadata parsing 2020-04-12 14:40:37 +01:00
Asim Aslam
b08c636b44 fixup handler tests 2020-04-12 14:29:38 +01:00
Asim Aslam
d03a02f2e4 fix import 2020-04-12 11:25:12 +01:00
Asim Aslam
962588b649 Strip MetadataKey global var 2020-04-12 11:16:08 +01:00
0a2363b49b
api minor improvements (#1526)
* api/handler/rpc: unblock all http methods and set Host meta
* api/router/static: add debug log

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-11 22:21:55 +03:00
Asim Aslam
0f2006ac50 fix compilation issues 2020-04-11 11:02:06 +01:00
Asim Aslam
d4b2c948dd Remove cloudflare store 2020-04-10 19:50:57 +01:00
Asim Aslam
e5268dd0a6
move reg util to own package (#1523)
* move reg util to own package

* fix test

* fix broken static router
2020-04-10 17:41:10 +01:00
Ben Toogood
f9cfbe96c0 Merge master into resover-refactor 2020-04-09 12:42:34 +01:00
1063b954de
dont display t.Log/t.Logf as errors in github actions (#1508)
* fix tests and github action annotations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-09 14:05:46 +03:00
Ben Toogood
4ff959ef50 Dynamic Namespace 2020-04-09 11:03:33 +01:00
Ben Toogood
27eb7db1c2 Add default resolver to api router 2020-04-09 10:34:21 +01:00
Ben Toogood
3ede494945 Change import name 2020-04-09 10:32:08 +01:00
Ben Toogood
f102aba4c1 Fix HTTP tests 2020-04-09 10:28:38 +01:00
Asim Aslam
bf8ebf8ad2 add namespace 2020-04-08 23:27:32 +01:00
Asim Aslam
48dd30c4c2 fix http test 2020-04-08 19:20:43 +01:00
Ben Toogood
8ff86ae08b Extract micro resolver 2020-04-08 16:21:53 +01:00
Asim Aslam
b2079669f7 Strip namespace from router 2020-04-08 15:39:01 +01:00
Asim Aslam
2c1d1afd71 Strip namespace from registry router 2020-04-08 15:38:02 +01:00
Asim Aslam
9a73828782 Remove unused handlers 2020-04-08 15:34:11 +01:00
ben-toogood
6b524e2c55
Merge branch 'master' into namespace 2020-04-08 09:12:28 +01:00
Ben Toogood
e907d24e3b API Wrappers 2020-04-07 19:29:26 +01:00
Ben Toogood
67cd59d7bc Rename namespace from Resolver.Endpoint 2020-04-07 16:27:59 +01:00
Ben Toogood
4362a885eb Refactor Namespace Resolver 2020-04-07 16:24:51 +01:00
6aaad7d63f
api/router/static: allow to specify body dst (#1486)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-07 15:38:27 +01:00
Ben Toogood
9d598836c3 Fix Tests 2020-04-07 11:37:04 +01:00
Ben Toogood
05ac3ff274 Tweak 2020-04-07 11:24:13 +01:00
Ben Toogood
76f6f80318 Default to Hostname 2020-04-07 11:23:21 +01:00
Ben Toogood
cb96949551 Merge branch 'master' of https://github.com/micro/go-micro into namespace 2020-04-07 10:58:54 +01:00
Ben Toogood
f0980e9b30 Change cross namespace request err level 2020-04-07 10:54:27 +01:00
Ben Toogood
977934f8fd ServiceNamespace => ServicePrefix in api server 2020-04-07 10:39:27 +01:00
Ben Toogood
9e116731b1 ServiceNamespace => ServicePrefix in api server 2020-04-07 10:38:27 +01:00
Ben Toogood
316424f0f7 Fix comments typo 2020-04-07 10:35:57 +01:00
Ben Toogood
bd23dc1f18 Improve micro.mu check 2020-04-07 10:34:26 +01:00
Ben Toogood
501fc5c059 Refactor to use publicsuffix 2020-04-07 10:28:39 +01:00
Ben Toogood
11e1e9120a Remove debugging 2020-04-07 10:10:37 +01:00
Ben Toogood
a81d86ed08 Merge Asim's Fixes 2020-04-07 10:08:06 +01:00
Ben Toogood
7206d5f964 Add Namespace to CombinedAuthHandler 2020-04-07 09:40:40 +01:00
Asim Aslam
e8a86585da contains missing host port 2020-04-07 00:54:27 +01:00
Asim Aslam
5374896ed0 clone request 2020-04-07 00:29:35 +01:00
Asim Aslam
b6348ba59a Fix cruft 2020-04-07 00:25:11 +01:00
Asim Aslam
ca11c4a672 Few nitpicks 2020-04-07 00:19:49 +01:00
Ben Toogood
574bf5ac69 Set value in context, not metadata 2020-04-06 16:10:08 +01:00
Ben Toogood
774c0d30a7 Encode Endpoint in API auth wrapper 2020-04-06 16:01:42 +01:00
ben-toogood
7f07e1a642
Merge branch 'master' into auth-resolver 2020-04-06 14:43:22 +01:00
bc7579f1d8
api/handler/rpc: fix panic on invalid error conversation (#1483)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-04 00:55:15 +03:00
38aed6f0f6
api/handler/rpc: not log error on client disconnect (#1482)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-04 00:37:18 +03:00
Ben Toogood
a82ce4d1ae Add Debug 2020-04-03 15:03:18 +01:00
Ben Toogood
4a850ff8a0 Auth host fix 2020-04-03 14:40:24 +01:00
ben-toogood
350dd41732
Merge branch 'master' into auth-resolver 2020-04-03 14:19:03 +01:00
Ben Toogood
b864b3e350 Fix auth hosts bug 2020-04-03 14:09:25 +01:00
Ben Toogood
906263291b Hotfix 2020-04-03 13:37:02 +01:00
Ben Toogood
d0e47206cc Fix 2020-04-03 13:29:48 +01:00
Ben Toogood
1096c8fb39 Fix failing test 2020-04-03 10:16:19 +01:00
Ben Toogood
91b9c3f92e Add defaults 2020-04-03 10:08:39 +01:00
Ben Toogood
183c8bfb81 Apply fix for apis 2020-04-03 09:45:39 +01:00
Ben Toogood
760233b858 Reverse Change 2020-04-03 09:34:52 +01:00
Ben Toogood
fdcb013f24 Fix web registry compatability bugs 2020-04-03 09:18:30 +01:00
Ben Toogood
cfde3ec3d9 Remove resolver logic 2020-04-02 18:03:57 +01:00
Ben Toogood
4a4c666528 Remove resolver logic 2020-04-02 18:03:21 +01:00
Ben Toogood
8b35c264eb Pass resolver to api auth handler 2020-04-02 17:44:48 +01:00
Ben Toogood
4999f6dfd4 Namespace requests coming via api & web 2020-04-02 17:01:06 +01:00
0241197c6a
api/handler/rpc: binary streaming support (#1466)
* api/handler/rpc: binary streaming support

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fixup

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix sec webscoekt protol

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-02 10:13:04 +01:00
Asim Aslam
20c95d94cd
api completeness (#1460) 2020-04-01 12:07:50 +01:00
7b7a859a03
api: use http request Clone (#1458)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 01:50:37 +03:00
8a8742f867
api/handler/rpc: dont change types of url fields (#1457)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 01:26:58 +03:00
1490aff38e
api/handler/rpc: correctly parse nested url vars (#1455)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-01 00:23:17 +03:00
18061723bb
fix api metadata extract from context (#1452)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 22:36:51 +03:00
d6bef84de0
api/handler/rpc: fix metadata cleanup (#1451)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-31 21:59:35 +03:00
9e6db79860
regenerate all proto (#1440)
* regenerate all proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 21:58:32 +01:00
3d7d5ce6b4
api: add static router and improve path parser in rpc handler (#1437)
* api: add static router and improve path parser in rpc handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* expose metadata context key to be able to get unmodified map keys

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: fix jsonpb codec for protobuf msg

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: write 204 status code when rsp is nil

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: add check for nil response for non javascript

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 09:04:59 +01:00
Asim Aslam
45ee5e9ad1
Move error for api validation to trace level (#1432)
* remove error on endpoint validation

* trace level
2020-03-27 14:01:47 +00:00
b38da6ced0
api/handler/rpc: process all methods and merge url params to json body (#1427)
* api/handler/rpc: process all methods and merge url params to json body

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add merge json test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-27 07:59:31 +00:00
Asim Aslam
62f9a054a4
100mb (#1421) 2020-03-26 16:57:31 +00:00
02839cfba5
api/handler: use http.MaxBytesReader and buffer pool (#1415)
* api/handler: use http.MaxBytesReader

protect api handlers from OOM cases

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-26 14:29:28 +03:00
ben-toogood
1057ef6acb
Add ContextWithToken (#1407)
* Add ContextWithToken

* Tidying up BearerScheme

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 11:20:53 +00:00
8100d26430
api/router/registry: use logger (#1402)
* api/router/registry: use logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/server/acme: use logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-24 20:45:11 +00:00
ben-toogood
e0e77f3983
Updated auth interface (#1384)
* Updated  auth interface

* Add Rule

* Remove Rule

* Return token from Renew

* Renew => Refresh

* Implement Tokens & Default Auth Implementation

* Change default auth to noop

* Change default auth to noop

* Move token.Token to auth.Token

* Remove Token from Account

* Auth service implementation

* Decode JWT locally

* Cookie for secret

* Move string to bottom of interface definition

* Depricate auth_exclude

* Update auth wrappers

* Update go.sum

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-23 16:19:30 +00:00
9826ddbd64
api/handler/rpc: log errors (#1390)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-23 10:31:35 +03:00
ben-toogood
cd04111e3d
Pass redirect_to param on auth (#1361)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 20:04:16 +00:00
ben-toogood
00cd2448a4
Fix bug where auth token is not set from cookie when excluded endpoint (#1360)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 19:24:10 +00:00
ben-toogood
b3c631dd38
Support Wildcard Auth Excludes (#1357)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-17 16:03:49 +00:00
ben-toogood
247707f583
Return store.ErrNotFound if not found when calling over rpc (#1353)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-16 10:30:56 +00:00
Jake Sanders
1b4e881d74
Rewrite the store interface (#1335)
* WIP store rewrite

* Fix memory store tests

* Store hard expiry times rather than duration!

* Clarify memory test

* Add limit to store interface

* Implement suffix option

* Don't return nils from noop store

* Fix syncmap

* Start fixing store service

* wip service and cache

* Use _ for special characters in cockroachdb namespace

* Improve cockroach namespace comment

* Use service name as default store namespace

* Fixes

* Implement Store Scope

* Start fixing etcd

* implement read and write with expiry and prefix

* Fix etcd tests

* Fix cockroach store

* Fix cloudflare interface

* Fix certmagic / cloudflare store

* comment lint

* cache isn't implemented yet

* Only prepare DB staements once

Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: ben-toogood <bentoogood@gmail.com>
2020-03-12 13:41:30 +00:00
7b385bf163
minimize allocations in logger and tunnel code (#1323)
* logs alloc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* tunnel allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* try to fix tunnel

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* cache cipher for send

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-11 17:55:39 +00:00
ben-toogood
48b2a5c37c
Fix Auth Headers (#1324)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-10 16:47:01 +00:00
Asim Aslam
ed83c27f0e
add websocket streaming to api rpc handler (#1326) 2020-03-10 15:21:43 +00:00
ben-toogood
9a7a65f05e
Auth Provider (#1309)
* auth provider mock interface

* Auth Provider Options

* Implement API Server Auth Package

* Add weh utils

* Add Login URL

* Auth Provider Options

* Add auth provider scope and setting token in cookie

* Remove auth_login_url flag

Co-authored-by: Asim Aslam <asim@aslam.me>
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-07 11:06:57 +00:00
ben-toogood
6d803d9e45
Implement api/server/cors (#1294) 2020-03-04 11:40:53 +00:00
Asim Aslam
49ffc60afb
Use Foo.Call on /foo (#1286)
Co-authored-by: Jake Sanders <i@am.so-aweso.me>
2020-03-03 16:47:15 +00:00
117f56ebf7
prune util/log and user logger (#1237)
* prune util/log and user logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* plaintext logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add newline

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-23 13:45:20 +00:00
58598d0fe0
fixes for safe conversation and avoid panics (#1213)
* fixes for safe convertation

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix client publish panic

If broker connect returns error we dont check it status and use
it later to publish message, mostly this is unexpected because
broker connection failed and we cant use it.
Also proposed solution have benefit - we flag connection status
only when we have succeseful broker connection

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/broker: fix possible broker publish panic

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-18 23:05:38 +00:00
Asim Aslam
964b7dee3f
add tls config to server (#1202)
* add tls config

* add TLSConfig to acme provider
2020-02-15 15:10:26 +00:00
Asim Aslam
d1d6eada98
parse url encoded form in rpc handler (#1183)
* parse url encoded form in rpc handler

* Remove comment
2020-02-11 11:27:16 +00:00
f23638c036 fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-30 14:44:40 +03:00
Asim Aslam
1892bd05a5
only add api endpoint metadata if it exists (#1087) 2020-01-06 22:22:36 +00:00