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

anonymous_username is an unknown field #108

Closed
jameswestnz opened this issue Dec 7, 2017 · 3 comments
Closed

anonymous_username is an unknown field #108

jameswestnz opened this issue Dec 7, 2017 · 3 comments
Labels

Comments

@jameswestnz
Copy link

jameswestnz commented Dec 7, 2017

When running kongfig apply, I am getting the following error in the terminal:

PATCH http://kong:8001/plugins/463f37be-6f14-4891-a725-2ae6d81e384a
  { enabled: true,
   config: { anonymous_username: 'unauthorized' } }
 400 Bad Request { 'config.anonymous_username': 'anonymous_username is an unknown field' }
 Error: Bad Request
 {"config.anonymous_username":"anonymous_username is an unknown field"}

Excerpt from config file (plugins is global, not under an api):

plugins: 
  - name: basic-auth
    attributes:
      enabled: true
      config:
        anonymous_username: unauthorized

It seems the anonymous_username property only works when a plugin is defined under an API. Is this intended? I was hoping to define an anonymous user at the global level - maybe I'm missing something?

@jameswestnz
Copy link
Author

jameswestnz commented Dec 7, 2017

Looking at the source code that's being installed via npm or yarn, it looks like version 1.4.1 doesn't have this feature?

Here's the function locally:

function _globalPlugin(plugin) {
    validateEnsure(plugin.ensure);

    return function (world) {
        if (plugin.ensure == 'removed') {
            if (world.hasGlobalPlugin(plugin.name)) {
                return (0, _actions.removeGlobalPlugin)(world.getGlobalPluginId(plugin.name));
            }

            return (0, _actions.noop)({ type: 'noop-global-plugin', plugin: plugin });
        }

        if (world.hasGlobalPlugin(plugin.name)) {
            if (world.isGlobalPluginUpToDate(plugin)) {
                return (0, _actions.noop)({ type: 'noop-global-plugin', plugin: plugin });
            }

            return (0, _actions.updateGlobalPlugin)(world.getGlobalPluginId(plugin.name), plugin.attributes);
        }

        return (0, _actions.addGlobalPlugin)(plugin.name, plugin.attributes);
    };
}

EDIT: Here's npmjs' current 1.4.1 - https://registry.npmjs.org/kongfig/-/kongfig-1.4.1.tgz

@CyExy CyExy added the bug label Jan 8, 2018
@CyExy
Copy link
Contributor

CyExy commented Feb 4, 2018

Looks like the 1.4.1 release had gone wrong and an earlier version was published, in github it is correct but in npm registry it is incorrect. Please try again with 1.4.2.

@CyExy
Copy link
Contributor

CyExy commented Mar 1, 2018

This should be fixed, please re-open if still happening

@CyExy CyExy closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants