Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

event on webfinger request #21817

Closed
wants to merge 3 commits into from
Closed

Conversation

ArtificialOwl
Copy link
Member

@ArtificialOwl ArtificialOwl commented Jul 13, 2020

The idea is to generate an event so that apps can add their own parts to the response on a webfinger request
Now, event is generated when request is made on .well-known/webfinger and .well-known/nodeinfo

@rullzer
Copy link
Member

rullzer commented Jul 15, 2020

@roeland should I keep going this way ?

That is not me ;)

@rullzer
Copy link
Member

rullzer commented Jul 22, 2020

@daita I'm not fully aware of the webfinger spec. But maybe your API is a bit overkill?

As far as I undersand a webfinger request comes in giving a resource and an optional relation. And we spit back out json right?
So we could gather all the json from the different parts. Mash it together and just return it?

I take it this is to make social handling a bit nicer?

@ArtificialOwl
Copy link
Member Author

Yes, exactly.

It would also make multiple apps answering to the same request. Of course, not about the same protocol

@ArtificialOwl
Copy link
Member Author

ok, I got your point now :)
I will see how to make it simpler

@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch 3 times, most recently from 5efc448 to c2aedfb Compare July 28, 2020 23:07
@ArtificialOwl
Copy link
Member Author

So, fresh new commit, a lot simpler. Only one Model Webfinger that contains mainly 4 variables: subject, aliases, properties and links.

  • subject is filed by the WebfingerManager (core), at creation of the Model.
  • aliases and properties are filled by apps.
  • links is filled by apps and contains the result of the request.

no more method to fill some missing data as it should be useless now. Apps just feed links with an array or a JsonSerializable class.

@rullzer

@MorrisJobke
Copy link
Member

@daita Mind to fix the PHP CS warnings?

@MorrisJobke
Copy link
Member

There are still some code style warning. See https://github.com/nextcloud/server/pull/21817/checks?check_run_id=923955210 for the diff or just run composer run cs:fix (you need to run composer install first, but please don't add those php code style files to the commit).

@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch from 1685e28 to 82286e8 Compare July 30, 2020 13:08
@ArtificialOwl
Copy link
Member Author

There are still some code style warning. See https://github.com/nextcloud/server/pull/21817/checks?check_run_id=923955210 for the diff or just run composer run cs:fix (you need to run composer install first, but please don't add those php code style files to the commit).

yes, saw that yesterday night, but went to sleep before fixing it. should be better now.

@MorrisJobke MorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch 5 times, most recently from 99e9b7f to eb204b5 Compare September 24, 2020 12:25
@ArtificialOwl ArtificialOwl added the 3. to review Waiting for reviews label Sep 24, 2020
@ChristophWurst
Copy link
Member

It's a private event. What's the purpose of this?

@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch from eb204b5 to ae63384 Compare December 7, 2020 23:21
@ArtificialOwl
Copy link
Member Author

rebased, and moving the event to public.

@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch from c8f60b5 to f47b83b Compare December 8, 2020 12:37
* @package OCP\WellKnown\Events
* @since 21.0.0
*/
class WellKnownEvent extends Event {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WellKnownRequestEvent still doesn't match the naming scheme. Your event doesn't have a verb. Well-known request ??? received?

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl ArtificialOwl force-pushed the feature/noid/webfingermanager branch from c57678b to 382d2f9 Compare December 9, 2020 11:30
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
@ArtificialOwl
Copy link
Member Author

@ChristophWurst event renamed to WellKnownRequestEvent

@faily-bot
Copy link

faily-bot bot commented Dec 9, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 345: failure

integration-federation_features

  • build/integration/federation_features/federated.feature:217
Show full log
[Wed Dec  9 17:03:24 2020] 127.0.0.1:38656 [200]: /ocs/v1.php/apps/testing/api/v1/app/files_sharing/incoming_server2server_group_share_enabled
[Wed Dec  9 17:03:24 2020] 127.0.0.1:38662 [200]: /ocs/v1.php/apps/testing/api/v1/app/files_sharing/outgoing_server2server_group_share_enabled
  Scenario: Overwrite a federated shared file as recipient                                              # /drone/src/build/integration/federation_features/federated.feature:217
    Given Using server "REMOTE"                                                                         # FederationContext::usingServer()
[Wed Dec  9 17:03:24 2020] 127.0.0.1:43104 [404]: /ocs/v2.php/cloud/users/user1
[Wed Dec  9 17:03:25 2020] 127.0.0.1:43114 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:03:26 2020] 127.0.0.1:43132 [200]: /ocs/v1.php/cloud/users/user1
[Wed Dec  9 17:03:27 2020] 127.0.0.1:43182 [200]: /ocs/v2.php/cloud/users/user1
    And user "user1" exists                                                                             # FederationContext::assureUserExists()
