+std::string yf::AuthSimple::get_user(Z_InitRequest *initReq,
+ std::string &password) const
+{
+ Z_IdAuthentication *auth = initReq->idAuthentication;
+ std::string user;
+ if (auth)
+ {
+ const char *cp;
+ switch (auth->which)
+ {
+ case Z_IdAuthentication_open:
+ cp = strchr(auth->u.open, '/');
+ if (cp)
+ {
+ user.assign(auth->u.open, cp - auth->u.open);
+ password.assign(cp + 1);
+ }
+ else
+ user = auth->u.open;
+ break;
+ case Z_IdAuthentication_idPass:
+ if (auth->u.idPass->userId)
+ user = auth->u.idPass->userId;
+ if (auth->u.idPass->password)
+ password = auth->u.idPass->password;
+ break;
+ }
+ }
+ return user;
+}