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

Add Reva #35

Merged
merged 26 commits into from
Aug 12, 2021
Merged

Add Reva #35

merged 26 commits into from
Aug 12, 2021

Conversation

michielbdejong
Copy link
Collaborator

No description provided.

@michielbdejong michielbdejong marked this pull request as draft August 5, 2021 14:34
@michielbdejong michielbdejong mentioned this pull request Aug 5, 2021
@michielbdejong
Copy link
Collaborator Author

Hm, http://revad2.docker/ocm-provider/ still prompts for BasicAuth.

@michielbdejong
Copy link
Collaborator Author

michielbdejong commented Aug 5, 2021

Ah, http://revad2.docker:19001/ocm/ocm-provider/ works.

@michielbdejong
Copy link
Collaborator Author

I could add a proxy in front that corrects this, but instead I'll try to get it to work with a branch of reva itself.

@michielbdejong
Copy link
Collaborator Author

I've added work-arounds for cs3org/reva#1962 and cs3org/reva#1752 in michielbdejong/ocm-stub@18a1f96

Now I'm having trouble seeing how I can make the contents of http://stub2.docker/ocm-provider/ change by adding host, provider, and apiVersion entries into https://github.com/cs3org/ocm-test-suite/blob/main/revad/revad.toml#L136 - it doesn't seem to be picking those up somehow.

@michielbdejong
Copy link
Collaborator Author

yes publicLink
creating share ?saveTo=admin%40http%3A%2F%2Frevad2.docker
createShare admin@http://revad2.docker
http://revad2.docker
fetching http://revad2.docker/ocm-provider/
FetchError: invalid json response body at http://revad2.docker/ocm-provider/ reason: Unexpected end of JSON input
    at /app/node_modules/node-fetch/lib/index.js:272:32
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getServerConfig (/app/stub.js:43:20)
    at async createShare (/app/stub.js:57:35)
    at async IncomingMessage.<anonymous> (/app/stub.js:147:35) {
  type: 'invalid-json'
}

@michielbdejong
Copy link
Collaborator Author

OK, finally past that problem, now next one:

{
  shareWith: 'admin@http://revad2.docker',
  name: 'Test share from stub',
  providerId: '42',
  owner: 'admin@https://stub1.docker',
  ownerDisplayName: 'admin',
  sender: 'admin@https://stub1.docker',
  senderDisplayName: 'admin',
  shareType: 'user',
  resourceType: 'file',
  protocol: { name: 'webdav', options: { sharedSecret: 'shareMe' } }
} { name: 'webdav', options: { sharedSecret: 'shareMe' } }
outgoing share created! 400 {
  "code": "INVALID_PARAMETER",
  "message": "missing details about resource to be shared"
}

@michielbdejong
Copy link
Collaborator Author

Reproduced on my laptop with curl --data @test.json http://localhost:19001/shares/

@michielbdejong
Copy link
Collaborator Author

See also #25 (comment)

@michielbdejong
Copy link
Collaborator Author

With michielbdejong/ocm-stub@ed0a6ef the share can now successfully be created, and the error changes to:

shareWith=admin%40http%3A%2F%2Frevad2.docker&name=Test%20share%20from%20stub&providerId=cernbox&meshProvider=cernbox.cern.ch&owner=admin%40https%3A%2F%2Fstub1.docker&ownerDisplayName=admin&sender=admin%40https%3A%2F%2Fstub1.docker&senderDisplayName=admin&shareType=user&resourceType=file&protocol=%7B%22name%22%3A%22webdav%22%2C%22options%22%3A%7B%22token%22%3A%22shareMe%22%7D%7D
outgoing share created! 404 {
  "code": "RESOURCE_NOT_FOUND",
  "message": "user not found"
}

@michielbdejong
Copy link
Collaborator Author

Apparently https://github.com/cs3org/reva/blob/v1.11.0/internal/http/services/ocmd/shares.go#L107-L109 is checking whether the shareWith user@host exists, presumably against https://github.com/cs3org/ocm-test-suite/blob/add-reva/revad/users.demo.json somehow. Will continue investigating tomorrow

@michielbdejong
Copy link
Collaborator Author

Next: accept the share in reva. Should we create a reva client in node from the .proto, or use reva-cli?

@michielbdejong
Copy link
Collaborator Author

Will see how far I get with https://www.npmjs.com/package/@cs3org/node-cs3apis

@michielbdejong
Copy link
Collaborator Author

TARGET=revad2.docker:19000 node test-proto.js 
Albert Einstein

@michielbdejong
Copy link
Collaborator Author

node test-proto.js 
Albert Einstein
Error: 2 UNKNOWN: gateway: error calling ListReceivedShares: rpc error: code = Unauthenticated desc = auth: core access token not found
    at Object.exports.createStatusError (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:1209:28)
    at InterceptingListener._callNext (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:847:24) {
  code: 2,
  metadata: Metadata { _internal_repr: {}, flags: 0 },
  details: 'gateway: error calling ListReceivedShares: rpc error: code = Unauthenticated desc = auth: core access token not found'
}

@michielbdejong
Copy link
Collaborator Author

That's with 60ca2da

@michielbdejong
Copy link
Collaborator Author

Stuck on cs3org/cs3apis#140

@michielbdejong
Copy link
Collaborator Author

OK, back in business :)

root@11d72c6435b6:/home/tester/ocm-test-suite# TARGET=revad2.docker:19000 node test-proto.js
DisplayName from AuthenticateResponse: Albert Einstein
DisplayName from WhoAmIResponse: Albert Einstein
SharesList from ListReceivedOCMSharesResponse: []

@michielbdejong
Copy link
Collaborator Author

Next:

+  async updateReceivedOCMShares(shareReference, newState) {
+    await this.ensureConnected();
+    const req = new UpdateReceivedOCMSharesRequest();
+    req.setShareReference(shareReference);
+    req.setState(newState);
+
+    const res = await this.grpcClient.updateReceivedOCMShare(req, this.metadata);
+    console.log('updated', res);
+  }

@michielbdejong
Copy link
Collaborator Author

(node:84995) UnhandledPromiseRejectionWarning: TypeError: shares.getSharesList(...)[0].getReferenceId is not a function
at RevaClient.listReceivedOCMShares (/Users/michiel/gh/cs3org/ocm-test-suite/reva-client.js:65:131)

@michielbdejong
Copy link
Collaborator Author

Added in the reva-client branch.

@michielbdejong michielbdejong marked this pull request as ready for review August 12, 2021 14:56
@michielbdejong michielbdejong changed the title [WiP] Add Reva Add Reva Aug 12, 2021
@michielbdejong michielbdejong merged commit f9d7115 into main Aug 12, 2021
@michielbdejong michielbdejong deleted the add-reva branch August 12, 2021 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant