navendu-pottekkat commented on code in PR #972: URL: https://github.com/apache/apisix-ingress-controller/pull/972#discussion_r867919099
########## docs/en/latest/practices/enable-authentication-and-restriction.md: ########## @@ -0,0 +1,404 @@ +--- +title: Enable authentication and restriction +--- + +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +## Description + +Consumers are used for the authentication method controlled by Apache APISIX, if users want to use their own auth system or 3rd party systems, use OIDC. + +## Attributes + +### Authentication + +#### `keyAuth` + +Consumers add their key either in a header `apikey` to authenticate their requests. + +```yaml +keyAuth: + value: + key: ${key} +``` + +#### `basicAuth` + +Consumers add their key either in a header `Authentication` to authenticate their requests. + +```yaml +basicAuth: + value: + username: ${username} + password: ${password} +``` + +### Restriction + +#### `whitelist` or `blacklist` + +`whitelist`: Grant full access to all users specified in the provided list, **has the priority over `allowed_by_methods`** +`blacklist`: Reject connection to all users specified in the provided list, **has the priority over `whitelist`** + +```yaml +plugins: +- name: consumer-restriction + enable: true + config: + blacklist: + - "${consumer_name}" + - "${consumer_name}" +``` + +#### `allowed_by_methods` + +HTTP methods can be `methods:["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE", "PURGE"]` + +```yaml +plugins: +- name: consumer-restriction + enable: true + config: + allowed_by_methods: + - user: "${consumer_name}" + methods: + - "POST" + - "GET" + - user: "${consumer_name}" + methods: + - "GET" +``` + +## Example + +### Prepare env + +Kubernetes cluster: + +1. [apisix-ingress-controller](../deployments/minikube.md). +2. httpbin. + Review Comment: Yes. I agree that we shouldn't talk about how to install but I think we should make it clear that the **user have to install ingress controller and HTTPbin for the rest of the tutorial to work. Point to other documents on how to do that. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org