Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: examples/echo/echo_client.cc

Issue 1261403003: Initial skeletal implementation of the PrincipalService. Also, use the Login()/GetUserBlessing() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Default blessings Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: examples/echo/echo_client.cc
diff --git a/examples/echo/echo_client.cc b/examples/echo/echo_client.cc
index 28ba874a2a17579f77c084b24e527a5f236e3b56..d03024a43e8337ae95faefa82c5e9bb7661bdb31 100644
--- a/examples/echo/echo_client.cc
+++ b/examples/echo/echo_client.cc
@@ -10,6 +10,7 @@
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/application/application_runner.h"
#include "mojo/public/cpp/utility/run_loop.h"
+#include "mojo/services/vanadium/security/public/interfaces/principal.mojom.h"
namespace mojo {
namespace examples {
@@ -26,13 +27,21 @@ class ResponsePrinter {
class EchoClientDelegate : public ApplicationDelegate {
public:
void Initialize(ApplicationImpl* app) override {
- app->ConnectToService("mojo:echo_server", &echo_);
+ // Get user login credentials
+ app->ConnectToService("mojo:go_principal_service", &login_service_);
+ login_service_->Login(Callback<void(const BlessingPtr)>());
+ app->ConnectToService("mojo:echo_server", &echo_);
echo_->EchoString("hello world", ResponsePrinter());
}
+ void Quit() override {
+ login_service_->Logout();
+ }
+
private:
EchoPtr echo_;
+ PrincipalServicePtr login_service_;
};
} // namespace examples

Powered by Google App Engine
This is Rietveld 408576698