Apache Ignite C++ Client
Loading...
Searching...
No Matches
basic_authenticator.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include "ignite/client/ignite_client_authenticator.h"
21
22#include <string>
23
24namespace ignite {
25
31class basic_authenticator : public ignite_client_authenticator {
32public:
34 inline static const std::string TYPE{"basic"};
35
36 // Default
37 basic_authenticator() = default;
38
45 basic_authenticator(std::string username, std::string password)
46 : m_username(std::move(username))
47 , m_password(std::move(password)) {}
48
54 [[nodiscard]] const std::string &get_type() const override { return TYPE; }
55
61 [[nodiscard]] const std::string &get_identity() const override { return m_username; }
62
68 void set_username(std::string username) { m_username = std::move(username); };
69
75 [[nodiscard]] const std::string &get_secret() const override { return m_password; }
76
82 void set_password(std::string password) { m_password = std::move(password); };
83
84private:
86 std::string m_username;
87
89 std::string m_password;
90};
91
92} // namespace ignite
Definition basic_authenticator.h:31
const std::string & get_secret() const override
Definition basic_authenticator.h:75
const std::string & get_type() const override
Definition basic_authenticator.h:54
void set_password(std::string password)
Definition basic_authenticator.h:82
void set_username(std::string username)
Definition basic_authenticator.h:68
const std::string & get_identity() const override
Definition basic_authenticator.h:61
static const std::string TYPE
Definition basic_authenticator.h:34
basic_authenticator(std::string username, std::string password)
Definition basic_authenticator.h:45