[Wed Dec  9 17:03:27 2020] 127.0.0.1:43192 [404]: /ocs/v2.php/cloud/users/user2
[Wed Dec  9 17:03:28 2020] 127.0.0.1:43200 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:03:29 2020] 127.0.0.1:43222 [200]: /ocs/v1.php/cloud/users/user2
[Wed Dec  9 17:03:29 2020] 127.0.0.1:43252 [200]: /ocs/v2.php/cloud/users/user2
    And user "user2" exists                                                                             # FederationContext::assureUserExists()
    And Using server "LOCAL"                                                                            # FederationContext::usingServer()
[Wed Dec  9 17:03:30 2020] 127.0.0.1:38836 [404]: /ocs/v2.php/cloud/users/user0
[Wed Dec  9 17:03:31 2020] 127.0.0.1:38844 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:03:32 2020] 127.0.0.1:38878 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:03:32 2020] 127.0.0.1:38918 [200]: /ocs/v2.php/cloud/users/user0
    And user "user0" exists                                                                             # FederationContext::assureUserExists()
[Wed Dec  9 17:03:32 2020] 127.0.0.1:43370 [200]: /ocm-provider/
[Wed Dec  9 17:03:32 2020] 127.0.0.1:43372 [201]: /index.php/ocm/shares
[Wed Dec  9 17:03:32 2020] 127.0.0.1:38928 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares
    And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE" # FederationContext::federateSharing()
