Skip to content

Commit

Permalink
[auth] Add CA chain to auth config
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 13, 2017
1 parent d97a51b commit f4b4030
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
13 changes: 12 additions & 1 deletion python/core/auth/qgsauthconfig.sip
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ class QgsPkiConfigBundle

QgsPkiConfigBundle( const QgsAuthMethodConfig &config,
const QSslCertificate &cert,
const QSslKey &certkey );
const QSslKey &certkey,
const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );
%Docstring
Construct a bundle from existing PKI components and authentication method configuration
\param config Authentication method configuration
Expand Down Expand Up @@ -344,6 +345,16 @@ Private key object
void setClientCertKey( const QSslKey &certkey );
%Docstring
Set private key object
%End

QList<QSslCertificate> caChain() const;
%Docstring
Return CA chain
:rtype: list of QSslCertificate
%End
void setCaChain( const QList<QSslCertificate> &caChain );
%Docstring
Set CA chain
%End

};
Expand Down
4 changes: 3 additions & 1 deletion src/core/auth/qgsauthconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,12 @@ void QgsPkiBundle::setClientKey( const QSslKey &certkey )

QgsPkiConfigBundle::QgsPkiConfigBundle( const QgsAuthMethodConfig &config,
const QSslCertificate &cert,
const QSslKey &certkey )
const QSslKey &certkey,
const QList<QSslCertificate> &cachain )
: mConfig( config )
, mCert( cert )
, mCertKey( certkey )
, mCaChain( cachain )
{
}

Expand Down
9 changes: 8 additions & 1 deletion src/core/auth/qgsauthconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ class CORE_EXPORT QgsPkiConfigBundle
*/
QgsPkiConfigBundle( const QgsAuthMethodConfig &config,
const QSslCertificate &cert,
const QSslKey &certkey );
const QSslKey &certkey,
const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );

//! Whether the bundle is valid
bool isValid();
Expand All @@ -287,10 +288,16 @@ class CORE_EXPORT QgsPkiConfigBundle
//! Set private key object
void setClientCertKey( const QSslKey &certkey ) { mCertKey = certkey; }

//! Return CA chain
QList<QSslCertificate> caChain() const { return mCaChain; }
//! Set CA chain
void setCaChain( const QList<QSslCertificate> &caChain ) { mCaChain = caChain; }

private:
QgsAuthMethodConfig mConfig;
QSslCertificate mCert;
QSslKey mCertKey;
QList<QSslCertificate> mCaChain;
};


Expand Down

0 comments on commit f4b4030

Please sign in to comment.