Home · Modules · All Classes · All Namespaces
Public Slots | Signals | Public Member Functions | List of all members
Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor Class Reference

#include <TelepathyQt/_gen/svc-channel.h>

Inherits Tp::AbstractAdaptor.

Public Slots

void StartMechanism (const QString &mechanism, const QDBusMessage &dbusMessage)
 
void StartMechanismWithData (const QString &mechanism, const QByteArray &initialData, const QDBusMessage &dbusMessage)
 
void Respond (const QByteArray &responseData, const QDBusMessage &dbusMessage)
 
void AcceptSASL (const QDBusMessage &dbusMessage)
 
void AbortSASL (uint reason, const QString &debugMessage, const QDBusMessage &dbusMessage)
 

Signals

void SASLStatusChanged (uint status, const QString &reason, const QVariantMap &details)
 
void NewChallenge (const QByteArray &challengeData)
 

Public Member Functions

QStringList AvailableMechanisms () const
 
bool HasInitialData () const
 
bool CanTryAgain () const
 
uint SASLStatus () const
 
QString SASLError () const
 
QVariantMap SASLErrorDetails () const
 
QString AuthorizationIdentity () const
 
QString DefaultUsername () const
 
QString DefaultRealm () const
 
bool MaySaveResponse () const
 
- Public Member Functions inherited from Tp::AbstractAdaptor
 AbstractAdaptor (const QDBusConnection &connection, QObject *adaptee, QObject *parent)
 
 ~AbstractAdaptor ()
 
QDBusConnection dbusConnection () const
 
QObject * adaptee () const
 

Detailed Description

Adaptor class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Channel.Interface.SASLAuthentication".

Member Function Documentation

◆ AvailableMechanisms()

QStringList Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AvailableMechanisms ( ) const

Return the value of the exported D-Bus object property AvailableMechanisms of type QStringList.

Adaptees should export this property as a Qt property named 'availableMechanisms' with type QStringList.

The SASL mechanisms as offered by the server, plus any pseudo-SASL mechanisms supported by the connection manager for credentials transfer. For instance, in a protocol that natively uses SASL (like XMPP), this might be [ "X-TELEPATHY-PASSWORD", "PLAIN", "DIGEST-MD5", "SCRAM-SHA-1" ].

To make it possible to implement a very simple password-querying user interface without knowledge of any particular SASL mechanism, implementations of this interface MUST implement the pseudo-mechanism X-TELEPATHY-PASSWORD, unless each of the available mechanisms either requires additional information beyond the password (such as a username), or does not use a password.

Returns
The value of exported property AvailableMechanisms.

◆ HasInitialData()

bool Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::HasInitialData ( ) const

Return the value of the exported D-Bus object property HasInitialData of type bool.

Adaptees should export this property as a Qt property named 'hasInitialData' with type bool.

If true, StartMechanismWithData() can be expected to work for SASL mechanisms not starting with X-TELEPATHY- (this is the case in most, but not all, protocols). If false, StartMechanism() must be used instead.

This property does not affect the X-TELEPATHY- pseudo-mechanisms such as X-TELEPATHY-PASSWORD, which can use StartMechanismWithData() regardless of the value of this property.

Returns
The value of exported property HasInitialData.

◆ CanTryAgain()

bool Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::CanTryAgain ( ) const

Return the value of the exported D-Bus object property CanTryAgain of type bool.

Adaptees should export this property as a Qt property named 'canTryAgain' with type bool.

If true, StartMechanism() and (if supported) StartMechanismWithData() can be expected to work when in one of the Failed states. If false, the only thing you can do after failure is to close the channel.

Retrying isn't required to work, although some protocols and implementations allow it.

Returns
The value of exported property CanTryAgain.

◆ SASLStatus()

uint Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::SASLStatus ( ) const

Return the value of the exported D-Bus object property SASLStatus of type uint.

Adaptees should export this property as a Qt property named 'saslStatus' with type uint.

The current status of this channel. Change notification is via the SASLStatusChanged() signal.

Returns
The value of exported property SASLStatus.

◆ SASLError()

QString Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::SASLError ( ) const

Return the value of the exported D-Bus object property SASLError of type QString.

Adaptees should export this property as a Qt property named 'saslError' with type QString.

The reason for the SASLStatus , or an empty string if the state is neither Server_Failed nor Client_Failed.

In particular, an ordinary authentication failure (as would be produced for an incorrect password) SHOULD be represented by AuthenticationFailed, cancellation by the user's request SHOULD be represented by Cancelled, and cancellation by a local process due to inconsistent or invalid challenges from the server SHOULD be represented by ServiceConfused.

If this interface appears on a ChannelTypeServerAuthenticationInterface channel, and connection to the server fails with an authentication failure, this error code SHOULD be copied into the ConnectionInterface::ConnectionError() signal.

Returns
The value of exported property SASLError.

◆ SASLErrorDetails()

QVariantMap Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::SASLErrorDetails ( ) const

Return the value of the exported D-Bus object property SASLErrorDetails of type QVariantMap.

Adaptees should export this property as a Qt property named 'saslErrorDetails' with type QVariantMap.

If SASLError is non-empty, any additional information about the last disconnection; otherwise, the empty map. The keys and values are the same as for the second argument of ConnectionInterface::ConnectionError() .

If this interface appears on a ChannelTypeServerAuthenticationInterface channel, and connection to the server fails with an authentication failure, these details SHOULD be copied into the ConnectionInterface::ConnectionError() signal.

Returns
The value of exported property SASLErrorDetails.

◆ AuthorizationIdentity()

QString Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AuthorizationIdentity ( ) const

Return the value of the exported D-Bus object property AuthorizationIdentity of type QString.

Adaptees should export this property as a Qt property named 'authorizationIdentity' with type QString.

The identity for which authorization is being attempted, typically the 'account' from the ConnectionManagerInterface::RequestConnection() parameters, normalized and formatted according to the conventions used for SASL in this protocol.

The normalization used for SASL might not be the same normalization used elsewhere: for instance, in a protocol with email-like identifiers such as XMPP or SIP, the user "juliet@example.com" might have to authenticate to the example.com server via SASL PLAIN as "juliet".

This is usually achieved by using the authorization identity for authentication, but an advanced Handler could offer the option to authenticate under a different identity.

The terminology used here is that the authorization identity is who you want to act as, and the authentication identity is used to prove that you may do so. For instance, if Juliet is authorized to access a role account, "sysadmin@example.com", and act on its behalf, it might be possible to authenticate as "juliet@example.com" with her own password, but request to be authorized as "sysadmin@example.com" instead of her own account. See RFC 4422 §3.4.1 for more details.

In SASL the authorization identity is normally guessed from the authentication identity, but the information available to the connection manager is the identity for which authorization is required, such as the desired JID in XMPP, so that's what we signal to UIs; it's up to the UI to choose whether to authenticate as the authorization identity or some other identity.

As a concrete example, the "sysadmin" XMPP account mentioned above would have { 'account': 'sysadmin@example.com' } in its Parameters, and this property would also be 'sysadmin@example.com'. A simple Handler would merely prompt for sysadmin@example.com's password, and use that JID as both the authorization and authentication identity, which might result in SASL PLAIN authentication with the initial response '\\000sysadmin@example.com\\000root'.

A more advanced Handler might also ask for an authentication identity, defaulting to 'sysadmin@example.com'; if Juliet provided authentication identity 'juliet@example.com' and password 'romeo', the Handler might perform SASL PLAIN authentication using the initial response 'sysadmin@example.com\\000juliet@example.com\\000romeo'.

Returns
The value of exported property AuthorizationIdentity.

◆ DefaultUsername()

QString Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::DefaultUsername ( ) const

Return the value of the exported D-Bus object property DefaultUsername of type QString.

Adaptees should export this property as a Qt property named 'defaultUsername' with type QString.

