QCA::SASLContext

Search for usage in LXR

#include <QtCrypto>

Inheritance diagram for QCA::SASLContext:

Classes

class  HostPort
 

Public Types

enum  Result {
  Success , Error , Params , AuthCheck ,
  Continue
}
 

Signals

void resultsReady ()
 

Public Member Functions

 SASLContext (Provider *p)
 
virtual SASL::AuthCondition authCondition () const =0
 
virtual QString authzid () const =0
 
virtual SASL::Params clientParams () const =0
 
virtual int encoded () const =0
 
virtual bool haveClientInit () const =0
 
virtual QString mech () const =0
 
virtual QStringList mechlist () const =0
 
virtual void nextStep (const QByteArray &from_net)=0
 
virtual QStringList realmlist () const =0
 
virtual void reset ()=0
 
virtual Result result () const =0
 
virtual void serverFirstStep (const QString &mech, const QByteArray *clientInit)=0
 
virtual void setClientParams (const QString *user, const QString *authzid, const SecureArray *pass, const QString *realm)=0
 
virtual void setConstraints (SASL::AuthFlags f, int minSSF, int maxSSF)=0
 
virtual void setup (const QString &service, const QString &host, const HostPort *local, const HostPort *remote, const QString &ext_id, int ext_ssf)=0
 
virtual int ssf () const =0
 
virtual void startClient (const QStringList &mechlist, bool allowClientSendFirst)=0
 
virtual void startServer (const QString &realm, bool disableServerSendLast)=0
 
virtual QByteArray stepData () const =0
 
virtual QByteArray to_app ()=0
 
virtual QByteArray to_net ()=0
 
virtual void tryAgain ()=0
 
virtual void update (const QByteArray &from_net, const QByteArray &from_app)=0
 
virtual QString username () const =0
 
virtual bool waitForResultsReady (int msecs)=0
 

Detailed Description

SASL provider.

Note
This class is part of the provider plugin interface and should not be used directly by applications. You probably want SASL instead.

Definition at line 2601 of file qcaprovider.h.

Member Enumeration Documentation

◆ Result

Result of a SASL operation.

Enumerator
Success 

Operation completed.

Error 

Operation failed.

Params 

Parameters are needed to complete authentication.

AuthCheck 

Client login can be inspected (server only)

Continue 

More steps needed to complete authentication.

Definition at line 2631 of file qcaprovider.h.

Constructor & Destructor Documentation

◆ SASLContext()

QCA::SASLContext::SASLContext ( Provider * p)
inline

Standard constructor.

Parameters
pthe Provider associated with this context

Definition at line 2645 of file qcaprovider.h.

Member Function Documentation

◆ authCondition()

virtual SASL::AuthCondition QCA::SASLContext::authCondition ( ) const
pure virtual

Returns the reason for failure, if the authentication was not successful.

This is only valid after authentication failure.

◆ authzid()

virtual QString QCA::SASLContext::authzid ( ) const
pure virtual

Returns the authzid attempting to authorize (server mode only)

This is only valid after receiving the AuthCheck result code.

◆ clientParams()

virtual SASL::Params QCA::SASLContext::clientParams ( ) const
pure virtual

Returns the needed/optional client parameters.

This is only valid after receiving the Params result code.

◆ encoded()

virtual int QCA::SASLContext::encoded ( ) const
pure virtual

Returns the number of bytes of plaintext data that is encoded inside of to_net()

◆ haveClientInit()

virtual bool QCA::SASLContext::haveClientInit ( ) const
pure virtual

Returns true if the client has initialization data.

◆ mech()

virtual QString QCA::SASLContext::mech ( ) const
pure virtual

Returns the mechanism selected.

◆ mechlist()

virtual QStringList QCA::SASLContext::mechlist ( ) const
pure virtual

Returns the mechanism list (server mode only)

◆ nextStep()

virtual void QCA::SASLContext::nextStep ( const QByteArray & from_net)
pure virtual

Perform another step of the SASL authentication.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result() and stepData() will be valid.

Parameters
from_netthe data from the "other side" of the protocol to be used for the next step.

◆ realmlist()

virtual QStringList QCA::SASLContext::realmlist ( ) const
pure virtual

Returns the realm list (client mode only)

This is only valid after receiving the Params result code and SASL::Params::canSendRealm is set to true.

◆ reset()

virtual void QCA::SASLContext::reset ( )
pure virtual

Reset the object to its initial state.

◆ result()

virtual Result QCA::SASLContext::result ( ) const
pure virtual

Returns the result code of an operation.

◆ resultsReady

void QCA::SASLContext::resultsReady ( )
signal