[Wed Dec  9 17:03:33 2020] 127.0.0.1:43376 [200]: /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending
[Wed Dec  9 17:03:33 2020] 127.0.0.1:38962 [200]: //ocm-provider/
[Wed Dec  9 17:03:33 2020] 127.0.0.1:38964 [201]: /index.php/ocm/notifications
[Wed Dec  9 17:03:33 2020] 127.0.0.1:38966 [200]: //ocs-provider/
[Wed Dec  9 17:03:33 2020] 127.0.0.1:38968 [200]: /ocs/v2.php/cloud/shares/10/accept?format=json
[Wed Dec  9 17:03:33 2020] 127.0.0.1:43384 [200]: /ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/10
    And User "user1" from server "REMOTE" accepts last pending share                                    # FederationContext::acceptLastPendingShare()
    And Using server "REMOTE"                                                                           # FederationContext::usingServer()
    And As an "user1"                                                                                   # FederationContext::asAn()
    And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"                            # FederationContext::modifyTextOfFile()
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39008 [200]: /ocs-provider/
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39010 [200]: /status.php
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39012 [200]: /status.php
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39016 [200]: /index.php/apps/files_sharing/shareinfo?t=8wZy0Cs5jTffzFq
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39020 [401]: /public.php/webdav/
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39024 [207]: /public.php/webdav/
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39026 [207]: /public.php/webdav/
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39028 [200]: /public.php/webdav/
[Wed Dec  9 17:03:34 2020] {"Exception":"LogicException","Message":"\"put\" can only be accessed once if not application\/x-www-form-urlencoded or application\/json.","Code":0,"Trace":[{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":283,"function":"getContent","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":352,"function":"__get","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["parameters"]},{"file":"\/drone\/src\/lib\/private\/WellKnown\/WellKnownManager.php","line":84,"function":"getParam","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["service",""]},{"file":"\/drone\/src\/public.php","line":72,"function":"manageRequest","class":"OC\\WellKnown\\WellKnownManager","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"}]}],"File":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","Line":421,"CustomMessage":"--"}
[Wed Dec  9 17:03:34 2020] 127.0.0.1:39034 [500]: /public.php/webdav/
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 127.0.0.1:43420 [500]: /remote.php/webdav/textfile0%20(2).txt
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
[Wed Dec  9 17:03:34 2020] 
    When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt"       # FederationContext::userUploadsAFileTo()
[Wed Dec  9 17:03:35 2020] 127.0.0.1:39046 [200]: /ocs-provider/
[Wed Dec  9 17:03:35 2020] 127.0.0.1:39050 [401]: /public.php/webdav/
[Wed Dec  9 17:03:35 2020] 127.0.0.1:39052 [207]: /public.php/webdav/
[Wed Dec  9 17:03:35 2020] 127.0.0.1:39054 [200]: /public.php/webdav/
[Wed Dec  9 17:03:35 2020] 
[Wed Dec  9 17:03:35 2020] 127.0.0.1:43476 [206]: /remote.php/webdav/textfile0%20(2).txt
    And Downloading file "/textfile0 (2).txt" with range "bytes=0-8"                                    # FederationContext::downloadFileWithRange()
    Then Downloaded content should be "BLABLABLA"                                                       # FederationContext::downloadedContentShouldBe()
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
      -'BLABLABLA'
      +'Nextcloud'
[Wed Dec  9 17:03:38 2020] 127.0.0.1:39056 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:03:38 2020] 127.0.0.1:39090 [404]: /ocs/v2.php/cloud/users/user0
[Wed Dec  9 17:03:39 2020] 127.0.0.1:39122 [200]: //ocm-provider/
[Wed Dec  9 17:03:39 2020] 127.0.0.1:39124 [400]: /index.php/ocm/notifications
[Wed Dec  9 17:03:39 2020] error while sending notification for federated share: Client error: `POST http://localhost:8080/index.php/ocm/notifications` resulted in a `400 Bad request` response:
{"message":"Can not find share with ID: 10"}

integration-filesdrop-features

  • build/integration/filesdrop_features/filesdrop.feature:3
  • build/integration/filesdrop_features/filesdrop.feature:17
  • build/integration/filesdrop_features/filesdrop.feature:34
Show full log
  Scenario: Put file via files drop           # /drone/src/build/integration/filesdrop_features/filesdrop.feature:3
[Wed Dec  9 17:05:11 2020] 127.0.0.1:41238 [404]: /ocs/v2.php/cloud/users/user0
[Wed Dec  9 17:05:11 2020] 127.0.0.1:41246 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:05:12 2020] 127.0.0.1:41258 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:12 2020] 127.0.0.1:41264 [200]: /ocs/v2.php/cloud/users/user0
    Given user "user0" exists                 # FilesDropContext::assureUserExists()
    And As an "user0"                         # FilesDropContext::asAn()
[Wed Dec  9 17:05:12 2020] 127.0.0.1:41270 [201]: /remote.php/webdav/drop
    And user "user0" created a folder "/drop" # FilesDropContext::userCreatedAFolder()
[Wed Dec  9 17:05:13 2020] 127.0.0.1:41276 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares
    And as "user0" creating a share with      # FilesDropContext::asCreatingAShareWith()
      | path         | drop |
      | shareType    | 3    |
      | publicUpload | true |
[Wed Dec  9 17:05:13 2020] 127.0.0.1:41284 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares/1
    And Updating last share with              # FilesDropContext::updatingLastShare()
      | permissions | 4 |
[Wed Dec  9 17:05:13 2020] {"Exception":"LogicException","Message":"\"put\" can only be accessed once if not application\/x-www-form-urlencoded or application\/json.","Code":0,"Trace":[{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":283,"function":"getContent","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":352,"function":"__get","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["parameters"]},{"file":"\/drone\/src\/lib\/private\/WellKnown\/WellKnownManager.php","line":84,"function":"getParam","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["service",""]},{"file":"\/drone\/src\/public.php","line":72,"function":"manageRequest","class":"OC\\WellKnown\\WellKnownManager","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"}]}],"File":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","Line":421,"CustomMessage":"--"}
[Wed Dec  9 17:05:13 2020] 127.0.0.1:41292 [500]: //public.php/webdav/a.txt
    When Dropping file "/a.txt" with "abc"    # FilesDropContext::droppingFileWith()
      Server error: `PUT http://localhost:8080//public.php/webdav/a.txt` resulted in a `500 Internal Server Error` response:
      <!DOCTYPE html>
      <html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" >
      	<head
       data-requesttok (truncated...)
       (GuzzleHttp\Exception\ServerException)
    And Downloading file "/drop/a.txt"        # FilesDropContext::downloadingFile()
    Then Downloaded content should be "abc"   # FilesDropContext::downloadedContentShouldBe()
[Wed Dec  9 17:05:13 2020] 127.0.0.1:41294 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:14 2020] 127.0.0.1:41302 [404]: /ocs/v2.php/cloud/users/user0

  Scenario: Put file same file multiple times via files drop # /drone/src/build/integration/filesdrop_features/filesdrop.feature:17
[Wed Dec  9 17:05:14 2020] 127.0.0.1:41308 [404]: /ocs/v2.php/cloud/users/user0
[Wed Dec  9 17:05:14 2020] 127.0.0.1:41312 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:05:15 2020] 127.0.0.1:41326 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:15 2020] 127.0.0.1:41332 [200]: /ocs/v2.php/cloud/users/user0
    Given user "user0" exists                                # FilesDropContext::assureUserExists()
    And As an "user0"                                        # FilesDropContext::asAn()