The default username for use with SASL mechanisms that deal with a "simple username" (as defined in RFC 4422). If such a SASL mechanism is in use, clients SHOULD default to using the DefaultUsername; also, if the client uses the DefaultUsername, it SHOULD assume that the authorization identity AuthorizationIdentity will be derived from it by the server.

In XMPP, servers typically expect "user@example.com" to authenticate with username "user"; this was a SHOULD in RFC 3920.

3920bis weakens that SHOULD to "in the absence of local information provided by the server, an XMPP client SHOULD assume that the authentication identity for such a SASL mechanism is the combination of a user name and password, where the simple user name is the localpart of the user's JID".

For example, in the simple case, if the user connects with ConnectionManagerInterface::RequestConnection() ({ account: "user@example.com" }) and use PLAIN with password "password", he or she should authenticate like so: "\\0user\\0password" and the channel will look like this:

{ "...  DefaultUsername   ": "user",
  "...  AuthorizationIdentity   ": "user@example.com }

In the complex case, if the same user is using his or her sysadmin powers to log in as the "announcements" role address, he or she would connect with ConnectionManagerInterface::RequestConnection() ({ account: "announcements@example.com" }) and the SASL channel would look like this:

{ "...  DefaultUsername   ": "announcements",
  "...  AuthorizationIdentity   ": "announcements@example.com }

A sufficiently elaborate UI could give the opportunity to override the username from "announcements" to "user". The user's simple username is still "user", and the password is still "password", but this time he or she is trying to authorize to act as announcements@example.com, so the UI would have to perform SASL PLAIN with this string: "announcements@example.com\\0user\\0password", where "announcements@example.com" is the AuthorizationIdentity .

Returns
The value of exported property DefaultUsername.

◆ DefaultRealm()

QString Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::DefaultRealm ( ) const

Return the value of the exported D-Bus object property DefaultRealm of type QString.

Adaptees should export this property as a Qt property named 'defaultRealm' with type QString.

The default realm (as defined in RFC 2831) to use for authentication, if the server does not supply one.

The server is not required to provide a realm; if it doesn't, the client is expected to ask the user or provide a sensible default, typically the requested DNS name of the server. In some implementations of DIGEST-MD5, the server does not specify a realm, but expects that the client will choose a particular default, and authentication will fail if the client's default is different. Connection managers for protocols where this occurs are more easily able to work around these implementations than a generic client would be.

Returns
The value of exported property DefaultRealm.

◆ MaySaveResponse()

bool Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::MaySaveResponse ( ) const

Return the value of the exported D-Bus object property MaySaveResponse of type bool.

Adaptees should export this property as a Qt property named 'maySaveResponse' with type bool.

Whether or not the client can save the authentication response and re-use it to automate future authentication challenges.

If this property is False, the client SHOULD NOT attempt to cache the authentication response in its own keyring.

If this property is not specified, it should be treated as if it were True.

Some protocols or services may have terms and conditions that prohibit caching a user's credentials.

Returns
The value of exported property MaySaveResponse.

◆ StartMechanism

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanism ( const QString &  mechanism,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method StartMechanism on this object.

Adaptees should export this method as a Qt slot with the following signature: void startMechanism(const QString& mechanism, const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Start an authentication try using Mechanism, without sending initial data (an "initial response" as defined in RFC 4422).

This method is appropriate for mechanisms where the client cannot send anything until it receives a challenge from the server, such as DIGEST-MD5 in "initial authentication" mode.

Parameters
mechanism
The chosen mechanism.

◆ StartMechanismWithData

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismWithData ( const QString &  mechanism,
const QByteArray &  initialData,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method StartMechanismWithData on this object.

Adaptees should export this method as a Qt slot with the following signature: void startMechanismWithData(const QString& mechanism, const QByteArray& initialData, const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::StartMechanismWithDataContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Start an authentication try using Mechanism, and send Initial_Data as the "initial response" defined in RFC 4422 §3.3.

This method is appropriate for mechanisms where the client may send data first, such as PLAIN, or must send data first, such as DIGEST-MD5 in "subsequent authentication" mode.

Having two methods allows any mechanism where it makes a difference to distinguish between the absence of an initial response ( StartMechanism() ) and a zero-byte initial response (StartMechanismWithData, with Initial_Data empty).

If the HasInitialData property is false, this indicates that the underlying protocol does not make it possible to send initial data. In such protocols, this method may only be used for the X-TELEPATHY- pseudo-mechanisms (such as X-TELEPATHY-PASSWORD), and will fail if used with an ordinary SASL mechanism.

For instance, the IRC SASL extension implemented in Charybdis and Atheme does not support initial data - the first message in the exchange only carries the mechanism. This is significant if using DIGEST-MD5, which cannot be used in the faster "subsequent authentication" mode on a protocol not supporting initial data.

Parameters
mechanism
The chosen mechanism.
initialData
Initial data (an &quot;initial response&quot; in RFC 4422&apos;s 
terminology) to send with the mechanism.

◆ Respond

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::Respond ( const QByteArray &  responseData,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method Respond on this object.

Adaptees should export this method as a Qt slot with the following signature: void respond(const QByteArray& responseData, const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::RespondContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Send a response to the the last challenge received via NewChallenge() .

Parameters
responseData
The response data.

◆ AcceptSASL

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AcceptSASL ( const QDBusMessage &  dbusMessage)
slot

Begins a call to the exported D-Bus method AcceptSASL on this object.

Adaptees should export this method as a Qt slot with the following signature: void acceptSASL(const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AcceptSASLContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

If the channel's status is SASL_Status_Server_Succeeded, this method confirms successful authentication and advances the status of the channel to SASL_Status_Succeeded.

If the channel's status is SASL_Status_In_Progress, calling this method indicates that the last NewChallenge() signal was in fact additional data sent after a successful SASL negotiation, and declares that from the client's point of view, authentication was successful. This advances the state of the channel to SASL_Status_Client_Accepted.

In mechanisms where the server authenticates itself to the client, calling this method indicates that the client considers this to have been successful. In the case of ChannelTypeServerAuthenticationInterface channels, this means that the connection manager MAY continue to connect, and MAY advance the ConnectionInterface::Status to Connected.

◆ AbortSASL

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AbortSASL ( uint  reason,
const QString &  debugMessage,
const QDBusMessage &  dbusMessage 
)
slot

Begins a call to the exported D-Bus method AbortSASL on this object.

Adaptees should export this method as a Qt slot with the following signature: void abortSASL(uint reason, const QString& debugMessage, const Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::AbortSASLContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Abort the current authentication try.

If the current status is SASL_Status_Server_Failed or SASL_Status_Client_Failed, this method returns successfully, but has no further effect. If the current status is SASL_Status_Succeeded or SASL_Status_Client_Accepted then NotAvailable is raised. Otherwise, it changes the channel's state to SASL_Status_Client_Failed, with an appropriate error name and reason code.

Parameters
reason
Reason for abort.
debugMessage
Debug message for abort.

◆ SASLStatusChanged

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::SASLStatusChanged ( uint  status,
const QString &  reason,
const QVariantMap &  details 
)
signal

Represents the exported D-Bus signal SASLStatusChanged on this object.

Adaptees should export this signal as a Qt signal with the following signature: void saslStatusChanged(uint status, const QString& reason, const QVariantMap& details);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters
status
The new value of SASLStatus.
reason
The new value of SASLError.
details
The new value of SASLErrorDetails.

◆ NewChallenge

void Tp::Service::ChannelInterfaceSASLAuthenticationAdaptor::NewChallenge ( const QByteArray &  challengeData)
signal

Represents the exported D-Bus signal NewChallenge on this object.

Adaptees should export this signal as a Qt signal with the following signature: void newChallenge(const QByteArray& challengeData);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters
challengeData
The challenge data or additional data from the server.