aboutsummaryrefslogtreecommitdiff
path: root/lib/ssosession.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-18 09:51:27 +0100
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-03-18 09:51:27 +0100
commitab3d0263b770e30de673c63740a5c26bcbf33e58 (patch)
treeee379ad12c459d16de2e29aff8721a61e437bc7a /lib/ssosession.h
parentd02a510a586db1a89476cd283ea24a281e9bb6af (diff)
downloadlibquotient-ab3d0263b770e30de673c63740a5c26bcbf33e58.tar.gz
libquotient-ab3d0263b770e30de673c63740a5c26bcbf33e58.zip
SsoSession and Connection::prepareForSso()
The response in the web browser is quite barebone, just enough to give feedback that things are alright. Closes #386. Closes #388.
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..5845cd4d
--- /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 Quotient {
+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 Quotient