// 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.
= Authentication

Ignite 3 provides basic Authentication capabilities.

== Basic Authentication

To start using basic authentication on the cluster, you need to enable it and create an initial administrator user. By default, the role that grants administrator permissions is called `admin`, but you can change it in cluster configuration. Here is an example of configuration that initializes the cluster and enables security on it:

----
cluster init --name=sampleCluster --config=ignite{security{enabled:true,authentication.providers:[{name:default,type:basic,users:[{username:ignite,displayName:administrator,password:ignite,roles:["system"]}]}]}}
----

When cluster has been initialized, it has basic authorization configured for `ignite` user name and `ignite` password with system level access. However, by default security is disabled. To enable it:

----
cluster config update ignite.security.enabled=true
----

WARNING: If you lose access to all accounts with system role, you will lose administrator access to the cluster.

After authorization is enabled, you will be disconnected from the cluster and must reconnect to the cluster:

----
connect http://127.0.0.1:10300 --username ignite --password ignite
----

You can change the password for the default user by updating cluster configuration, for example:

----
cluster config update  ignite.security.authentication.providers.default.users.ignite.password=myPass
---