aboutsummaryrefslogtreecommitdiff
path: root/lib/ssosession.h
diff options
context:
space:
mode:
authorHubert Chathi <uhoreg@debian.org>2020-04-20 18:01:38 -0400
committerHubert Chathi <uhoreg@debian.org>2020-04-20 18:01:38 -0400
commit035d428becd62869b88793bb48d59410056b1f31 (patch)
tree0cd837955fa1037c74ee524a089ff1b788b75861 /lib/ssosession.h
parent688dc682e0c6ae12dc87d781ffe53c974dad60df (diff)
parentd8e1f4ee70902e2b9e5e9c699423d7f3fafe6238 (diff)
downloadlibquotient-035d428becd62869b88793bb48d59410056b1f31.tar.gz
libquotient-035d428becd62869b88793bb48d59410056b1f31.zip
Update upstream source from tag 'upstream/0.5.3.2'
Update to upstream version '0.5.3.2' with Debian dir 49a325a077f4a2ebcd5b73adf3782a6fb5ecb3fe
Diffstat (limited to 'lib/ssosession.h')
-rw-r--r--lib/ssosession.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/ssosession.h b/lib/ssosession.h
new file mode 100644
index 00000000..af20c075
--- /dev/null
+++ b/lib/ssosession.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <QtCore/QUrl>
+#include <QtCore/QObject>
+
+#include <memory>
+
+class QTcpServer;
+class QTcpSocket;
+
+namespace QMatrixClient {
+class Connection;
+
+/*! Single sign-on (SSO) session encapsulation
+ *
+ * This class is responsible for setting up of a new SSO session, providing
+ * a URL to be opened (usually, in a web browser) and handling the callback
+ * response after completing the single sign-on, all the way to actually
+ * logging the user in. It does NOT open and render the SSO URL, it only does
+ * the necessary backstage work.
+ *
+ * Clients only need to open the URL; the rest is done for them.
+ * Client code can look something like:
+ * \code
+ * QDesktopServices::openUrl(
+ * connection->prepareForSso(initialDeviceName)->ssoUrl());
+ * \endcode
+ */
+class SsoSession : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QUrl ssoUrl READ ssoUrl CONSTANT)
+ Q_PROPERTY(QUrl callbackUrl READ callbackUrl CONSTANT)
+public:
+ SsoSession(Connection* connection, const QString& initialDeviceName,
+ const QString& deviceId = {});
+ ~SsoSession() override;
+ QUrl ssoUrl() const;
+ QUrl callbackUrl() const;
+
+private:
+ class Private;
+ std::unique_ptr<Private> d;
+};
+} // namespace QMatrixClient