[Wed Dec  9 17:05:15 2020] 127.0.0.1:41338 [201]: /remote.php/webdav/drop
    And user "user0" created a folder "/drop"                # FilesDropContext::userCreatedAFolder()
[Wed Dec  9 17:05:15 2020] 127.0.0.1:41344 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares
    And as "user0" creating a share with                     # FilesDropContext::asCreatingAShareWith()
      | path         | drop |
      | shareType    | 3    |
      | publicUpload | true |
[Wed Dec  9 17:05:16 2020] 127.0.0.1:41350 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares/2
    And Updating last share with                             # FilesDropContext::updatingLastShare()
      | permissions | 4 |
[Wed Dec  9 17:05:16 2020] {"Exception":"LogicException","Message":"\"put\" can only be accessed once if not application\/x-www-form-urlencoded or application\/json.","Code":0,"Trace":[{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":283,"function":"getContent","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":352,"function":"__get","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["parameters"]},{"file":"\/drone\/src\/lib\/private\/WellKnown\/WellKnownManager.php","line":84,"function":"getParam","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["service",""]},{"file":"\/drone\/src\/public.php","line":72,"function":"manageRequest","class":"OC\\WellKnown\\WellKnownManager","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"}]}],"File":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","Line":421,"CustomMessage":"--"}
[Wed Dec  9 17:05:16 2020] 127.0.0.1:41356 [500]: //public.php/webdav/a.txt
    When Dropping file "/a.txt" with "abc"                   # FilesDropContext::droppingFileWith()
      Server error: `PUT http://localhost:8080//public.php/webdav/a.txt` resulted in a `500 Internal Server Error` response:
      <!DOCTYPE html>
      <html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" >
      	<head
       data-requesttok (truncated...)
       (GuzzleHttp\Exception\ServerException)
    And Dropping file "/a.txt" with "def"                    # FilesDropContext::droppingFileWith()
    And Downloading file "/drop/a.txt"                       # FilesDropContext::downloadingFile()
    Then Downloaded content should be "abc"                  # FilesDropContext::downloadedContentShouldBe()
    And Downloading file "/drop/a (2).txt"                   # FilesDropContext::downloadingFile()
    Then Downloaded content should be "def"                  # FilesDropContext::downloadedContentShouldBe()
[Wed Dec  9 17:05:16 2020] 127.0.0.1:41360 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:16 2020] 127.0.0.1:41380 [404]: /ocs/v2.php/cloud/users/user0

  Scenario: Files drop ignores directory          # /drone/src/build/integration/filesdrop_features/filesdrop.feature:34
[Wed Dec  9 17:05:17 2020] 127.0.0.1:41388 [404]: /ocs/v2.php/cloud/users/user0
[Wed Dec  9 17:05:17 2020] 127.0.0.1:41392 [200]: /ocs/v1.php/cloud/users
[Wed Dec  9 17:05:17 2020] 127.0.0.1:41400 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:18 2020] 127.0.0.1:41406 [200]: /ocs/v2.php/cloud/users/user0
    Given user "user0" exists                     # FilesDropContext::assureUserExists()
    And As an "user0"                             # FilesDropContext::asAn()
[Wed Dec  9 17:05:18 2020] 127.0.0.1:41412 [201]: /remote.php/webdav/drop
    And user "user0" created a folder "/drop"     # FilesDropContext::userCreatedAFolder()