Emit this when a startClient(), startServer(), serverFirstStep(), nextStep(), tryAgain(), or update() operation has completed.

◆ serverFirstStep()

virtual void QCA::SASLContext::serverFirstStep ( const QString & mech,
const QByteArray * clientInit )
pure virtual

Finishes server startup.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result() and stepData() will be valid. If result() is Success, then the session is now in the connected state.

Parameters
mechthe mechanism to use
clientInitinitial data from the client, or 0 if there is no such data

◆ setClientParams()

virtual void QCA::SASLContext::setClientParams ( const QString * user,
const QString * authzid,
const SecureArray * pass,
const QString * realm )
pure virtual

Set some of the client parameters (pass 0 to not set a field)

Parameters
userthe user name
authzidthe authorization name / role
passthe password
realmthe realm to authenticate in

◆ setConstraints()

virtual void QCA::SASLContext::setConstraints ( SASL::AuthFlags f,
int minSSF,
int maxSSF )
pure virtual

Set the constraints of the session using SSF values.

This function will be called before startClient() or startServer().

Parameters
fthe flags to use
minSSFthe minimum strength factor that is acceptable
maxSSFthe maximum strength factor that is acceptable

◆ setup()

virtual void QCA::SASLContext::setup ( const QString & service,
const QString & host,
const HostPort * local,
const HostPort * remote,
const QString & ext_id,
int ext_ssf )
pure virtual

Configure a new session.

This function will be called before any other configuration functions.

Parameters
servicethe name of the network service being provided by this application, which can be used by the SASL system for policy control. Examples: "imap", "xmpp"
hostthe hostname that the application is interacting with or as
localpointer to a HostPort representing the local end of a network socket, or 0 if this information is unknown or not available
remotepointer to a HostPort representing the peer end of a network socket, or 0 if this information is unknown or not available
ext_idthe id to be used for SASL EXTERNAL (client only)
ext_ssfthe SSF of the external authentication channel (client only)

◆ ssf()

virtual int QCA::SASLContext::ssf ( ) const
pure virtual

Returns the SSF of the active SASL session.

This is only valid after authentication success.

◆ startClient()

virtual void QCA::SASLContext::startClient ( const QStringList & mechlist,
bool allowClientSendFirst )
pure virtual

Begins the session in client mode, starting with the authentication.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result(), mech(), haveClientInit(), and stepData() will be valid. If result() is Success, then the session is now in the connected state.

Parameters
mechlistthe list of mechanisms
allowClientSendFirstwhether the client sends first (true) or the server sends first (false)

◆ startServer()

virtual void QCA::SASLContext::startServer ( const QString & realm,
bool disableServerSendLast )
pure virtual

Begins the session in server mode, starting with the authentication.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result() and mechlist() will be valid. The result() function will return Success or Error. If the result is Success, then serverFirstStep() will be called next.

Parameters
realmthe realm to authenticate in
disableServerSendLastwhether the client sends first (true) or the server sends first (false)

◆ stepData()

virtual QByteArray QCA::SASLContext::stepData ( ) const
pure virtual

Returns an authentication payload for to be transmitted over the network.

◆ to_app()

virtual QByteArray QCA::SASLContext::to_app ( )
pure virtual

Returns data that is decoded from the network and should be processed by the application.

◆ to_net()

virtual QByteArray QCA::SASLContext::to_net ( )
pure virtual

Returns data that should be sent across the network (for the security layer)

◆ tryAgain()

virtual void QCA::SASLContext::tryAgain ( )
pure virtual

Attempt the most recent operation again.

This is used if the result() of an operation is Params or AuthCheck.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result() and stepData() will be valid.

◆ update()

virtual void QCA::SASLContext::update ( const QByteArray & from_net,
const QByteArray & from_app )
pure virtual

Performs one iteration of the SASL security layer processing.

This function returns immediately, and completion is signaled with the resultsReady() signal.

On completion, result(), to_net(), encoded(), and to_app() will be valid. The result() function will return Success or Error.

Parameters
from_netthe data from the "other side" of the protocol
from_appthe data from the application of the protocol

◆ username()

virtual QString QCA::SASLContext::username ( ) const
pure virtual

Returns the username attempting to authenticate (server mode only)

This is only valid after receiving the AuthCheck result code.

◆ waitForResultsReady()

virtual bool QCA::SASLContext::waitForResultsReady ( int msecs)
pure virtual

Waits for a startClient(), startServer(), serverFirstStep(), nextStep(), tryAgain(), or update() operation to complete.

In this case, the resultsReady() signal is not emitted. Returns true if the operation completed or false if this function times out.

This function is blocking.

Parameters
msecsnumber of milliseconds to wait (-1 to wait forever)

The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.