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 Okta auth method #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dylan-azucena
Copy link

Add functionality from here: https://www.vaultproject.io/docs/auth/okta.html to authenticate with Okta. Includes unit test (I believe integration tests would require an Okta account).

@hashicorp-cla
Copy link

hashicorp-cla commented Aug 15, 2019

CLA assistant check
All committers have signed the CLA.

@robkinyon-roivant
Copy link

The problem with that PR is the same as problem #197 raises. You cannot assume okta is the correct path. We have multiple Okta backends, each with their own path. We already have to monkey-patch the LDAP authentication method to support non-standard paths.

@dylan-azucena
Copy link
Author

@robkinyon-roivant I believe what you're looking for is to pass the mount point via the custom options hash when using the auth method. Here's an example using the userpass auth method:

result = subject.auth.userpass(@username, @password, mount: "new-userpass")

Have you tried this way of specifying the mount point with LDAP auth?

@robkinyon-roivant
Copy link

robkinyon-roivant commented Sep 3, 2019

@robkinyon-roivant I believe what you're looking for is to pass the mount point via the custom options hash when using the auth method. Here's an example using the userpass auth method:

result = subject.auth.userpass(@username, @password, mount: "new-userpass")

Have you tried this way of specifying the mount point with LDAP auth?

I have. The code doesn't look at options[:mount]. None of the code does, even the methods whose documentation says to use a custom mount-point, like userpass().

The broken line is

json = client.post("/v1/auth/ldap/login/#{encode_path(username)}", JSON.fast_generate(payload))

Instead, that line (in ldap()) should be something like:

      mount = options[:mount] || 'ldap'
      json = client.post("/v1/auth/#{mount}/login/#{encode_path(username)}", JSON.fast_generate(payload))

And then (with appropriate default) in okta(), userpass(), etc.

The mistake in the auth specs is that the userpass and new-userpass mounts both return the same thing. There's no way to differentiate between them, so you don't know that options[:mount] is being ignored. Instead, you should verify that mount: not-a-thing returns unauthenticated like on

it "raises an error if the authentication is bad" do
.

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