Debian Codegraph @

src/goabackend/goaoauth2provider.h

raw symbols SCIP
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /*
3 * Copyright © 2011 – 2017 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
20 #error "Only <goabackend/goabackend.h> can be included directly."
21 #endif
22
23 #ifndef __GOA_OAUTH2_PROVIDER_H__
24 #define __GOA_OAUTH2_PROVIDER_H__
25
26 #include <gio/gio.h>
27
28 #include "goabackend/goaprovider.h"
29 #include "goabackend/goaprovider-priv.h"
30
31 G_BEGIN_DECLS
32
33 #define GOA_TYPE_OAUTH2_PROVIDER (goa_oauth2_provider_get_type ())
34 G_DECLARE_DERIVABLE_TYPE (GoaOAuth2Provider, goa_oauth2_provider, GOA, OAUTH2_PROVIDER, GoaProvider);
35
36 typedef struct _GoaOAuth2ProviderPrivate GoaOAuth2ProviderPrivate;
37
38 const gchar *goa_oauth2_provider_get_authorization_uri (GoaOAuth2Provider *provider);
39 const gchar *goa_oauth2_provider_get_token_uri (GoaOAuth2Provider *provider);
40 const gchar *goa_oauth2_provider_get_redirect_uri (GoaOAuth2Provider *provider);
41 const gchar *goa_oauth2_provider_get_scope (GoaOAuth2Provider *provider);
42 const gchar *goa_oauth2_provider_get_client_id (GoaOAuth2Provider *provider);
43 const gchar *goa_oauth2_provider_get_client_secret (GoaOAuth2Provider *provider);
44 gchar *goa_oauth2_provider_get_identity_sync (GoaOAuth2Provider *provider,
45 const gchar *access_token,
46 gchar **out_presentation_identity,
47 GCancellable *cancellable,
48 GError **error);
49 gchar *goa_oauth2_provider_get_access_token_sync (GoaOAuth2Provider *provider,
50 GoaObject *object,
51 gboolean force_refresh,
52 gint *out_access_token_expires_in,
53 GCancellable *cancellable,
54 GError **error);
55 gchar *goa_oauth2_provider_build_authorization_uri (GoaOAuth2Provider *provider,
56 const gchar *authorization_uri,
57 const gchar *escaped_redirect_uri,
58 const gchar *escaped_client_id,
59 const gchar *escaped_scope,
60 const gchar *code_challenge_method,
61 const gchar *code_challenge);
62 gboolean goa_oauth2_provider_get_use_pkce (GoaOAuth2Provider *provider);
63
64 gboolean goa_oauth2_provider_get_use_mobile_browser (GoaOAuth2Provider *provider);
65 void goa_oauth2_provider_add_account_key_values (GoaOAuth2Provider *provider,
66 GVariantBuilder *builder);
67 gboolean goa_oauth2_provider_process_redirect_url (GoaOAuth2Provider *provider,
68 const gchar *redirect_url,
69 gchar **authorization_code,
70 GError **error);
71
72 G_END_DECLS
73
74 #endif /* __GOA_OAUTH2_PROVIDER_H__ */