ATLAS Offline Software
Loading...
Searching...
No Matches
VP1Authenticator::Imp Class Reference
Collaboration diagram for VP1Authenticator::Imp:

Public Member Functions

 Imp (VP1Authenticator *, const QString &)
 ~Imp ()
 Imp (const Imp &)=delete
Impoperator= (const Imp &)=delete
QString getTagAttributeVal (const QString &tag, const QString &attribute)
void connectToAuthenticator (VP1Authenticator *authenticator)
void displayError (const QString &)

Public Attributes

VP1Authenticatorm_theClass {}
QNetworkAccessManager * m_netmanager {}
QNetworkReply * m_netreply {}
QFile * m_log {}
int stage {1}
QString m_fileInfoUrl
QString m_loginServer

Detailed Description

Definition at line 21 of file VP1Authenticator.cxx.

Constructor & Destructor Documentation

◆ Imp() [1/2]

VP1Authenticator::Imp::Imp ( VP1Authenticator * theClass,
const QString & fileInfoUrl )

Definition at line 49 of file VP1Authenticator.cxx.

51 : m_theClass(theClass)
52 , m_netmanager(new QNetworkAccessManager())
53 , m_netreply(0)
54 , m_log(0)
55 , stage(1)
56 , m_fileInfoUrl(fileInfoUrl)
57 , m_loginServer("login.cern.ch")
58{
59 #if defined BUILDVP1LIGHT
60 bool checkAuthEnabled = VP1QtUtils::expertSettingIsOn("expert","ExpertSettings/VP1_AUTH_ENABLELOG");
61 #else
62 bool checkAuthEnabled = VP1QtUtils::environmentVariableIsOn("VP1_AUTH_ENABLELOG");
63 #endif
64
65 if(checkAuthEnabled) {
66 QString logname("vp1live-auth.log");
67 if(QFileInfo(logname).exists() && !QFile(logname).remove())
68 std::cerr << "VP1Authenticator ERROR: Unable to remove old logfile" << std::endl;
69 else {
70 m_log = new QFile(logname);
71 if(!m_log->open(QIODevice::WriteOnly)) {
72 std::cerr << "VP1Authenticator ERROR: Unable to open new logfile for writing" << std::endl;
73 delete m_log;
74 m_log = 0;
75 }
76 }
77 }
78}
QNetworkAccessManager * m_netmanager
VP1Authenticator * m_theClass
static bool environmentVariableIsOn(const QString &name)
static bool expertSettingIsOn(const QString &type, const QString &name)
bool exists(const std::string &filename)
does a file exist

◆ ~Imp()

VP1Authenticator::Imp::~Imp ( )

Definition at line 80 of file VP1Authenticator.cxx.

81{
82 // deleting m_netmanager is not my responsibility :)
83 delete m_netreply;
84
85 if(m_log) {
86 m_log->close();
87 delete m_log;
88 }
89}

◆ Imp() [2/2]

VP1Authenticator::Imp::Imp ( const Imp & )
delete

Member Function Documentation

◆ connectToAuthenticator()

void VP1Authenticator::Imp::connectToAuthenticator ( VP1Authenticator * authenticator)

Definition at line 108 of file VP1Authenticator.cxx.

109{
110 connect(m_netreply, SIGNAL(finished()),
111 authenticator, SLOT(finished()));
112 connect(m_netreply, SIGNAL(error(QNetworkReply::NetworkError)),
113 authenticator, SLOT(error(QNetworkReply::NetworkError)));
114#ifndef QT_NO_SSL
115 connect(m_netreply, SIGNAL(sslErrors(const QList<QSslError>&)),
116 authenticator, SLOT(sslErrors(const QList<QSslError>&)));
117#endif
118}
void sslErrors(const QList< QSslError > &)

◆ displayError()

void VP1Authenticator::Imp::displayError ( const QString & message)

Definition at line 120 of file VP1Authenticator.cxx.

121{
122 m_theClass->teditError->setVisible(true);
123 m_theClass->setFixedSize(400,350);
124 m_theClass->teditError->append(message);
125 m_theClass->inpPhr->clear();
126 m_theClass->inpPers->setEnabled(true);
127 m_theClass->inpPhr->setEnabled(true);
128 m_theClass->inpPhr->setFocus();
129 if(m_log) {
130 QByteArray logBa(QString(message+"\n").toStdString().c_str());
131 m_log->write(logBa);
132 }
133}

◆ getTagAttributeVal()

QString VP1Authenticator::Imp::getTagAttributeVal ( const QString & tag,
const QString & attribute )

Definition at line 91 of file VP1Authenticator.cxx.

92{
93 QStringMatcher startMatcher(attribute + "=\"",Qt::CaseInsensitive);
94 QStringMatcher endMatcher("\"");
95
96 int startPos = startMatcher.indexIn(tag);
97 if(startPos==-1)
98 return QString("");
99 else {
100 int endPos = endMatcher.indexIn(tag,startPos+startMatcher.pattern().size());
101 if(endPos==-1) // something is wrong with this tag
102 return QString("");
103 else
104 return tag.mid(startPos+startMatcher.pattern().size(),endPos-startPos-startMatcher.pattern().size());
105 }
106}

◆ operator=()

Imp & VP1Authenticator::Imp::operator= ( const Imp & )
delete

Member Data Documentation

◆ m_fileInfoUrl

QString VP1Authenticator::Imp::m_fileInfoUrl

Definition at line 45 of file VP1Authenticator.cxx.

◆ m_log

QFile* VP1Authenticator::Imp::m_log {}

Definition at line 42 of file VP1Authenticator.cxx.

42{};

◆ m_loginServer

QString VP1Authenticator::Imp::m_loginServer

Definition at line 46 of file VP1Authenticator.cxx.

◆ m_netmanager

QNetworkAccessManager* VP1Authenticator::Imp::m_netmanager {}

Definition at line 40 of file VP1Authenticator.cxx.

40{};

◆ m_netreply

QNetworkReply* VP1Authenticator::Imp::m_netreply {}

Definition at line 41 of file VP1Authenticator.cxx.

41{};

◆ m_theClass

VP1Authenticator* VP1Authenticator::Imp::m_theClass {}

Definition at line 39 of file VP1Authenticator.cxx.

39{};

◆ stage

int VP1Authenticator::Imp::stage {1}

Definition at line 44 of file VP1Authenticator.cxx.

44{1};

The documentation for this class was generated from the following file: