mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-17 11:21:51 +03:00
ccb45bfea6
This is a preparation to make them usable from the Shibboleth credentials class.
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
/*
|
|
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*/
|
|
|
|
|
|
#include <QString>
|
|
#include <QDebug>
|
|
|
|
#include "creds/abstractcredentials.h"
|
|
|
|
namespace Mirall
|
|
{
|
|
|
|
QString AbstractCredentials::keychainKey(const QString &url, const QString &user)
|
|
{
|
|
QString u(url);
|
|
if( u.isEmpty() ) {
|
|
qDebug() << "Empty url in keyChain, error!";
|
|
return QString::null;
|
|
}
|
|
if( user.isEmpty() ) {
|
|
qDebug() << "Error: User is emty!";
|
|
return QString::null;
|
|
}
|
|
|
|
if( !u.endsWith(QChar('/')) ) {
|
|
u.append(QChar('/'));
|
|
}
|
|
|
|
QString key = user+QLatin1Char(':')+u;
|
|
return key;
|
|
}
|
|
} // ns Mirall
|