Add user information for aws authenticator
This commit is contained in:
parent
da1d43a0c3
commit
e9ff550e1c
@ -1,6 +1,5 @@
|
|||||||
#include "authenticationprocess.h"
|
#include "authenticationprocess.h"
|
||||||
#include "loggingcategories.h"
|
#include "loggingcategories.h"
|
||||||
#include "userinformation.h"
|
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -163,7 +162,7 @@ void AuthenticationProcess::onProcessFinished(int exitCode, QProcess::ExitStatus
|
|||||||
|
|
||||||
UserInformation userInformation(email, cognitoUsername, vendorId, userPoolId);
|
UserInformation userInformation(email, cognitoUsername, vendorId, userPoolId);
|
||||||
|
|
||||||
emit authenticationFinished(Authenticator::AuthenticationErrorNoError);
|
emit authenticationFinished(Authenticator::AuthenticationErrorNoError, userInformation);
|
||||||
} else {
|
} else {
|
||||||
emit authenticationFinished(Authenticator::AuthenticationErrorAuthenticationFailed);
|
emit authenticationFinished(Authenticator::AuthenticationErrorAuthenticationFailed);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
#include "authenticator.h"
|
#include "authenticator.h"
|
||||||
|
#include "userinformation.h"
|
||||||
|
|
||||||
namespace remoteproxy {
|
namespace remoteproxy {
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ private:
|
|||||||
void cleanUp();
|
void cleanUp();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void authenticationFinished(Authenticator::AuthenticationError error);
|
void authenticationFinished(Authenticator::AuthenticationError error, const UserInformation &userInformation = UserInformation());
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDynamicCredentialsReady();
|
void onDynamicCredentialsReady();
|
||||||
|
|||||||
@ -22,20 +22,24 @@ QString AwsAuthenticator::name() const
|
|||||||
return "AWS authenticator";
|
return "AWS authenticator";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AwsAuthenticator::onAuthenticationProcessFinished(Authenticator::AuthenticationError error)
|
void AwsAuthenticator::onAuthenticationProcessFinished(Authenticator::AuthenticationError error, const UserInformation &userInformation)
|
||||||
{
|
{
|
||||||
AuthenticationProcess *process = static_cast<AuthenticationProcess *>(sender());
|
AuthenticationProcess *process = static_cast<AuthenticationProcess *>(sender());
|
||||||
AuthenticationReply *reply = m_runningProcesses.take(process);
|
AuthenticationReply *reply = m_runningProcesses.take(process);
|
||||||
|
|
||||||
|
if (error == AuthenticationErrorNoError) {
|
||||||
|
qCDebug(dcAuthentication()) << name() << reply->proxyClient() << "finished successfully." << userInformation;
|
||||||
|
} else {
|
||||||
|
qCDebug(dcAuthentication()) << name() << reply->proxyClient() << "finished with error" << error;
|
||||||
|
}
|
||||||
|
|
||||||
setReplyError(reply, error);
|
setReplyError(reply, error);
|
||||||
setReplyFinished(reply);
|
setReplyFinished(reply);
|
||||||
|
|
||||||
qCDebug(dcAuthentication()) << name() << "finished with error" << error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticationReply *AwsAuthenticator::authenticate(ProxyClient *proxyClient)
|
AuthenticationReply *AwsAuthenticator::authenticate(ProxyClient *proxyClient)
|
||||||
{
|
{
|
||||||
qCDebug(dcAuthentication()) << name() << "Start authenticating" << proxyClient << "using token" << proxyClient->token();
|
qCDebug(dcAuthentication()) << name() << "Start authenticating" << proxyClient;
|
||||||
AuthenticationReply *reply = createAuthenticationReply(proxyClient, this);
|
AuthenticationReply *reply = createAuthenticationReply(proxyClient, this);
|
||||||
|
|
||||||
AuthenticationProcess *process = new AuthenticationProcess(m_manager, this);
|
AuthenticationProcess *process = new AuthenticationProcess(m_manager, this);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ private:
|
|||||||
QHash<AuthenticationProcess *, AuthenticationReply *> m_runningProcesses;
|
QHash<AuthenticationProcess *, AuthenticationReply *> m_runningProcesses;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAuthenticationProcessFinished(Authenticator::AuthenticationError error);
|
void onAuthenticationProcessFinished(Authenticator::AuthenticationError error, const UserInformation &userInformation);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
AuthenticationReply *authenticate(ProxyClient *proxyClient) override;
|
AuthenticationReply *authenticate(ProxyClient *proxyClient) override;
|
||||||
|
|||||||
@ -39,4 +39,13 @@ bool UserInformation::isValid()
|
|||||||
&& !m_userPoolId.isEmpty();
|
&& !m_userPoolId.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const UserInformation &userInformation)
|
||||||
|
{
|
||||||
|
debug.nospace() << "UserInformation(" << userInformation.email();
|
||||||
|
debug.nospace() << ", cognito:" << userInformation.cognitoUsername() << ") ";
|
||||||
|
debug.nospace() << ", vendor" << userInformation.vendorId() << ") ";
|
||||||
|
debug.nospace() << ", userpool" << userInformation.userPoolId() << ") ";
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#ifndef USERINFORMATION_H
|
#ifndef USERINFORMATION_H
|
||||||
#define USERINFORMATION_H
|
#define USERINFORMATION_H
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace remoteproxy {
|
namespace remoteproxy {
|
||||||
@ -25,6 +26,8 @@ private:
|
|||||||
QString m_userPoolId;
|
QString m_userPoolId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const UserInformation &userInformation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // USERINFORMATION_H
|
#endif // USERINFORMATION_H
|
||||||
|
|||||||
Reference in New Issue
Block a user