ContextI.cpp 648 Bytes
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#include <Ice/Ice.h>
#include <ContextI.h>

using namespace std;

std::string
ContextI::login(std::string /* name */, std::string /* passwd */, const Ice::Current& /* c */)
{
   return "secretToken";
}

void
ContextI::function(const Ice::Current& c)
{
  // check token
    const auto p = c.ctx.find("token");
    if (p == c.ctx.end())
      return;
    if (p != c.ctx.end() && p->second != "secretToken")
      return;
    cout << "function" << endl;
}

void
ContextI::shutdown(const Ice::Current& c)
{
    cout << "Shutting down..." << endl;
    c.adapter->getCommunicator()->shutdown();
}