[Wed Dec  9 17:05:18 2020] 127.0.0.1:41416 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares
    And as "user0" creating a share with          # FilesDropContext::asCreatingAShareWith()
      | path         | drop |
      | shareType    | 3    |
      | publicUpload | true |
[Wed Dec  9 17:05:18 2020] 127.0.0.1:41422 [200]: /ocs/v1.php/apps/files_sharing/api/v1/shares/3
    And Updating last share with                  # FilesDropContext::updatingLastShare()
      | permissions | 4 |
[Wed Dec  9 17:05:18 2020] {"Exception":"LogicException","Message":"\"put\" can only be accessed once if not application\/x-www-form-urlencoded or application\/json.","Code":0,"Trace":[{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":283,"function":"getContent","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","line":352,"function":"__get","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["parameters"]},{"file":"\/drone\/src\/lib\/private\/WellKnown\/WellKnownManager.php","line":84,"function":"getParam","class":"OC\\AppFramework\\Http\\Request","type":"->","args":["service",""]},{"file":"\/drone\/src\/public.php","line":72,"function":"manageRequest","class":"OC\\WellKnown\\WellKnownManager","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"}]}],"File":"\/drone\/src\/lib\/private\/AppFramework\/Http\/Request.php","Line":421,"CustomMessage":"--"}
    When Dropping file "/folder/a.txt" with "abc" # FilesDropContext::droppingFileWith()
      Server error: `PUT http://localhost:8080//public.php/webdav/folder/a.txt` resulted in a `500 Internal Server Error` response:
      <!DOCTYPE html>
      <html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" >
      	<head
       data-requesttok (truncated...)
       (GuzzleHttp\Exception\ServerException)
[Wed Dec  9 17:05:18 2020] 127.0.0.1:41432 [500]: //public.php/webdav/folder/a.txt
    And Downloading file "/drop/a.txt"            # FilesDropContext::downloadingFile()
    Then Downloaded content should be "abc"       # FilesDropContext::downloadedContentShouldBe()
[Wed Dec  9 17:05:19 2020] 127.0.0.1:41436 [200]: /ocs/v1.php/cloud/users/user0
[Wed Dec  9 17:05:19 2020] 127.0.0.1:41446 [404]: /ocs/v2.php/cloud/users/user0

@rullzer rullzer mentioned this pull request Dec 14, 2020
59 tasks
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking aloud a bit.

Maybe this isn't the ideal API design. You're using an event to trigger an action. This is imperative thinking. Like apps do your thing and update the object that I'm giving you.

But what you essentially want to do is offer the apps a way to hook into the process of a well known request and add their custom things to the response.

How about we move this from events to registered handlers so that apps can register their webfinger request handlers in the bootstrap registration context. Those handlers are of a simple interface type that passes in the request and gets back the data we allow apps to specify.

Then, when a wellknown request is received, we ask the registration context for all of those handlers, iterate over them and ask them for their data, which we then combine and send back.

Does that make sense?

In general terms I'm really not a fan of using events where the emitting code expects some kind of mutation, either on the event or any other (global) state. Events should be more passive. Like just hey, this happened. do whatever you want with this information but don't expect any other code to even listen to this nor make any modifications.

@ChristophWurst ChristophWurst deleted the feature/noid/webfingermanager branch December 14, 2020 10:53
@ChristophWurst
Copy link
Member

Note to myself

  • well known is defined in an RFC: https://tools.ietf.org/html/rfc5785
  • webfinger is defined here: https://tools.ietf.org/html/rfc7033
  • webfinger and nodeinfo are two aspects "we" are currently most interested in, but their formats aren't what any well known handler would return
  • it's necessary that the request has to be processed by more than one app/handler -> we can't simply stop at the first handler that can process the request, other results have to be combined/merged
  • we have some routes in place that redirect webfinger and nodeinfo requests to public.php, this is technical dept from 2018 said to be used for 15 only but we still have this today: adding .well-known/webfinger #11396 (comment)
  • we can't "just" register a route for .well-known/{service}, have a decent controller and testable code. We still need to go through public.php at least for webfinger and nodeinfo due to the technical dept

@ChristophWurst ChristophWurst mentioned this pull request Dec 14, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants