Skip to content

Commit

Permalink
fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 authored and nyalldawson committed Dec 11, 2024
1 parent 02a4e55 commit 68dfbb1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
44 changes: 22 additions & 22 deletions src/core/auth/qgsauthorizationsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@

#include "qgsauthorizationsettings.h"

QgsAuthorizationSettings::QgsAuthorizationSettings(const QString &userName, const QString &password, const QgsHttpHeaders &httpHeaders, const QString &authcfg)
: mUserName( userName )
, mPassword( password )
, mHttpHeaders( httpHeaders )
, mAuthCfg( authcfg )
QgsAuthorizationSettings::QgsAuthorizationSettings( const QString &userName, const QString &password, const QgsHttpHeaders &httpHeaders, const QString &authcfg )
: mUserName( userName )
, mPassword( password )
, mHttpHeaders( httpHeaders )
, mAuthCfg( authcfg )
{}

bool QgsAuthorizationSettings::setAuthorization(QNetworkRequest &request) const
bool QgsAuthorizationSettings::setAuthorization( QNetworkRequest &request ) const
{
if ( !mAuthCfg.isEmpty() ) // must be non-empty value
{
return QgsApplication::authManager()->updateNetworkRequest( request, mAuthCfg );
}
else if ( !mUserName.isEmpty() || !mPassword.isEmpty() )
{
request.setRawHeader( "Authorization", "Basic " + QStringLiteral( "%1:%2" ).arg( mUserName, mPassword ).toUtf8().toBase64() );
}
if ( !mAuthCfg.isEmpty() ) // must be non-empty value
{
return QgsApplication::authManager()->updateNetworkRequest( request, mAuthCfg );
}
else if ( !mUserName.isEmpty() || !mPassword.isEmpty() )
{
request.setRawHeader( "Authorization", "Basic " + QStringLiteral( "%1:%2" ).arg( mUserName, mPassword ).toUtf8().toBase64() );
}

mHttpHeaders.updateNetworkRequest( request );
mHttpHeaders.updateNetworkRequest( request );

return true;
return true;
}

bool QgsAuthorizationSettings::setAuthorizationReply(QNetworkReply *reply) const
bool QgsAuthorizationSettings::setAuthorizationReply( QNetworkReply *reply ) const
{
if ( !mAuthCfg.isEmpty() )
{
return QgsApplication::authManager()->updateNetworkReply( reply, mAuthCfg );
}
return true;
if ( !mAuthCfg.isEmpty() )
{
return QgsApplication::authManager()->updateNetworkReply( reply, mAuthCfg );
}
return true;
}
30 changes: 15 additions & 15 deletions src/core/auth/qgsauthorizationsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@
class CORE_EXPORT QgsAuthorizationSettings
{
public:

//! Constructor for QgsAuthorizationSettings.
QgsAuthorizationSettings( const QString &userName = QString(), const QString &password = QString(), const QgsHttpHeaders &httpHeaders = QgsHttpHeaders(), const QString &authcfg = QString() );

//! Update authorization for request
bool setAuthorization( QNetworkRequest &request ) const;
//! Constructor for QgsAuthorizationSettings.
QgsAuthorizationSettings( const QString &userName = QString(), const QString &password = QString(), const QgsHttpHeaders &httpHeaders = QgsHttpHeaders(), const QString &authcfg = QString() );

//! Update authorization for reply
bool setAuthorizationReply( QNetworkReply *reply ) const;
//! Update authorization for request
bool setAuthorization( QNetworkRequest &request ) const;

//! Username for basic http authentication
QString mUserName;
//! Update authorization for reply
bool setAuthorizationReply( QNetworkReply *reply ) const;

//! Password for basic http authentication
QString mPassword;
//! Username for basic http authentication
QString mUserName;

//! headers for http requests
QgsHttpHeaders mHttpHeaders;
//! Password for basic http authentication
QString mPassword;

//! Authentication configuration ID
QString mAuthCfg;
//! headers for http requests
QgsHttpHeaders mHttpHeaders;

//! Authentication configuration ID
QString mAuthCfg;
};

#endif // QGSAUTHORIZATIONSETTINGS_H

0 comments on commit 68dfbb1

Please sign in to comment.