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

DOCSP-41148 Authentication Guides #50

Merged
merged 31 commits into from
Nov 27, 2024

Conversation

lindseymoore
Copy link
Collaborator

@lindseymoore lindseymoore commented Oct 2, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-41148
Staging - https://deploy-preview-50--docs-kotlin-sync.netlify.app/security/authentication/

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for docs-kotlin-sync ready!

Name Link
🔨 Latest commit c4db472
🔍 Latest deploy log https://app.netlify.com/sites/docs-kotlin-sync/deploys/6747a7430cd07f00082abfc1
😎 Deploy Preview https://deploy-preview-50--docs-kotlin-sync.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

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

It looks like I had some review comments from last time that I never submitted. Can you start with these?

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
in the options of your connection string or in a ``Credential`` struct.

To learn more about the connection string options for authentication,
see the :manual:`Authentication Options
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Linked to https://www.mongodb.com/docs/manual/reference/connection-string/#connection-string-formats, which leads to helpful information on string format options as well as link to the above page^

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I would remove mention of authentication options from this paragraph, then. The linked page mentions username/password and authSource, but not all of the available options, and I wasn't able to find an easy link to the auth page. Because it's primarily about connection string formats, I would also put it in a Tip box as more of an aside.

Copy link
Collaborator Author

@lindseymoore lindseymoore Oct 23, 2024

Choose a reason for hiding this comment

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

I'll remove the link entirely since the section isn't easily scannable. Initially wanted to include because I ran into trouble with ssl being enabled depending on whether the srv or standard string format was used. I've since updated the guide samples, so hopefully that won't be an issue for users any more.

source/security/authentication.txt Show resolved Hide resolved
Copy link
Collaborator

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

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

It's getting there! Tried to provide lots of suggestions to apply.

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
Comment on lines 94 to 96
`applyToSslSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToSslSettings(com.mongodb.Block)>`__
method and setting the ``enabled`` property to ``true`` in the
`SslSettings.Builder <{+api+}/apidocs/mongodb-driver-core/com/mongodb/connection/SslSettings.Builder.html>`__
Copy link
Collaborator

Choose a reason for hiding this comment

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

Broken links here; are they waiting on another PR to publish the API docs?

Edit: seems to apply to all API links on this page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
@lindseymoore lindseymoore requested a review from a team October 23, 2024 20:28
@lindseymoore lindseymoore requested review from vbabanin and mongoKart and removed request for a team and mongoKart October 23, 2024 20:28
Copy link
Collaborator

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

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

some small changes to add, but LGTM otherwise. great job!

source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/authentication.txt Outdated Show resolved Hide resolved
source/security/enterprise-auth.txt Outdated Show resolved Hide resolved
source/security/enterprise-auth.txt Outdated Show resolved Hide resolved
// SCRAM Authentication
// start-default-cred-string
val mongoClient =
MongoClient.create("mongodb+srv://<db_username>:<db_password>@<hostname>:<port>/?authSource=<authenticationDb>")
Copy link
Member

Choose a reason for hiding this comment

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

If the SRV URI connection format is used, no port can be specified.

Also, It seems that some examples use builder.srvHost("<hostname>"), while others use builder.hosts(listOf(ServerAddress("<hostname>", <port>))). The Java driver documentation consistently uses builder.hosts(listOf(ServerAddress("<hostname>", <port>))).

Is srv host configuration used for conciseness in some examples?

I suggest we standardize the examples to use either the SRV format or the host:port format for consistency. The latter would align with the Java driver documentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @vbabanin, I opted for the SRV URI format for the connection string examples because I get the following timeout error using the standard format. It is because ssl is not enabled:

com.mongodb.MongoTimeoutException: Timed out while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=atlascluster.spm1ztf.mongodb.net:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: atlascluster.spm1ztf.mongodb.net}, caused by {java.net.UnknownHostException: atlascluster.spm1ztf.mongodb.net}}]

For the same reason, I used builder.srvHost("<hostname>") instead of the alternative. In order to make to the examples copyable and runnable, does it make sense to use the +srv format? Thanks!

@vbabanin vbabanin self-requested a review November 27, 2024 21:06
source/includes/security/authentication.kt Outdated Show resolved Hide resolved
source/includes/security/authentication.kt Outdated Show resolved Hide resolved
source/includes/security/authentication.kt Outdated Show resolved Hide resolved
source/includes/security/authentication.kt Show resolved Hide resolved
@vbabanin vbabanin self-requested a review November 27, 2024 21:16
@lindseymoore lindseymoore merged commit d360ee1 into mongodb:master Nov 27, 2024
4 of 5 checks passed
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.

3 participants