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

Adding support for base_url for Okta api #3316

Merged
merged 9 commits into from
Sep 15, 2017
Merged

Conversation

chrishoffman
Copy link
Contributor

This adds back support for providing the base_url for Okta API requests. This will allow the backend to support domains such as okta-emea.com.

Fixes #3313

Chris Hoffman added 2 commits September 11, 2017 14:13
* oss/master:
  fix: add missing comma to payload (#3308)
  Switching atomic vars to int32 to address panic on some architectures (#3314)
func pathConfig(b *backend) *framework.Path {
return &framework.Path{
Pattern: `config`,
Fields: map[string]*framework.FieldSchema{
"organization": &framework.FieldSchema{
Type: framework.TypeString,
Description: "Okta organization to authenticate against (DEPRECATED)",
Description: "(DEPRECATED) Okta organization to authenticate against",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe update this to say "Use org_name instead."

}
} else if req.Operation == logical.CreateOperation {
cfg.BaseURL = d.Get("base_url").(string)
baseURL := d.Get("base_url").(string)
Copy link
Member

Choose a reason for hiding this comment

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

This code now requires base_url set at all times instead of honoring create/update. Not necessarily a problem, but a change in behavior. Also, the documentation lists it as optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this is the problem with providing a default value in the fields. I'll remove the default and only populate it when it is specified.

productionRaw, ok := d.GetOk("production")
if ok {
production := productionRaw.(bool)
cfg.Production = &production
Copy link
Member

Choose a reason for hiding this comment

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

Because this loads cfg first if it's there, if they have production in the past, but now leave that value out and switch to a custom base url, there's a possibility of their base url being overwritten by the production value later on. I think if a base_url is provided we should nil out production.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good. I played around with this dance a bit and ended up hear. I like your suggestion better.

@jefferai jefferai added this to the 0.8.3 milestone Sep 11, 2017
@chrishoffman
Copy link
Contributor Author

I just realized that the previous PR that standardized the APIs across Okta features removed the ability to optionally query the groups from Okta. My latest commit reintroduces this behavior and addresses the previous comments.

Chris Hoffman added 6 commits September 11, 2017 17:17
* oss/master:
  Fix navigation and prameters in the 'gcp' auth backend docs. (#3317)
  changelog++
  Adding latency injector option to -dev mode for storage operations (#3289)
@chrishoffman chrishoffman merged commit 3aa68c0 into master Sep 15, 2017
@chrishoffman chrishoffman deleted the okta-lib-baseurl branch September 15, 2017 04:27
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.

2 participants