[go: nahoru, domu]

blob: 580765a6cc928c1ae55e5b1ce8e04e272532d963 [file] [log] [blame]
Zachary Tanc88e7f72024-01-12 18:40:521// Copyright 2024 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_WEBID_FEDERATED_IDENTITY_DATA_MODEL_H_
6#define COMPONENTS_WEBID_FEDERATED_IDENTITY_DATA_MODEL_H_
7
8#include <set>
9
10#include "base/functional/callback_forward.h"
11#include "url/origin.h"
12
13namespace webid {
14
15class FederatedIdentityDataModel {
16 public:
17 class DataKey {
18 public:
19 explicit DataKey(url::Origin relying_party_requester,
20 url::Origin relying_party_embedder,
21 url::Origin identity_provider,
22 std::string account_id);
23
24 DataKey(const DataKey&);
25 DataKey(DataKey&&);
26
27 DataKey& operator=(const DataKey&);
28 DataKey& operator=(DataKey&&);
29
30 ~DataKey();
31
32 const url::Origin& relying_party_requester() const {
33 return relying_party_requester_;
34 }
35 const url::Origin& relying_party_embedder() const {
36 return relying_party_embedder_;
37 }
38 const url::Origin& identity_provider() const { return identity_provider_; }
39 const std::string& account_id() const { return account_id_; }
40
41 bool operator<(const DataKey&) const;
42
43 bool operator==(const DataKey&) const;
44
45 private:
46 url::Origin relying_party_requester_;
47 url::Origin relying_party_embedder_;
48 url::Origin identity_provider_;
49 std::string account_id_;
50 };
51
52 virtual ~FederatedIdentityDataModel() = default;
53
54 virtual void GetAllDataKeys(
55 base::OnceCallback<void(std::vector<DataKey>)> callback) = 0;
56
57 virtual void RemoveFederatedIdentityDataByDataKey(
58 const DataKey& data_key,
59 base::OnceClosure callback) = 0;
60};
61
62} // namespace webid
63
64#endif // COMPONENTS_WEBID_FEDERATED_IDENTITY_DATA_MODEL_H_