You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Shawn Heisey <ap...@elyograg.org> on 2017/06/24 15:17:28 UTC

Problem in documentation -- authentication JSON fails validation

This problem brought to you courtesy of the IRC channel.

On this page of the reference guide:

https://lucene.apache.org/solr/guide/6_6/rule-based-authorization-plugin.html

There is this curl command:

curl --user solr:SolrRocks -H 'Content-type:application/json' -d '{
  "set-permission": {"name": "update, "role":"dev"},
  "set-permission": {"name": "read, "role":"guest"},
}' http://localhost:8983/solr/admin/authorization

This command doesn't work.  Solr complains about the JSON, and pasting
the JSON into a validator web page, I have confirmed that it fails
validation.

I can't figure out how this JSON *should* be formatted, or I would just
fix the documentation.  Hopefully somebody knows what should go here.

Thanks,
Shawn


Re: Problem in documentation -- authentication JSON fails validation

Posted by Cassandra Targett <ca...@gmail.com>.
I have a commit locally that I will push shortly that fixes the JSON
on that page for 7.0 (and 6.7 if/when it happens). I ran all the JSON
examples through a linter and found a few additional problems that
should be fixed now.

On Sat, Jun 24, 2017 at 1:13 PM, Chris Ulicny <cu...@iq.media> wrote:
> I haven't actually tested it, but I believe the JSON should probably be
> this:
>
> {
>   "set-permission": {"name": "update", "role":"dev"},
>   "set-permission": {"name": "read", "role":"guest"}
> }
>
> It's missing closing double quotes for 'update' and 'read' and had an extra
> comma after the 'guest' entry.
>
> If I remember correctly, solr doesn't usually have any issues with
> duplicate keys that some JSON validators don't consider valid.
>
>
>
> On Sat, Jun 24, 2017 at 11:17 AM Shawn Heisey <ap...@elyograg.org> wrote:
>
>> This problem brought to you courtesy of the IRC channel.
>>
>> On this page of the reference guide:
>>
>>
>> https://lucene.apache.org/solr/guide/6_6/rule-based-authorization-plugin.html
>>
>> There is this curl command:
>>
>> curl --user solr:SolrRocks -H 'Content-type:application/json' -d '{
>>   "set-permission": {"name": "update, "role":"dev"},
>>   "set-permission": {"name": "read, "role":"guest"},
>> }' http://localhost:8983/solr/admin/authorization
>>
>> This command doesn't work.  Solr complains about the JSON, and pasting
>> the JSON into a validator web page, I have confirmed that it fails
>> validation.
>>
>> I can't figure out how this JSON *should* be formatted, or I would just
>> fix the documentation.  Hopefully somebody knows what should go here.
>>
>> Thanks,
>> Shawn
>>
>>

Re: Problem in documentation -- authentication JSON fails validation

Posted by Chris Ulicny <cu...@iq.media>.
I haven't actually tested it, but I believe the JSON should probably be
this:

{
  "set-permission": {"name": "update", "role":"dev"},
  "set-permission": {"name": "read", "role":"guest"}
}

It's missing closing double quotes for 'update' and 'read' and had an extra
comma after the 'guest' entry.

If I remember correctly, solr doesn't usually have any issues with
duplicate keys that some JSON validators don't consider valid.



On Sat, Jun 24, 2017 at 11:17 AM Shawn Heisey <ap...@elyograg.org> wrote:

> This problem brought to you courtesy of the IRC channel.
>
> On this page of the reference guide:
>
>
> https://lucene.apache.org/solr/guide/6_6/rule-based-authorization-plugin.html
>
> There is this curl command:
>
> curl --user solr:SolrRocks -H 'Content-type:application/json' -d '{
>   "set-permission": {"name": "update, "role":"dev"},
>   "set-permission": {"name": "read, "role":"guest"},
> }' http://localhost:8983/solr/admin/authorization
>
> This command doesn't work.  Solr complains about the JSON, and pasting
> the JSON into a validator web page, I have confirmed that it fails
> validation.
>
> I can't figure out how this JSON *should* be formatted, or I would just
> fix the documentation.  Hopefully somebody knows what should go here.
>
> Thanks,
> Shawn
>
>