// CompareCredentials: Checks provided LoginCredential's username and password // against *this. bool LoginCredentials::CompareCredentials(LoginCredentials loginB) { // Check Username & Password of loginB against this. if(!CheckUserName(loginB.GetUserName())) return false; if(!CheckPassword(loginB.GetPassword())) return false; return true; }
// CheckLogin: Checks given username and password or full credentials against // global list of valid credentials. Prefered use is the 2nd // verions that takes LoginCredentials as a parameter due to its // ability to properly set the permission upon finding a match. bool CheckLogin(std::string user, std::string pass) { // Create a loginCredential with given username and pass LoginCredentials login; login.SetUser(user); login.SetPass(pass); // Loop through validLogins and check given credentials against valid ones. for(int i = 0; validLogins[i].GetPermission() > INVALID_PERMISSION; i++) { if(validLogins[i].CompareCredentials(login)) return false; } return true; }
bool OpenSimWorldSession::StartSession(const LoginCredentials &credentials, const QUrl &serverEntryPointUrl) { bool success = false; if (credentials.GetType() == ProtocolUtilities::AT_OpenSim) { // Set Url and Credentials serverEntryPointUrl_ = ValidateUrl(serverEntryPointUrl.toString(), WorldSessionInterface::OpenSimServer); credentials_ = credentials; // Try do OpenSim login with ProtocolModuleOpenSim success = LoginToServer( credentials_.GetFirstName(), credentials_.GetLastName(), credentials_.GetPassword(), serverEntryPointUrl_.toString(), QString::number(serverEntryPointUrl_.port()), credentials_.GetStartLocation(), GetConnectionThreadState()); } else { ProtocolModuleOpenSim::LogInfo("Invalid credential type, must be OpenSimCredentials for OpenSimWorldSession"); success = false; } return success; }
void OpenSimWorldSession::SetCredentials(const LoginCredentials &credentials) { if (credentials.GetType() == ProtocolUtilities::AT_OpenSim) credentials_ = credentials; else ProtocolModuleOpenSim::LogInfo("Could not set credentials, invalid type. Must be OpenSim for OpenSimWorldSession"); }
bool RealXtendWorldSession::StartSession(const LoginCredentials &credentials, const QUrl &serverEntryPointUrl) { bool success = false; if (credentials.GetType() == ProtocolUtilities::AT_RealXtend) { // Set Url and Credentials serverEntryPointUrl_ = ValidateUrl(serverEntryPointUrl.toString(), WorldSessionInterface::OpenSimServer); credentials_ = credentials; credentials_.SetAuthenticationUrl( ValidateUrl(credentials_.GetAuthenticationUrl().toString(), WorldSessionInterface::RealXtendAuthenticationServer) ); // Try do RealXtend auth based login with ProtocolModuleOpenSim success = LoginToServer( credentials_.GetPassword(), serverEntryPointUrl_.host(), QString::number(serverEntryPointUrl_.port()), credentials_.GetAuthenticationUrl().host(), QString::number(credentials_.GetAuthenticationUrl().port()), credentials_.GetIdentity(), credentials_.GetStartLocation(), GetConnectionThreadState()); } else { ProtocolModuleOpenSim::LogInfo("Invalid credential type, must be RealXtend for RealXtendWorldSession"); success = false; } return success; }
bool CheckLogin(LoginCredentials login) { // Loop through validLogins and check given credentials against valid ones. for(int i = 0; validLogins[i].GetPermission() > INVALID_PERMISSION; i++) { if(validLogins[i].CompareCredentials(login)) { // If we found the login details in the list of valid logins then // set the permission to allow correct access. login.SetPermission(validLogins[i].GetPermission()); return true; } } return false; }