aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/openid_token.h
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2022-10-06 19:27:24 +0200
committern-peugnet <n.peugnet@free.fr>2022-10-06 19:27:24 +0200
commitd911b207f49e936b3e992200796110f0749ed150 (patch)
tree96d20ebb4d074a4c1755e21cb316a52d584daee3 /lib/csapi/definitions/openid_token.h
parent8ad8a74152c5701b6ca1f9a00487ba9257a439b4 (diff)
parent56c2f2e2b809b9077393eb617828f33d144f5634 (diff)
downloadlibquotient-d911b207f49e936b3e992200796110f0749ed150.tar.gz
libquotient-d911b207f49e936b3e992200796110f0749ed150.zip
New upstream version 0.7.0
Diffstat (limited to 'lib/csapi/definitions/openid_token.h')
-rw-r--r--lib/csapi/definitions/openid_token.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/csapi/definitions/openid_token.h b/lib/csapi/definitions/openid_token.h
new file mode 100644
index 00000000..9b026dea
--- /dev/null
+++ b/lib/csapi/definitions/openid_token.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+
+struct OpenIdCredentials {
+ /// An access token the consumer may use to verify the identity of
+ /// the person who generated the token. This is given to the federation
+ /// API `GET /openid/userinfo` to verify the user's identity.
+ QString accessToken;
+
+ /// The string `Bearer`.
+ QString tokenType;
+
+ /// The homeserver domain the consumer should use when attempting to
+ /// verify the user's identity.
+ QString matrixServerName;
+
+ /// The number of seconds before this token expires and a new one must
+ /// be generated.
+ int expiresIn;
+};
+
+template <>
+struct JsonObjectConverter<OpenIdCredentials> {
+ static void dumpTo(QJsonObject& jo, const OpenIdCredentials& pod)
+ {
+ addParam<>(jo, QStringLiteral("access_token"), pod.accessToken);
+ addParam<>(jo, QStringLiteral("token_type"), pod.tokenType);
+ addParam<>(jo, QStringLiteral("matrix_server_name"),
+ pod.matrixServerName);
+ addParam<>(jo, QStringLiteral("expires_in"), pod.expiresIn);
+ }
+ static void fillFrom(const QJsonObject& jo, OpenIdCredentials& pod)
+ {
+ fromJson(jo.value("access_token"_ls), pod.accessToken);
+ fromJson(jo.value("token_type"_ls), pod.tokenType);
+ fromJson(jo.value("matrix_server_name"_ls), pod.matrixServerName);
+ fromJson(jo.value("expires_in"_ls), pod.expiresIn);
+ }
+};
+
+} // namespace Quotient