mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[GH-ISSUE #283] Anonymous Authentication in Java #58
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @paualarco on GitHub (Jul 8, 2020).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/283
Hello!
There is no examples on how to use this emulator with a Java Application, do you know if it is even possible?
I have not found anything related with Google Anonymous Credentials from the Java api...
@saintflow47 commented on GitHub (Jul 9, 2020):
I second this. Spend the better part of the day trying to get this fake-gcs-server to run with the Java Library. Always end up with
when I try to access a file.
I tried a bunch of different configurations like
StorageOptions.newBuilder().setCredentials(NoCredentials.getInstance()).setProjectId("test").build().getService();@fsouza commented on GitHub (Jul 9, 2020):
Hi there, I'm not very familiar with the Java sdk, but from previous issues it seems that the Java SDK uses gRPC? Also, that error indicates that the SDK is likely trying to authenticate directly with Google API, as fake-gcs-server doesn't handle any authentication and never returns a 401.
See #146, #84 and #142.
@saintflow47 commented on GitHub (Jul 9, 2020):
Yeah you are right, google sadly didn't lead me to the issues you mentioned, thank you very much for the clarification. Might be that same issue. I use the docker version of the fake-gcs-server, the fix described in #146 will most likely not be feasible in our current setup. bummer! Thank you anyways for developing the fake server in the first place, doing gods work there.
@rcastagno commented on GitHub (Jul 27, 2020):
Been able to do it with something like this:
StorageOptions.newBuilder().setHost("https://127.0.0.1:4443").setProjectId(projectId).build().getService()to point the service on localhost, plus:
Still having some problems with upload, but that's a different issue I suppose.
@paualarco commented on GitHub (Jul 27, 2020):
Indirectly related to this issue:
The java library java-storage-nio provides an emulator for the GCS, in case you are interested on using it, there is some documentation on how to get started with it in the monix-connect google cloud storage documentation page: https://connect.monix.io/docs/gcs#local-testing
@lapep commented on GitHub (Oct 2, 2020):
There is an easier way (I believe) to set up the Java client in order not to use SSL authentication: a custom instance of HttpTransportFactory needs to be created where Http transport without authentication is built.
Code bellow is in Scala, but in Java it would look almost the same:
And then it can be supplied to HttpTransportOptions builder:
@paualarco commented on GitHub (Oct 2, 2020):
@lapep awesome, have you tried if it is compatible with the
fake-gcs-server?@lapep commented on GitHub (Oct 5, 2020):
@paualarco Unfortunately, It looks like the Java client is not supported by
fake-gcs-server.Found the same error I am getting with Java client when browsing Github Issue page: https://github.com/fsouza/fake-gcs-server/issues/142
@fsouza commented on GitHub (Feb 15, 2021):
Java should be working now that #142 is closed. Authentication is not something fake-gcs-server can handle though, you need the anonymous clients. Closing this, but feel free to reopen this or a new issue in case of questions or issues!