Commit graph

475 commits

Author SHA1 Message Date
Andrew Morgan
1c2cb21935 Query whether a room alias exists on app services
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-06-12 16:15:09 +01:00
Andrew Morgan
93b1d1f1f9 Merge branch 'anoa/as_forward_events' into anoa/testing 2018-06-12 16:11:29 +01:00
Andrew Morgan
ea82dccf4b Merge branch 'add_ASsupport_AuthAPI' of https://github.com/APWhiteHat/dendrite into anoa/testing 2018-06-12 15:58:10 +01:00
Andrew Morgan
2bc56b4ff9 Merge branch 'anoa/fix_accounts_table' into anoa/testing 2018-06-12 15:56:46 +01:00
Andrew Morgan
af841cdcc5 Remove tight send loop. Fix events not being deleted 2018-06-12 15:50:57 +01:00
Anant Prakash
911deb88f4
Handle cases when AS is not masquerading 2018-06-12 19:43:05 +05:30
Andrew Morgan
3e93ac86fe Don't backoff on non-200s, tight send loop, 1 event query 2018-06-12 14:57:16 +01:00
Andrew Morgan
d5865fa67d Send same transaction if last send attempt failed 2018-06-11 20:48:20 +01:00
Andrew Morgan
bc2ea24445 Check if there are more events to send before sleeping 2018-06-11 15:51:00 +01:00
Andrew Morgan
7aa45b30ff Delete by int ID instead of string.
This was causing some events to not be deleted, as < an eventID doesn't
really make much sense.
2018-06-11 15:07:52 +01:00
Andrew Morgan
cac8b9d14c Appease the errcheck gods 2018-06-11 13:36:32 +01:00
Andrew Morgan
cd6cbae702 Merge branch 'anoa/as_forward_events' of github.com:matrix-org/dendrite into anoa/as_forward_events 2018-06-11 13:25:23 +01:00
Andrew Morgan
1fac994d61 Reduce cyclomatic complexity 2018-06-11 13:25:03 +01:00
Andrew Morgan
5b713555c0
Merge branch 'master' into anoa/as_forward_events 2018-06-11 04:58:42 -07:00
Andrew Morgan
7c31687c36 Change to event-based AS sending 2018-06-11 12:40:44 +01:00
Andrew Morgan
1f67fd9b89 Fix up database interaction 2018-06-11 12:03:33 +01:00
Andrew Morgan
1bda57e6d4 Finish my own sentences. 2018-06-11 12:03:33 +01:00
Andrew Morgan
a0b9613b86 Store And Send Application Service Events
* Modify INSTALL.md and dendrite-config.yaml for the new appservice database
* Correct all instances of casing on 'application service' to align with
spec
* Store incoming events that an app service is interested in in the
database to be later read by transaction workers.
* Retrieve these events from transaction workers, one per AS.
* Minimal transaction ID data is stored as well to recover after
server failure.
* Send events to AS and exponentially backoff on failure.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-06-11 12:03:33 +01:00
Andrew Morgan
5f576148ac Simplify error checking 2018-06-08 14:38:33 +01:00
Anant Prakash
2a2a4396ec
Use const AppServiceDeviceID 2018-06-07 19:41:51 +05:30
Anant Prakash
ade99807cf
Update code comment 2018-06-07 19:40:02 +05:30
Anant Prakash
731bfa13f0
Update routing of all components 2018-06-07 19:40:02 +05:30
Anant Prakash
20f4c2e58d
Refactor arguments into auth.Data 2018-06-07 19:40:02 +05:30
Anant Prakash
7e1733dee1
Make a dummy device for AS users 2018-06-07 19:40:02 +05:30
Anant Prakash
f906289ae0
Make VerifyAccessToken private, let VerifyUserFromRequest return the
device if present

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
2018-06-07 19:40:02 +05:30
Anant Prakash
f84ad7cd27
Add user parameter support to MakeAuthAPI
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
2018-06-07 19:40:02 +05:30
Anant Prakash
73403fb5ab
Add AS support to MakeAuthAPI
Make clientapi utilize the same

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
2018-06-07 19:39:53 +05:30
Anant Prakash
78440083df
Add AS dummy device ID (#487)
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
2018-06-07 19:30:04 +05:30
Andrew Morgan
12a9538282 Don't forget to set the localpart 2018-06-06 11:07:25 +01:00
Andrew Morgan
d8613bb571 Remove uneccessary logging, null checking 2018-06-05 16:09:00 +01:00
Andrew Morgan
c7430ec403 Prevent sql scanning into nil value in accounts_table
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-06-04 16:00:04 +01:00
Andrew Morgan
241b1b5ace
Update gomatrixserverlib version (#476)
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-06-01 17:42:55 +01:00
Andrew Morgan
63dc2141ba Fix typo that caused ASTokens to not be uniquely checked
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-06-01 16:38:38 +01:00
Anant Prakash
b86b55360a Add app service authentication functions (#433)
* Add support for AS ?user= parameter in auth

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Fix typo
2018-06-01 12:16:19 +01:00
Anant Prakash
1f570d0e92 Auto-generate username if none provided during registration (#470)
* Auto-generate username if none provided during registration

* Remove rogue backtick

* Add appropriate log msg
2018-05-31 15:36:15 +01:00
Anant Prakash
05be8d1c99 Move makeUserID into userutil and prevent code duplication (#475)
* Move makeUserID into userutil and prevent code duplication

* Correct ungraceful merge
2018-05-31 15:21:13 +01:00
Anant Prakash
7ac1efc4b3 Scan AppServiceID from accounts table, fix typo (#474) 2018-05-31 10:46:50 +01:00
Andrew Morgan
04551becb4
Filter Roomserver Events Based on Application Service (#467)
* Compile room and alias namespace regexs

We'll be needing these for event filtering in the appservice component.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>

* App service filters roomserver events

Doing so based on namespace regexes that each app service has defined.

To get the aliases for a roomID a new aliasAPI endpoint was defined,
GetAliasesFromRoomID, which does exactly what it says on the tin.

Next step is to queue events to be sent off to each homeserver.

* Additionally filter state events for app services

* Fixed context, logging, derps, config handling

* Prevented user from creating more than one regex per namespace type

Got caught out by realizing I had an extra '-' in the config file. This
prevents anyone from making the same mistake :)

* Removed exclusive RoomID namespace regex, as we won't need to check
upon room creation if the ID is reserved exclusively by an AS (as this
is silly and horribly inefficient).

* Fixed all else mentioned
2018-05-30 13:43:13 +01:00
Anant Prakash
60e77959ee [roomserver] Store transaction ID and prevent reprocessing of events (#446) 2018-05-26 12:03:35 +01:00
Andrew Morgan
ed388a32b7
Add Application Service component (#462)
* Add Application Service component

The component subscribes to the Roomserver kafka stream, filtering
events to be eventually sent off to relevant app services, as well as
handling incoming HTTP traffic from app services on the
`/matrix/app/r0/*` route.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>

* Make linting happy

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-05-24 13:54:42 +01:00
Andrew Morgan
1d7278d950
Fix typo and bug in /devices/{deviceID} (#465)
* Fix typo in API Endpoint

Signed-off-by: Andrew Morgan <andrewm@matrix.org>

* Fixed another typo and bug

Use a sql.NullInt64 instead of an Int64 as that allows for values to
sometimes be null when pulling from a postgres table. Can result in
error otherwise.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-05-24 13:53:22 +01:00
Andrew Morgan
c238048599
Update Prometheus metrics tracking (#459)
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-05-23 15:42:08 +01:00
Andrew Morgan
93a6178d45 Fix typo in register.go
All in a hard day's work.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-05-22 18:44:07 +01:00
Andrew Morgan
6fed3a1be2 Small cleanup to WIRING.md 2018-05-22 14:13:26 +01:00
Andrew Morgan
f5cc5bd9bb
Revert "Add token generation using go macaroon (#437)" (#448)
This reverts commit afeab7b2d4.

Signed-off-by: Andrew Morgan <andrewm@matrix.org>
2018-05-22 11:29:19 +01:00
Anant Prakash
afeab7b2d4 Add token generation using go macaroon (#437)
* Add Go macaroon library

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Add macaroon generation and serialization, for login token.

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Remove copyright, trim empty lines

* Make Serialize functions private

* Fix typos
2018-05-22 10:13:58 +01:00
Zero King
89e0a9e812 Fix typo (#445)
Signed-off-by: Zero King <l2dy@icloud.com>
2018-05-21 05:34:04 -07:00
Anant Prakash
29532e7bc3 Make clientapi:sendevents idempotent (#444)
* Add transactions.Cache to clientapi setup

* Add idempotency to clientapi/SendEvent
2018-05-18 10:49:40 +01:00
Anant Prakash
8861437c26 Add module for transactions cache (#440)
* Add transactions cache, write tests.

Add a transactions module in dendrite/common. This is needed for idempotent APIs.

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Use cycling double map instead, improve code logic, remove unneeded test

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Update code comments

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>

* Use two constructors for default and custom cleanupPeriod
Add code comments

Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
2018-05-16 11:36:40 +01:00
Zero King
4c807e082f Fix typo (#441)
Signed-off-by: Zero King <l2dy@icloud.com>
2018-05-15 10:14:26 +01:00